Recall & Review
beginner
What is output formatting in programming?
Output formatting means arranging and displaying data in a way that is easy to read and understand.
Click to reveal answer
beginner
How do you print a variable with text in JavaScript using template literals?
Use backticks `` and ${variable} inside them. Example:
console.log(`Hello, ${name}!`);Click to reveal answer
beginner
What does
console.log() do in JavaScript?It prints messages or values to the browser console or terminal, helping you see output or debug your code.
Click to reveal answer
intermediate
How can you format numbers to show two decimal places in JavaScript?
Use the <code>toFixed(2)</code> method. Example: <code>let price = 5.6789; console.log(price.toFixed(2)); // 5.68</code>Click to reveal answer
beginner
Why is output formatting important?
It makes data clear and easy to understand, which helps users and developers avoid mistakes and confusion.
Click to reveal answer
Which symbol is used to create template literals in JavaScript?
✗ Incorrect
Template literals use backticks (`) to allow embedding variables easily.
What does
console.log('Hello, ' + name); do?✗ Incorrect
It prints the text 'Hello, ' plus the value stored in the variable name.
How do you limit a number to 2 decimal places in JavaScript?
✗ Incorrect
The toFixed(2) method formats a number to 2 decimal places.
Which method prints output to the console in JavaScript?
✗ Incorrect
console.log() is the standard way to print output in JavaScript.
Why use output formatting?
✗ Incorrect
Formatting output helps users and developers understand data easily.
Explain how to use template literals in JavaScript to format output with variables.
Think about how to combine text and variables in one string.
You got /4 concepts.
Describe why formatting numbers to fixed decimal places is useful in output.
Consider how numbers look when printed to users.
You got /4 concepts.