Write a function named 'dynamicRotate (num)'. When invoked, the `dynamicRotate' function will accept a number to be used as the rotation amount and return a function. Positive numbers rotate the array to the right and negative numbers rotate to the left. The function returned by 'dynamicRotate' will accept an array to be rotated by the amount provided when 'dynamicRotate' was first invoked. It will return the original array mutated by the given rotation. Examples: ' ' ' js let arr - ['a', 'b', 'c', 'd', 'e']; rotateRightTwo = dynamicRotate (2); rotateRightTwo (arr); console.log(arr); // [ 'd', 'e', 'b', 'e' ]; let animals = ['wombat', 'koala', 'opossum', "kangaroo']; rotateLeftone = dynamicRotate(-1); rotateLeftOne (animals) console.log(animals); // [ 'koala', 'opossum, "kangaroo', 'wombat"] ' ' ' ***************?
Write a function named 'dynamicRotate (num)'. When invoked, the `dynamicRotate' function will accept a number to be used as the rotation amount and return a function. Positive numbers rotate the array to the right and negative numbers rotate to the left.
The function returned by 'dynamicRotate' will accept an array to be rotated by the amount provided when 'dynamicRotate' was first invoked. It will return the original array mutated by the given rotation.
Examples:
' ' ' js
let arr - ['a', 'b', 'c', 'd', 'e'];
rotateRightTwo = dynamicRotate (2);
rotateRightTwo (arr);
console.log(arr); // [ 'd', 'e', 'b', 'e' ];
let animals = ['wombat', 'koala', 'opossum', "kangaroo'];
rotateLeftone = dynamicRotate(-1);
rotateLeftOne (animals)
console.log(animals); // [ 'koala', 'opossum, "kangaroo', 'wombat"]
' ' '
***************?
function dynamicRotate(num) {
// Your code here
}
/*****DO NOT MODIFY ANYTHING UNDER THIS LINE*****/
try {
module.exports = dynamicRotate;
} catch {
module.exports =null;

Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images

can you show me the result of this? console.log this and show me?








