Double Equal (==) vs Triple Equal (===):
This two are comparison operators. Here double equal(==) operator is used to compare values. Triple equal(===) operator is used to compare values and also check the types. This is the main difference between them.
Null vs Undefined:
Undefined means that a variable is declared, but no value has been assigned a value. Null means an empty or non-existence value. You can assign it to a variable.
In JS there are three type of scope:
- Local Scope
- Global Scope
- Block Scope
When a variable defines outside of a function is in the global scope. Global variables can be accessed and modified from any function. And when a variable defines inside of a function is in the local scope. Local variables cannot be accessed or modified outside the function declaration. Block scope is related to the variables declared using let and const. Variables declared with var do not have block scope.
Apply .map(), .filter(), .find() in objects:
.map() returns a new array from an existing one. Look at the example below:
.filter() method takes each element in an array and it applies a conditional statement against it. It returns an array with less items than the original array.
.find() method returns the first items in an array that satisfies a condition. It is very much like the .filter() method, except it only returns a single element.
Apply call() , apply() and bind():
apply(): The apply method is similar to the call() method. The only difference is that, call() method takes arguments separately whereas, apply() method takes arguments as an array.
bind(): This method returns a new function, where the value of this keyword will be bound to the owner object, which is provided as a parameter.
I hope this will help you a lot. If you think this is a useful one please share it. Please feel free to suggest me anything over comments.
Thanks a lot for reading. Thank you very much.