Answers for "how to declare an array in javascript"

4

how to declare an array in javascript

var array = [item1, item2, .....];
/*

  item1 and item2 could be a string (which is 
  a letter written in double or single quotes like this "string" or 'string') or 
  a number (which is just a normal number on the keypad) or a boolean (which is 
  an experssion which either returns to true of false) and the ..... means that 
  the inputs can be infinite.
  
*/
Posted by: Guest on July-23-2021
138

javascript array

//create an array like so:
var colors = ["red","blue","green"];

//you can loop through an array like this:
for (var i = 0; i < colors.length; i++) {
    console.log(colors[i]);
}
Posted by: Guest on July-01-2019
4

how define array js

var Names = ["Arbab","Ali","Ahsan"]
Posted by: Guest on May-26-2021
12

how to make an array in javascript

var names = ["Sanjith", "Pranav", "Aadya", "Saharsh"]
Posted by: Guest on August-31-2020
1

what are the two ways to create an array in javascript examples?

let scores = Array(10);
Posted by: Guest on August-27-2020
14

how to create an array in javascript

let fruits = ['Apple', 'Banana']

console.log(fruits.length)
// 2
Posted by: Guest on June-25-2020

Code answers related to "how to declare an array in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language