When I assign integer value to localStorage item
localStorage.setItem('a',1)
and check its type
typeof(localStorage.a)
"string"
it returns string, I can typecast it to int for my use
parseInt(localStorage.a)
My question is it possible to store integer value inside localStorage as I can do for Javascript objects without typecasting?
a={};
a.number=1;
typeof(a.number)
"number"
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…