Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!