I have an array with elements. for ex - let data = [ 1, 2, 3, 4, 5 ];
Now if I pass 2 in function as a parameter, then the last two value will move to first in the array.
let data = [1, 2, 3, 4, 5];
functionname(data, 2);
//Expected output - 4,5,1,2,3
Now if I pass 3 in function as a parameter, then the last three value will move to first in the array.
let data = [ 1, 2, 3, 4, 5 ];
functionname(data, 3);
//Expected output - 3,4,5,1,2
4and5) to the front ?4,5,1,2,3to the front will result in1,2,3,4,5.