Go Back

Welcome To This Library

1.The storage capacity of local storage is 5MB/10MB. On the other hand, The storage capacity of session storage is 5MB
2.As it is not session-based, it must be deleted via javascript or manually. On the other hand, It's session-based and works per window or tab. This means that data is stored only for the duration of a session, i.e., until the browser (or tab) is closed.
3.The client can only read local storage

The variables defined outside of any function or curly brackets are known as global variables and have global scope. Global scope means that the variables can be accessed from any part of that program, any function or conditional state can access that variable.
Block scope is also a sub-type of local scope. The block scope can be defined as the scope of the variables inside the curly brackets {}. Now, these curly brackets can be of loops, or conditional statements, or something else. You are only allowed to refer to these variables from within the curly brackets {}

Since we know that Web APIs delegate some of the tasks to different threads, on completion of these tasks, how the main or desired functions are sent to the call stack. Event Queue is a special queue, which keeps track of all the functions queues, which are needed to be pushed into the call stack. The event queue is responsible for sending new functions to the track for processing. The queue data structure is required to maintain the correct sequence in which all operations should be sent for execution.Let's take an example, in the following example, we are using a setTimeout function, which will log the "executed" string after 2000 milliseconds.Now when a setTimeout operation is processed in the call stack. On its execution, it calls a web API which fires a timer for 2000 milliseconds. After 2000 milliseconds has been elapsed, the web API, place the callback function of setTimeout in the event queue. Here need to mention that, just placing our function does not necessarily imply that the function will get executed. This function has to be pushed into the call stack for execution and here the event loop comes into the picture. The event loop waits for the function stack to be empty, once the call stack is empty this will push the first function from the event queue to the call stack, and in this way, the desired function will be called.Thus event loop works in a cyclic manner, where it continually checks whether or not the call stack is empty. If it is empty, new functions are added from the event queue. If it is not, then the current function call is processed.

8 ways to get Undefine
1. Variable that is not initialized will give undefined
2. Function with no return
3. Parameter that is not passed will be undefined
4. Ff return has nothing on the right side will return undefined
5. Property that doesn't exists on an object will give you undefined
6. Accessing array elements outside of the index range
7. Deleting an element inside an array
8. Set a value directly to undefined