Two JS Solutions
\nvar rotate = function(nums, k) {\n    for (let i = 0; i < k; i++) {\n        nums.unshift(nums.pop());\n    }\n};\n\n\n\nvar rotate = function(nums, k) {\n   
```\nvar rotate = function(nums, k) {\n    for (let i = 0; i < k; i++) {\n        nums.unshift(nums.pop());\n    }\n};\n```\n\n```\nvar rotate = function(nums, k) {\n    if (nums === null || nums.length === 0) {\n        return;\n    }\n    k = k % nums.length;\n    if (k === 0) {\n        return;\n    }\n    nums.reverse();\n    reverse(nums, 0, k-1);\n    reverse(nums, k, nums.length - 1);\n    // T.C: O(N)\n    // S.C: O(1)\n};\n\nconst reverse = (arr, start, end) => {\n    while (start < end) {\n        let temp = arr[start];\n        arr[start] = arr[end];\n        arr[end] = temp;\n        start++, end--;\n    }\n}\n\n/*\nSolution:\n1. Reverse the entire array.\n2. Reverse the first k elements.\n3. Reverse the rest.\n*/\n```
['JavaScript']