“Null” means the variable has no value and that is known by the programmer and also value is assigned as ‘’null’ by the programmer.
var: var is a statement to declares a variable. It is a functional and global scope. It can be re-assigned.
const: const is also a statement of declaring a variable. It is also an ES6’s feature. It is also a block scope. If you need a constant value of a variable you should use the const keyword. It can’t allow re-assigned variables. If we will try to re-assigned a variable with const then you should get an error like below :
TypeError: Assignment to constant variable.at Object.<anonymous> (c:\Users\Personal\Desktop\BlogsForJS\index.js:220:2)at Module._compile (internal/modules/cjs/loader.js:1063:30)at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)at Module.load (internal/modules/cjs/loader.js:928:32)at Function.Module._load (internal/modules/cjs/loader.js:769:14)at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)at internal/main/run_main_module.js:17:47
- == (Double equals operator): Known as the equality or abstract comparison operator. Double equal doesn’t concern about the type it is concern about value.
2.=== (Triple equals operator): Known as the identity or strict comparison operator. If two value has the same type then it returns true otherwise false.
If you try the below code :
then you will get this error:
Scoping idea is applied for the function and object also.
9.What is DRY: If we can live in good health we need clean and calm food, an environment, and so on. In the same way, if our code should be clean and clean so that everyone understands the code. The DRY principle helps us to keep this type of code. DRY means Do not Repeat Yourselves. That means we write one type of code one time. Not again and again we repeat the same code.
10.IIFE: Generally when we create a function for any reason it should be called/invoked for the execution of the function. What if when we create the function and immediately call this?😉 That is the concept of IIFE. IIFE means Immediately Invoked Function Expressions. We create a function and call the function at a time.
Look at the Example:
So, this is from my side. I think these topics are very important for any interview question for the junior level. So, that’s it for today.