1.

What is the main difference between localStorage and sessionStorage?(a) Lifetime(b) Scope(c) Both Lifetime and Scope(d) Storage LocationI have been asked this question in class test.I want to ask this question from Client-Side Storage in chapter Server-Side and Client-Side Scripting of JavaScript

Answer»

The correct option is (c) Both LIFETIME and Scope

Easy explanation: The DIFFERENCE between localStorage and sessionStorage has to do with lifetime and scope: how long the data is SAVED for and who the data is accessible to. SESSION storage is destroyed once the user closes the browser whereas, Local storage stores data with no expiration date.



Discussion

No Comment Found

Related InterviewSolutions