Which keyword is used to create a class in JavaScript?

  • class
  • new
  • function
  • prototype
In JavaScript, the class keyword is used to create a class. Classes provide a convenient and more structured way to define constructor functions and prototypes. While new is important for instantiating objects, it's not used to create classes. The function and prototype keywords are used in traditional constructor-based object creation.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *