Data Types
๐จโ๐ผ JavaScript has different types of values. The three most basic types are:
- Strings - Text wrapped in quotes:
"Hello"or'Hello' - Numbers - Numeric values:
42,3.14,-7 - Booleans - True or false values:
true,false
- Create a string variable called
messagewith any text - Create a number variable called
agewith a number - Create a boolean variable called
isLearningset totrue - Log each variable with its type using
typeof
๐ฐ The
typeof operator tells you what type a value is:console.log(typeof 'hello') // "string"
console.log(typeof 42) // "number"
console.log(typeof true) // "boolean"