What does the following code output? console.log(typeof class {});

JavaScript Developer Medium

JavaScript Developer — Medium

What does the following code output? console.log(typeof class {});

Key points

  • JavaScript classes are syntactic sugar for constructor functions
  • The typeof operator returns the type of an object
  • 'class' is not a valid type in JavaScript
  • The output is based on the actual type of the object

Ready to go further?

Related questions