01. Truthy and Falsy:
The value which consider as a true when encountered in a Boolean context
On the other hand the value which consider as a true when encountered in a Boolean context. Now according to MDN documentation there can be 9 falsy value. here is the list
Except these 9 case all the cases will give you truthy value.
02. Null vs Undefined:
here you can see that we declared a variable named “name” and we did not assign a value into this. Now if we see the out put then we will see that it gives undefined. It means when we create a variable and not assign a value it returns a undefined result. The typeOf undefined is “undefined”
Now look at a null example,
03. Double equal (==) vs Triple (===) :
Double equal ( == ) also known as lenient or loose equal and triple equal ( = = = ) know as strict equal. Well The main theme is double equal (==) checks the value only, even if the type if different double equal wont bother. for example :
On the other hand triple equal ( = = = ) compares both value and type. This checking is more reliable and it gives your desire output every time. For example,
Modern developer often use triple equal for better and accurate performance.
04. Global Scope vs Local Scope:
When we declare a variable outside of a function then it becomes global variable and when we declare a function inside a function then it becomes a local variable. We can access the global variable from any corner but we can only local variable inside of the function. Anything in the global scope could be accessible across your application
Local scope is a characteristic of variables that makes them local. local variable are not available every where. Rather its only available into the function. Lets see an example: