We know about some important topics from javascript :
Published: 2021-12-25 20:37:11

Truthy and Falsy values, Null Vs Undefined, double equal (==) vs triple equal (===), implicit conversion.

In javascript truthy value is when input value truthy then returns true as a boolean context. So when a value returns true now we know about that :
If a value is true then return true.
Any string is truthy 
 Any positive and negative numbers are truthy
Array and object are truthy

	So which values are falsy?
If the input is false then this value returns false
Number 0 returns false
 If any value is undefined, NULL and NAN then these imputed output values will be false
	

 Scope, block scope, window, global variable, global scope.
	
Scope: Scope is basically referred to the javascript current context. We can say 
it like a box. There are some types of explanations about scopes:
Block Scope: Block Scope in the curly bracket. As we use a switch, if-else loops 
expression in the curly bracket.it’s called Block scope.
Global Scope: Global scope means that it declare outside in block scope. Which is 
used anywhere in the program.

Window: On the web page, the full viewport on the interface is called a window. Which is contains DOM. we can trigger any id or class using window.document.(which is expected) and can change or manipulate these properties.in javascript, everything is stored in the window.

Global Variable: Global variable declared globally which we use from anywhere.


Closure and  Encapsulation:
Closure: in closure return a function in the parent function. Child function store his previous reference and when we can this parent function then child function executes by his previous reference. 
In summary, closure is a function is returns a new child function, those functions have created a closure or encapsulation among them. And when we call this function again and again it is executed from his previous stored values.

 “this” Keyword:
This means this is. It’s like which context is executed this the “this”. When we globally check this keyword returns the full window because this keyword executes from full context. Some properties of the ‘This’ keyword:
If any function call individually then this keyword executes from the window.
In the arrow function, this keyword is executed from the window.
But regular functions can hold this keyword. which is executed from his context.
We can simply say that this is executed context. From where the context is executed this is the main part. 


 How Javascript works event loop stack and queue (How javascript code executes)
Basically, javascript is run by call stack. Execute the function that gets first and this function will be stored in stack first. And then next fucntion will be executed like this. Which function’s execution is over this is removed from the stack. All over the process runs synchronously. In that case, if a function takes more time to run then all process is waiting. For this reason, the asynchronous way is coming up with javascript. It means when any function takes more time to run then it’s not pending this process continues. And when that function run successfully this will be executed.

So, how work in an asynchronous way?
Which function takes time to execute this goes into the event loop.it’s like a queue. queue means first in first out. So the function is coming first this will be executed first. Which function comes here first will go away in the stack. Stack is means last in first out.
Bringing something queue to stack it’s called an event loop. basically, it’s working with the event loop.