Javascript simple solution 3 lines
\nvar rotate = function (nums, k) {\n  k %= nums.length;\n  nums.unshift(...nums.splice(nums.length - k));\n  return nums;\n};\n
```\nvar rotate = function (nums, k) {\n  k %= nums.length;\n  nums.unshift(...nums.splice(nums.length - k));\n  return nums;\n};\n```
['JavaScript']