How do I store an array in localStorage?

If I didn’t need localStorage, my code would look like this: var names=new Array(); names[0]=prompt("New member name?"); This works. However, I need to store this variable in localStorage and it’s proving quite stubborn. I’ve tried: var localStorage[names] = new Array(); localStorage.names[0] = prompt("New member name?"); Where am I going wrong? Answers: Thank you for visiting … Read more