LocalStorage variables


#1

The documentation states that LocalStorage stores strings and that the key is also a string.

However I have been implementing LocalStorage using integers without an error, such as:

localStorage.setItem(534,1101100)

Is the key and data in the above statement being interpreted as a string even though they are not contained in quotes?


#2

Hi, the answer is “yes” - they are always strings. Integers are converted automatically. See this link for details:


Thomas


#3

Thomas, much appreciated. Tnx.