Similar to the push and pop functions which add and remove elements from the end of an array, the shift and unshift functions allow you to add and remove elements from the front of an array. The unshift function can be used to push elements to the front of array while the shift function can be used to remove elements from the front of an array. The shift() function returns the element that was just deleted.
Syntax : original_array.unshift("value1"); original_array.shift();
original_array.unshift("value1");
original_array.shift();
Unshift my name! Shift a name! let arr = ["Roger", "Patrick", "Teresa"]; arr.unshift("< value from input box >"); arr = ??
let arr = ["Roger", "Patrick", "Teresa"]; arr.unshift("< value from input box >");
let arr = [1.3, 4.5, 6.5]; deteled = arr.shift(); Shift the next element! arr = ?? deleted = ??
let arr = [1.3, 4.5, 6.5]; deteled = arr.shift();