Q:

Write a JavaScript program to rotate the elements left of a given array of integers of length 3

0

Write a JavaScript program to rotate the elements left of a given array of integers of length 3

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

function rotate_elements_left(array)
{
    return [array[1], array[2], array[0]];
}
console.log(rotate_elements_left([3, 4, 5]));  
console.log(rotate_elements_left([0, -1, 2]));  
console.log(rotate_elements_left([7, 6, 5])); 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now