OneZero
OneZero

Reputation: 11914

Where does javascript store variables and how long are they kept?

This might be a bit general but, I'm wondering where are js variables stored? And are they kept when you click into new pages or every time the data is reset?

Upvotes: 3

Views: 1200

Answers (2)

basarat
basarat

Reputation: 276095

They are reset every time you refresh.

There are multiple ways to persist them between reloads. e.g.

For all of these methods you would need to persist these (generally due to some user interaction) and load these on page reload etc. It does not happen automatically, you have to explicitly do so.

Upvotes: 6

Kiarash
Kiarash

Reputation: 1919

They stored in client memory and as Basarat mentioned they gone on each postbask or refresh

Upvotes: 0

Related Questions