Session Storage:
The session storage remains in the browser as long as the browser
is
open, when the
browser is closed the data is removed from the session storage.
Local Storage:
Local storage maintains data across all instances of a site,
whether they're in different tabs or windows. It is also permanent, so the data won't disappear when
you close your browser.
Global Scope:
if we write a variable outside of the function All scripts and
functions on a web page can access it
Function Scope:
If we declare a variable inside a function It can only be
accessed from within the function.
When our javascript file is run, it is executed line by line. During the execution, if any asynchronous function is found, then it is put in the queue and the code of the next line is executed, and when all the code execution is finished, the code in the queue is run, thus basically the event loop works. by doing
An undefined variable or anything without a value will always return "undefined" in JavaScript. This is not the same as null, despite the fact that both imply an empty state.