For example, two objects can have two instances of the constructor function but it won’t make sense to have a copy of that constructor function doing the same thing. Instead, we use the prototype property of a construction function. Since this prototype is connected with each object, your problem is solved.
An immediately invoked function expression (IIFE) executes functions immediately, as soon as they are created. Variables that are declared within the IIFE cannot be accessed by the global scope (outside world), meaning you can avoid the global scope from being polluted.
The main reason to use this is to obtain data privacy and execute the code. This means that if you want to invoke the function expression instantly, you just need to tackle a couple of parentheses on the end.
Learning about issues such as inheritance, objects, instances, and encapsulation are the most important elements of the most popular programming paradigm—object-oriented programming.
This is a function inside another function and has access to the outer function variable. It is also called the inner function, as it can access the variable defined in its scope, meaning the scope of its parent function and the global variables. However, keep in mind that the outer function cannot have access to the inner function variable.
Become a more social person