Answers for "how to use arrays in javascript"

VBA
145

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 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
2

how to create an array in javascript

let myVar = ["1","2","3"];
Posted by: Guest on December-04-2020
3

return array javascript

function func() {
  return [5, "string", {a: 7}];
}
Posted by: Guest on May-20-2020

Code answers related to "how to use arrays in javascript"

Code answers related to "VBA"

Browse Popular Code Answers by Language