We would like to know how to rotate elements in array.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
<!-- w w w. ja v a2 s.c om-->
var array = [1, 2, 3, 4, 5];
array.push(array.shift());
document.writeln(array);
</script>
</head>
<body>
</body>
</html>
The code above is rendered as follows: