Your product could be here, in front of thousands of JavaScript developers. Sponsor this spot →
JavaScript Quiz

What is typeof a class in JavaScript?

Do you know what will be the output of this code?

JavaScript
class A {}
console.log(typeof A);
Show answer and explanation

The answer is "function".

Classes are mostly syntax on top of constructor functions and prototypes. The main differences are that they must be called with new and their body is always in strict mode.

Take the full quiz Next question →

More Classes & Prototypes questions

  1. Why does this become undefined when you extract a method?
  2. What happens when a constructor returns an object?
  3. Do objects see prototype changes made after they're created?
  4. Are JavaScript classes hoisted?
  5. Can you call a static method on a class instance?

Related topics