Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 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 Respostas
+ 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