Answers for "add array elemets to an array js"

32

js array add element

array.push(element)
Posted by: Guest on September-23-2019
1

how to add a new item in an array in javascript

let array = ["Chicago", "Los Angeles", "Calgary", "Seattle", ]
  // print the array 
console.log(array)
  //Adding a new item in an array without touching the actual array     
array.push('New Item') < variable_name > .push( < What you want to add > )
  //How many items does the array have?
console.log("This array has", array.length, "things in it")
Posted by: Guest on March-21-2021

Code answers related to "add array elemets to an array js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language