JavaScript Data types Bible
1 min readJul 17, 2021
Data types are values that don’t have properties. Below are the latest ECMAScript standard JS data types.
- Numbers (1, 1.2, 2, 3.4 NaN)
- Strings = “Timmy” or ‘Please feed dog’ , backticks `${interpolate} `
- backticks interpolated with $ = called Template literals
- inside the brackets = include variables, other primitives that can be converted into a string
- strings are quoted because if can mean something very special to JS or it can be a reserved word (“if you can keep cooking”)
3. Null (null — empty, kinda like `nil`)
4. Boolean (true, false)
5. Undefined = weird empty placeholder
6. Object = { } , [ ], function() { }
- use . and then state’s name
- trigger behavior by using behavior’s name followed by a ()
- . is a separator bw the object-name and the state or behavior name
- behaviors on objects are called methods
- object’s methods have access to all of that object’s properties
- methods can take arguments
- arguments change the method’s operation
- Poodle.eat(1); //=> “Timmy eats 1 can of food”
- methods can take many arguments just separate them each with its own ‘ ‘ and comma,
- document = important object when working with DOM
7. Symbol — new Symbol(“name”)