I am building a website using HTML. In the js file I have an array of various city names.
I want to store in sessionStorage the city name as a key and a number as a value (depending on an if statement). I know I can use for example:
sessionStorage.London= 1;
but what if I don't know the names before hand or I want to write one line in a loop in order to do that ?
To be clearer, What I want is to be able to do something like:
sessionStorage.cityName[i]= 1;
Any solution is welcome