Front End developers are the ones that write code, create interfaces and translate designs into something viewable in a browser. It takes a lot of knowledge to do this effectively and efficiently.
The difference between == and ===
Strict Equality operator: ===
The strict equality operator checks whether both the operands are of the same type and value. If any of the operands are not of the same type or not equal, it returns false by default.
Loose Equality operator: ==
The loose equality operator doesn’t care about the values’ types and just checks for object reference comparison only.
The most basic difference between == and === is the fact that == doesn’t check for type, while === checks for type.
When you compare two string literals (i.e. “text” == “text”), they’re equal since not only do they have the same value but also the same type. However, the result will be false when you test whether a string literal is equal to a string variable (i.e. “text” == text) because one is a string literal while the other is a string variable.
The double equal operator == performs type coercion, whereas the triple similar operator === does not perform type coercion. If two values are not of the same type, === will return false, but == will attempt to coerce the values before performing a comparison.
Identifying the execution context
There are two types of execution context: global and local. The global context is where all the code lives, and local contexts are created when you declare a function inside of another function.
The execution context also creates a scope chain. The scope chain is essentially a collection of variables that your code has access to at any given point in time.
Understanding by value vs by reference
You can save yourself a lot of trouble if you understand the difference between values and references. Values are copies of something, while references are pointers to something (or someone!).
You can pass an object reference to a function or modify it from inside the function, and it will affect the original variable outside of the function! Also, if you assign a new object to the variable outside of the function, inside the function, you will have access only to that specific object reference!
Using object prototypes
Objects created in this way are often referred to as “classes”, which is why some people refer to prototypes as “classes” (as opposed to “constructors” or “functors”). The term “prototype-based programming” also implies that objects are created from prototypes but do not distinguish between classes and prototypes or between prototypal inheritance and classical inheritance.
The prototype pattern is a creational design pattern in software development. It is used when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects.
The basic idea of the prototype pattern is to create objects based on a prototype of an existing object and then make modifications to the newly created object based on the prototype. Using prototypes instead of classes makes adding new properties or functionality later in the program more accessible.
Understanding immediately-invoked function expressions
Immediately-invoked function expressions can avoid variable hoisting from within blocks, protect against polluting the global environment and simultaneously allow public access to methods while retaining privacy for variables defined within the function.
They’re used to wrap code that needs to be executed as soon as possible to avoid polluting the global namespace. The most common use case of an IIFE is to create private variables.
When we use IIFEs, we also benefit from creating closures. Closures allow us to bind values to our functions, and these values will persist even when the function has completed executing.