Constructor function and return statement in j.s
CONSTRUCTOR FUNCTION A constructor function in JavaScript is a special function used as blueprint to create and initialize multiple objects of the same type. It defines the structure (properties) a...

Source: DEV Community
CONSTRUCTOR FUNCTION A constructor function in JavaScript is a special function used as blueprint to create and initialize multiple objects of the same type. It defines the structure (properties) and behavior (methods) that every instance created from it will possess. To create a object type we can use the constructor function. It is considered to the good practice to name constructor function with an using a upper-case letter in the first letter Create the constructor you must be called with the new operator const car1={ brand: "ford", price: 6,00,000, color: "blue", } const car2{ brand: "tata", price: 6,70,000, color: "red", } It is the normal object creating method for car details This type of method to using for two or three car details.If you can write the all ford car details so this method is too difficult we can use the constructor function lets you reuse code to create many objects to easily with single line code EXAMPLE: EXPLANATION: Create a function with write the parameter