Skip to content

Instantly share code, notes, and snippets.

@dlucidone
Last active February 12, 2019 03:28
Show Gist options
  • Save dlucidone/6763260a409820c9a947cb601fff31fc to your computer and use it in GitHub Desktop.
Save dlucidone/6763260a409820c9a947cb601fff31fc to your computer and use it in GitHub Desktop.
Array Rotate
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[add your bin description]">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var a = [1,2,3,4,5];
var i =0, b = 1;
while(i<b){
a.push(a.shift())
i++;
}
console.log(a)
</script>
<script id="jsbin-source-javascript" type="text/javascript">var a = [1,2,3,4,5];
var i =0, b = 1;
while(i<b){
a.push(a.shift())
i++;
}
console.log(a)</script></body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment