how to use unshift() and shift()
//to remove the first item from array
let top_salespeople = ['Mark', 'Lucy', 'Graham', 'Carol', 'Ann'];
top_salespeople.shift();
console.log(top_salespeople);
how to use unshift() and shift()
//to remove the first item from array
let top_salespeople = ['Mark', 'Lucy', 'Graham', 'Carol', 'Ann'];
top_salespeople.shift();
console.log(top_salespeople);
unshift method in javascript
var name = [ "john" ];
name.unshift( "charlie" );
name.unshift( "joseph", "Jane" );
console.log(name);
//Output will be
[" joseph "," Jane ", " charlie ", " john "]
js unshift vs push
//My Opinion is really nothing. They are the same exept one adds a element
//to the end and the other one adds a element to the front
// Push Method
var array = [2];//your random array
array.push(3)
// Unshift Method
array.unshift(1)
how to use unshift() and shift()
//to add the first item to a array
let top_salespeople = ['Lucy', 'Graham', 'Carol', 'Ann'];
top_salespeople.unshift('Hannah');
console.log(top_salespeople);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us