JS is a high-level interpreting language we know that. chrome browser use v8 engine to read js file. And v8 engine use a compiler to read js file. browser make a render tree to show output . js is very smart language so browser can easyly read her.
in asynchronous expression, every js code can't wait for others to run. fetch ,setTimeOut etc are good example for this case. in that case js use event loop to handle this. js divide all synchronous and asynchronous code in heap an ques . loop is rounding and code run by peaking one by one item from 2 sectors.
local storage works for storing permanent data. on the other hand session storage store temporary data.when close tab or browser every session storage will clear . but in local storage data won't clear until anyone remove it manually.
the process of add data in local storage and session storage is almost same.