I'm trying to figure out what the setItem
method from sessionStorage
returns. As far as I could get, the following code returns undefined
:
var set = sessionStorage.setItem('foo', 'bar');
console.log(set);
I need to know if the item was successfully set or if it failed. How can I accomplish this without knowing the return?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…