Recall & Review
beginner
What is the simplest way to display a message in JavaScript?
Use
console.log('Your message'); to print a message to the browser's console.Click to reveal answer
beginner
What does
console.log('Hello, world!'); do?It prints the text Hello, world! to the browser's console, which is a place to see messages from your program.
Click to reveal answer
beginner
Where do you write JavaScript code to run it in a web browser?
You can write JavaScript inside a
<script> tag in an HTML file or in a separate .js file linked to the HTML.Click to reveal answer
beginner
How do you run your first JavaScript program in a browser?
Open your HTML file with the JavaScript code in a web browser, then open the browser's developer console to see the output.
Click to reveal answer
beginner
Why is
console.log() useful when learning JavaScript?It helps you see what your program is doing by showing messages, making it easier to understand and find mistakes.
Click to reveal answer
Which JavaScript command prints text to the console?
✗ Incorrect
console.log() is the correct way to print messages to the browser console.Where do you put JavaScript code inside an HTML file?
✗ Incorrect
JavaScript code goes inside the
<script> tag, which can be placed in <head> or <body>.What do you need to open to see the output of
console.log()?✗ Incorrect
The browser console shows messages printed by
console.log().Which file extension is used for JavaScript files?
✗ Incorrect
JavaScript files use the
.js extension.What is the purpose of writing your first JavaScript program?
✗ Incorrect
Writing your first JavaScript program helps you learn how to tell the computer what to do.
Explain how to write and run your first JavaScript program in a web browser.
Think about where the code goes and how you see the result.
You got /4 concepts.
Why is using console.log() helpful when starting to learn JavaScript?
Consider how you check what your program does.
You got /4 concepts.