The browser storage localStorage is not available. Either your browser does not support it or you have disabled it or the maximum memory size is exceeded. Without localStorage your solutions will not be stored.
Array: shift() and push()
push. To remind you: Methods are functions that are applied to an object, here an array. Methods are appended with a point to the object.
The array method
shiftremoves the first element from an array and returns that element. The length of the array is reduced by 1.
languagesis created with 3 programming languages. After
languagescontains only 2 items, viz.
'C'is stored in
pushadds a new element to an array. The new element is passed as a parameter and is added to the end of the array.
Here an empty array is filled successively with the passed values. Finally we get the array
rotatethat rotates the elements of an array. All elements should be moved one position to the left. The 0th element should be placed at the end of the array. The rotated array should be returned.
rotate(['a', 'b', 'c'])should return
['b', 'c', 'a'].