Created
May 1, 2015 16:03
-
-
Save stepheneyer/dc26e8b07b3cdc278db6 to your computer and use it in GitHub Desktop.
create a new stack from a user prompt
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
//Create a new array or queue of people using the user prompt | |
//Set the max number of people in the line (or loops) | |
var max = 5; | |
var stack = []; | |
for (i = 0; i <= max; i++) { | |
var newName = prompt("Enter your name."); | |
stack.push(newName); | |
} | |
console.log(stack); | |
//==> ['John', 'Mary'], etc. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment