×

typescript · level 1 · unit 3 · 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

TypeScript is a calculator that never gets tired.

Each maths symbol is an . + adds, - takes away, * multiplies and / divides. Keyboards have no times sign, so we use the star instead.

A is a number too, so 7 / 2 gives 3.5, and 3.5 fits in a number box. Whole numbers and decimals share one type.

Like at school, * and / happen before + and -. So 2 + 3 * 4 is 14. Wrap a part in brackets to make it happen first.

console.log(7 / 2);
console.log(2 + 3 * 4);
console.log((2 + 3) * 4);
let price: number = 1.5;
console.log(price * 4);

Never put a comma inside a number, like 1,000. Write 1000.