Arrays in Java Script
Arrays are used to store a collection of values in a single variable. In JavaScript, you can create an array using square brackets.
Here's an example of an array that contains a list of names:
css
var names = ["John", "Mary", "Bob"];
You can access individual elements in an array using their index:
javascript
console.log(names[0]); // prints "John"
No comments:
Post a Comment