Skip to content

Instantly share code, notes, and snippets.

@goodbedford
Last active August 6, 2016 05:59
Show Gist options
  • Save goodbedford/9656983eac725500bcfe7a30527d52f5 to your computer and use it in GitHub Desktop.
Save goodbedford/9656983eac725500bcfe7a30527d52f5 to your computer and use it in GitHub Desktop.
js-array-pop-shift-quiz.js
// remember array index starts at zero
var rsvps = ["tracy", "bedford", "christina", "nicole", "lisa", "mark", "aaron", "marina"];
var girls = [];
console.log("new party rsvps", rsvps);
// Pop Quiz: Make a list of girls for the after party using someArray[index] and push
// ------ add code below this line--------------------
//------ add code above this line --------------
console.log("girls after party:", girls);
// Pop Quiz: manipulate the following list
var hats = ["ten-gallon", "fedora", "giants baseball", "warrios knitted", "kango", "sherlock holmes" ];
var beginNumOfHats = 0;
var giantsHatIndex = 0;
var clownHat = "clown-hat";
var myHat = ""; //you will need to fill in your own hat later
// 2a. change beginNumOfHats to number of hats to start: hint#length of hats
// ------ add code below this line--------------------
//------ add code above this line --------------
console.log("# of hats to start:", beginNumOfHats);
// 2b. what index is giants baseball hat
// ------ add code below this line--------------------
//------ add code above this line -------------------
console.log("giants baseball hat index:", giantsHatIndex);
// 2c.
// 1. take off the ten-gallon hat
// 2. take off the fedora
// 3. add clown-hat to front
// 4. add a type of hat for myhat to the end
// 5. add clown-hat to end
// ------ add code below this line--------------------
//------ add code above this line -------------------
console.log("hats after changes", hats);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment