The question is, frankly, rather stupid, but when I enter this value localStorage.setItem('item', 1) , for example, I get a string at the output. var a = localStorage.getItem('item') console.log(a) returns the value "1". I could be wrong, but should he not store a number, not a string in this case. Or maybe I'm doing something wrong?

    1 answer 1

    Yes, you are mistaken, he should not, you do so.

    https://www.w3schools.com/html/html5_webstorage.asp

    Note: Name / value pairs are always stored as strings. When needed!

    Key / value pairs are stored as strings. Do not forget to convert them to another type in cases where it is necessary.