Home » Interview » Technology

What is session storage and how can you create one?

Correct Answer: Session storage is same like local storage but the data is valid for a session In simple words the data is deleted as soon as you close the browser To create a session storage you need to use “sessionStoragevariablename” In the below code we have a created a variable called as “clickcount” If you refresh the browser the count increases But if you close the browser and start again the “clickcount” variable starts from zero if(sessionStorageclickcount) { sessionStorageclickcount=Number(sessionStorageclickcount)+1; } else { sessionStorageclickcount = 0; }

← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion