What is the output of the following code snippet? console.log(typeof null); console.log(typeof undefined);

Web Development Medium

Web Development — Medium

What is the output of the following code snippet? console.log(typeof null); console.log(typeof undefined);

Key points

  • null is an object type in JS
  • undefined is its own primitive type
  • typeof is unreliable for null checks

Ready to go further?

Related questions