CodingNeed.

1 · First steps · 7 MIN

Give values a name

Variables keep values available for later instructions.

Use const for a binding you will not reassign and let when the value must change. A string such as "3" is text; 3 is a number. Names are case-sensitive. Read the value on the right before assigning it to the name on the left.

A label on a box tells you which value you are working with. let lets you replace what is in that box.

Read the example

let points = 2;
points = points + 3;
console.log(points);
Check the expected output
5

Your challenge

Return the input number plus 10. Accept zero and negative numbers too.

Common trap

Assigning to a const binding again throws an error. const does not freeze an object.

Next lesson: Calculate a total