Loading Please Wait...
An array is a special variable, which can hold more than one value
const services = ["Website", "Applications", "Software"];
Array can be used to group similar type of data in a single variable. For example, storing a large data of mobile phone names in a single variable and access it via index.
Array can be created using new keyword or using array literals. Array literal is the easiest way to create a JavaScript Array
// using new keyword
const services1 = new Array();
const services2 = new Array("Website", "Applications", "Software");
// using array literals
const services3 = [];
const services4 = ["Website", "Applications", "Software"];
You access an array element by referring to the index number.
Array index start from 0. It means, first element is [0], second element is [1], and so on.
const services = ["Website", "Applications", "Software"];
services[0]; // Website
services[1]; // Applications
services[2]; // Software
const services = ["Website", "Applications", "Software"];
services[0] = "Designing";
services[1] = "Marketing";
services[2] = "Consulting";
The JavaScript method toString() converts an array to a string of (comma separated) array values
const services = ["Website", "Applications", "Software"];
services.toString(); // Website,Applications,Software
// Below line automatically convert array to string
services; // Website,Applications,Software
How you feel about this blog:
Share this blog on:
If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com
Contact UsWe are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..
Copyright ©
, Lynxsia IT Solutions, All rights reserved