×

typescript · level 1 · unit 2 · lesson 2

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

Put something new in a box and the old thing is gone.

Boxes made with let can change. Write the name, = and a new value, without let this time. The old value is thrown away. You can also copy one box into another.

Some boxes should never change, like your birthday. Make those with , short for constant. Try to change one and the checker stops you with TS2588.

+ can strings, end to end. "I feel " + mood sticks two strings into one. Leave a space inside the quotes, or the words will bump into each other.

let mood: string = "sleepy";
mood = "happy";
const birthday: string = "4 May";
console.log("I feel " + mood);
console.log("My birthday is " + birthday);

Use const for boxes that stay the same, and let for boxes you plan to change.