Gradient
Lesson 1.1Code~45 min

Values, variables & types

Numbers, text and true/false — giving them names, and why TypeScript checks your work.

Module 1 · 0/8 done

Everything is a value

A program is a list of instructions that push values around. For almost everything in this course you only need three kinds:

  • numbers — 42, -3, 0.001. Whole or decimal, it’s all one type.
  • strings — text, always inside quotes: "hello".
  • booleans — just true or false. Yes or no.
Try itThree kinds of value
// Three basic kinds of value:
console.log(42)               // a number
console.log(3.14)             // also a number (decimals are fine)
console.log("forty-two")      // a string: text, inside quotes
console.log(true)             // a boolean: true or false

// typeof tells you what kind a value is
console.log(typeof 42, typeof "hi", typeof false)
Press Run (⌘/Ctrl + Enter) to see output here.