Case matters
console.Log doesn't exist, so it's undefined. Using a name that was never declared (scoRe) is a ReferenceError.
A JavaScript program is a list of statements run from top to bottom; semicolons end statements (and are added automatically in most, but not all, places), comments are notes the engine ignores, and every name is case-sensitive.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write a program that stores the length (8) and width (5) of a room, works out the area, and logs Area: 40, with a comment for each step.
This code prints undefined. Fix it so it prints { ok: true }:
``js
function check() {
return
{ ok: true }
}
console.log(check())
Find and fix the two bugs: const UserName = "Ravi";
console.Log("Hi", userName);
Explain it without notes
What is the difference between a statement and an expression?
Explain Automatic Semicolon Insertion and give two cases where it surprises people.
What does case-sensitive mean in JavaScript, and what errors does a wrong capital cause?
When should you write a comment, and when shouldn't you?
Preview
Console
Nothing logged yet.Expected console output
10 20 30
function undefined
Uncaught ReferenceError: scoRe is not defined