Reflect.construct() Basics
Hard
1
1
61.5% Acceptance
In this lab, you will learn to use the Reflect.construct() method in JavaScript. Reflect.construct() allows you to create a new instance of a class or a function constructor, similar to the 'new' keyword but with additional features. You will create a class, an instance of the class using Reflect.construct(), and finally export the instance variable.
- Create a class 'Car' with a constructor that takes two arguments: 'brand' and 'color'.
- Create an instance of the 'Car' class using Reflect.construct() with a given array containing brand and color.
- Export the instance variable from the 'index.js' file using ESM syntax.