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.
Loading...
Related Quiz
- Which of the following options is a technique to manage callback hell in JavaScript?
- What is NOT a consequence of dynamic scoping, considering JavaScript uses lexical scoping?
- Why might for...of loops be preferred when working with asynchronous code?
- How can you handle errors in the fetch API when using async/await syntax?
- The Fetch API returns a _________ which resolves to the Response of the request, whether it is successful or not.