CodingNeed.

2 · Make decisions · 7 MIN

Read and fix an error

Errors are clues you can investigate.

A ReferenceError often means a name does not exist in the current scope. A SyntaxError means the code cannot be parsed. Read the error type and location, reproduce the smallest example, change one thing, and run again. The sample below uses the same spelling everywhere.

An error message is a signpost showing where the computer lost the trail.

Read the example

const userName = "Ada";
console.log(userName);
Check the expected output
Ada

Your challenge

Fix the misspelled name in the starter. The function must return the input doubled.

Common trap

Changing several unrelated lines makes it harder to identify the cause.

Next lesson: Reuse a function