JSFiddle - React, Tailwind, and code Playground

by Mahendra Maurya

JavaScript

var num=[0,67,67,8,54];

var shiftArray = function(num,times){
	if(num.length !== 0){
  	var p = 0,i;
  	while(p<times){
			i = num.pop();
      num.unshift(i);
      p++;
    }
  }
}
console.log(shiftArray(num));