Created
June 14, 2016 00:16
-
-
Save DougCal/3c50a7f2ec2a7b05b13496a263a4ef33 to your computer and use it in GitHub Desktop.
Stand in Line Challenge freecodecamp.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function nextInLine(arr, item) { | |
// Your code here | |
var first = arr[0]; | |
arr.push(item); | |
arr.shift(); | |
return first; // Change this line | |
} | |
// Test Setup | |
var testArr = [1,2,3,4,5]; | |
// Display Code | |
console.log("Before: " + JSON.stringify(testArr)); | |
console.log(nextInLine(testArr, 6)); // Modify this line to test | |
console.log("After: " + JSON.stringify(testArr)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment