JavaScript Array Programming Examples
JavaScript array is used to store multiple elements in a single variable. It is often used when we want to store a list of elements and access them by a single variable. Unlike most languages where the array is a reference to the multiple variables, in JavaScript, an array is a single variable that stores multiple elements.
Syntax:
let array = [value1, value2, ...];
let array = new Array();
Example 1: Here is the basic example of an array in javascript.
Javascript
// Declaring an array using Literal Notation let language = ["HTML","CSS","Javascript"] console.log(language) |
Output:
['HTML', 'CSS', 'Javascript']
Example 2: In this example, we are using a new keyword.
Javascript
// Declaring an array using Array Constructor let language = new Array(3) language[0] = "HTML"language[1] = "CSS"language[2] = "Javascript"console.log(language) |
Output:
['HTML', 'CSS', 'Javascript']
The following section contains a wide collection of javascript Array examples. Many of these program examples offer different ways to handle the issue.
Javascript Array Question:
We have a complete list of Javascript Array functions, to check those please go through this JavaScript Array Complete Reference article.
We have created an article of JavaScript Examples, and added list of questions based on Array, Object, Function, …, etc. Please visit this JavaScript Examples to get complete questions based articles list of JavaScript.
We have created a complete JavaScript Tutorial to help both beginners and experienced professionals. Please check this JavaScript Tutorial to get the complete content from basic syntax and data types to advanced topics such as object-oriented programming and DOM manipulation.


