Can you help me debug this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answers
+ 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