Javascript Array rotate(times)

Description

Javascript Array rotate(times)


Array.prototype.rotate = function(times) {
 if (times < 0) {
  var last = arr.pop
  return arr.unshift(last)
 }
 // if (times > 0)
}

function solution (numbers, times) {
 for (var i = 0; i < times; i++) {
  numbers.rotate//from  w  ww. ja va  2 s. c  o m
 };
}



PreviousNext

Related