javascript is an interpreted language and it executes line by line code. javascript is a client-side scripted language and it runs in the browser. Every browser has a js engine and it helps js code to run in the browser, for example, google chrome has V8 engine to execute js code. Every js engine has a parser and the parser parses the js code. parse means it executes the code line by line, that's why it's an interpreted language. Parser checks if the code syntax is written correctly or not, if there is a syntactic error then it will give you an error and stop executing the code. Otherwise, the parser will create a data structure called AST(Abstract Syntax Tree). After that AST converts the code to machine code. Then our system understands the code and we get the output of the code.
Local storage stores the data in the browser. It will not automatically delete the data. If you close the tab and the browser even after shutting down the system, it will keep the data with no expiration date. You have to delete the data manually in local storage.
Session Storage:Session Storage store the data in the browser but if you close the tab or the browser it will automatically delete the data. Every time you open a particular website it will store the data again. Session storage doesn't keep the data after closing the tab or the browser.