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 Réponses
+ 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