Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
Typeof groups in javascript

Is the following a correct classification of the different (main) value types in Javascript?

'use strict';
let
    a = undefined,
    b = false,      
    c = 'hello',
    d = 2.42,
    e = 4,
    f = BigInt(272),
    g = Symbol('a'),
    h = function() {return 'hi'},
    i = null,
    j = /123/,
    k = [1,2,3],
    l = {1: 2};

console.log(`
    // Undefined
    a. ${a} --> ${typeof a}

    // Primitives
    b. ${b} --> ${typeof b}
    c. ${c} --> ${typeof c}
    d. ${d} --> ${typeof d}
    e. ${e} --> ${typeof e}

    // New Primitives
    f. ${f} --> ${typeof f}
    g. ${g.toString()} --> ${typeof g}

    // Function
    h. ${h} --> ${typeof h}

    // Object (everything else)
    i. ${i} --> ${typeof i}
    j. ${j} --> ${typeof j}
    k. ${k} --> ${typeof k}
    k. ${l} --> ${typeof l}
`);

Additionally, it seems very odd to me that the value undefined has type undefined, but then the value null has the type object -- why does the language define it like that?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda