0
How to declare arrays and store data permanently in them?
I'm new to js. I'm creating a to do list where the entries are stored in an array. data in it should be able to be modified and deleted and stored permanently. is there a better way to do this or can I get some examples of declaring an array and modifying it
2 Answers
+ 10
There are three different ways in JavaScript to declare arrays. All can be used to store data (permanently or temporarily).
Examples...
⢠First method :
var courses = new Array("HTML", "CSS", "JS");
⢠Second Method :
var courses = new Array(3);Â
courses[0]Â =Â "HTML";Â
courses[1]Â =Â "CSS";Â
courses[2]Â =Â "JS";
⢠Third method :
var courses = ["HTML", "CSS", "JS"];
While many programming languages support arrays with named indexes (text instead of numbers), called associative arrays, JavaScript does not.Â
However, you still can use the named array syntax, which will produce an object.Â
0
thank you @dayve