+ 1
Can you help me debug this
btnInsert.onclick = function(){ const key = inpKey.value; const value = inpValue.value; if (key && value) { localStorage.setltem(key, value); location.reload(); } }; for (let i = 0; i < localStorage.length; i++) { const key = localStorage.key(i); const value = localStorage.getItem(key); IsOutput.innerHTML += '${key}: ${value}<br />'; } https://code.sololearn.com/WWXzQJkDcQ1x/?ref=app
8 ответов
+ 2
Steve Nawa 🇳🇦
local storage will not work in Sololearn.
+ 2
Steve Nawa 🇳🇦
Check this line:
localStorage.setltem(key, value);
You have used small letter of 'L' instead of capital letter of 'i'
Also IsOutput is null so write js code inside window.onload function
+ 1
Steve Nawa 🇳🇦
Also check this line:
'${key): ${value}<br />';
There should be this symbol ` ` and } instead of )
+ 1
Ok thanks 👍
+ 1
No the code is working now thank you A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ for your help.
If you want to try it out. save it as html and try it on chrome
0
On my laptop
0
Steve Nawa 🇳🇦
Ok wait checking in PC.
0
How