Can you help me debug this | Sololearn: Learn to code for FREE!
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

12th Dec 2021, 9:28 AM
Steve Nova
Steve Nova - avatar
8 Respostas
+ 2
Steve Nawa šŸ‡³šŸ‡¦ local storage will not work in Sololearn.
12th Dec 2021, 9:31 AM
AĶ¢J
AĶ¢J - avatar
+ 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
12th Dec 2021, 9:42 AM
AĶ¢J
AĶ¢J - avatar
+ 1
Steve Nawa šŸ‡³šŸ‡¦ Also check this line: '${key): ${value}<br />'; There should be this symbol ` ` and } instead of )
12th Dec 2021, 9:50 AM
AĶ¢J
AĶ¢J - avatar
+ 1
Ok thanks šŸ‘
12th Dec 2021, 12:54 PM
Steve Nova
Steve Nova - avatar
+ 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
12th Dec 2021, 2:31 PM
Steve Nova
Steve Nova - avatar
0
On my laptop
12th Dec 2021, 9:32 AM
Steve Nova
Steve Nova - avatar
0
Steve Nawa šŸ‡³šŸ‡¦ Ok wait checking in PC.
12th Dec 2021, 9:36 AM
AĶ¢J
AĶ¢J - avatar
0
How
12th Dec 2021, 2:27 PM
Saliu Abdulai