JS Fundamentals - More Excercise - 03.Rotate Array
Здравейте,
на пръв поглед много лесна задача, но не мога да разбера защо ми работи само на единия от тестовете? Моля за помощ.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Rotate Array
Write a function that rotates an array. The array should be rotated to the right side, meaning that the last element should become the first, upon rotation.
The input comes as an array of strings. The last element of the array is the amount of rotation you need to perform.
The output is the resulted array after the rotations. The elements should be printed on one line, separated by a single space.
Examples
Input Output
['1', '2', '3', '4', '2'] 3 4 1 2
['Banana', 'Orange', 'Coconut', 'Apple', '15'] Orange Coconut Apple Banana
Hints
Check if there is a built-in function for inserting elements at the start of the array.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Това е моето решение: https://pastebin.com/EhAKYxQQ