Skip to content

Instantly share code, notes, and snippets.

@stepheneyer
Created May 1, 2015 16:03
Show Gist options
  • Save stepheneyer/dc26e8b07b3cdc278db6 to your computer and use it in GitHub Desktop.
Save stepheneyer/dc26e8b07b3cdc278db6 to your computer and use it in GitHub Desktop.
create a new stack from a user prompt
//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