Answers for "js prepend to array"

2

javascript prepend string to array

const names = ["Bob", "Cassandra"]

names.unshift("Alex")

names === ["Alex", "Bob", "Cassandra"]
Posted by: Guest on May-24-2020
0

prepend to js array

var a = [1, 2, 3, 4];
a.unshift(0);
a; // => [0, 1, 2, 3, 4]
Posted by: Guest on August-23-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language