Paracetamol.js💊| #1: ¿Cuales son los presentes tipos de datos de JavaScript?

Cristian Fernando - Jan 2 '22 - - Dev Community

Tipos primitivos:

console.log(typeof "Rojo"); // string
console.log(typeof 21); //number
console.log(typeof true); // boolean
console.log(typeof undefined); // undefined
console.log(typeof Symbol()); // symbol
console.log(typeof 2n); // bigint

console.log(typeof null); // object
Enter fullscreen mode Exit fullscreen mode

null es primitivo pese a que nos da object, ello por un bug que tiene el lenguaje como tal.

Objetos

console.log(typeof {}); // object
console.log(typeof []); // object
console.log(typeof function () { }); //function
Enter fullscreen mode Exit fullscreen mode

Las funciones son utilizan el constructor Object pero con una pequeña variante, pero en el fondo son objetos.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .