JavaScript · Junior · Question 45 of 75
What does localStorage.getItem('n') return after localStorage.setItem('n', 5)?
- ✓Correct answer:
'5' - 2
5 - 3
null
Explanation
Web Storage stores only strings - the value is converted with String(). An object becomes '[object Object]', so complex data is saved with JSON.stringify and read with JSON.parse.