Answers for "How to store certian part of array in new array javascript"

9

js array

var colors = [ "red", "orange", "yellow", "green", "blue" ]; //Array

console.log(colors); //Should give the whole array
console.log(colors[0]); //should say "red"
console.log(colors[1]); //should say "orange"
console.log(colors[4]); //should say "blue"

colors[4] = "dark blue" //changes "blue" value to "dark blue"
console.log(colors[4]); //should say "dark blue"
//I hope this helped :)
Posted by: Guest on June-21-2020
3

array index javascript show only first 2 elements

array.slice(0, n);
Posted by: Guest on January-21-2020

Code answers related to "How to store certian part of array in new array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language