JavaScript One Dimensional Array
JavaScript One Dimensional Array
JavaScript one Dimensional Array is used to hold multiple values of different data types (if necessary) in a single variable.
Note: In JavaScript, it is not necessary to declare the size of an array.
Create using Array Literal
Using an array literal is the easiest way to create a JavaScript Array.
Note: This is the most common way of creating an array in JavaScript.
Example
Syntax
The following are the syntax to create an array.
Create Using new Keyword
Like string and number, An array can also be created using the new keyword.
Example
Initialize the Array Using Index Value
Example
Access Full Array
Example
Array with Different Types of data
In the following example, we will have different types of data in an array.
Example
Reminder
Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JavaScript.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.