- Undefined
- Boolean
- Number
- String
- BigInt
- Symbol
- Object
- Array
- Dates
- Maps, Sets
- JSON
- Functions
- Primitives = Acesso direto ao valor;
- Non-Primitives = Acesso via referencia ao valor (Ponteiro);
- Exemplo
-
let person = {}; person.name = "John Doe"; person.age = 20;
-
-
Array == Objects
-
Exemplo
-
let person = []; person.name = "John Doe"; person["age"] = 20; person[0] = "Foo"; console.log(person);
Output: ["Foo", name: 'John Doe', age: 20]
-
- Exemplo
-
// ARRAY let [A, B] = [true, false]; // OBJECT let {C, D} = {C: true, D: false}; console.log(A) //! true; console.log(B) //! false;
Output: true, false
-
- Não possui contexto
- Não possui 'this' proprio
- Utiliza o contexto do 'parente'
- Não tem acesso ao objeto 'arguments' de uma function comum
- Exemplo
-
let soma = (num1, num2) => { return num1 + num2; }
-
- Exemplo
-
globalvar = 1; OR window.globalvar = 1;
-
- Função declarada dentro de outra função
- Utilizado para manter o contexto da função 'Pai'