Skip to content

Instantly share code, notes, and snippets.

@basquith16
Last active August 29, 2015 14:28
Show Gist options
  • Save basquith16/8c72533f0bf0d2f90173 to your computer and use it in GitHub Desktop.
Save basquith16/8c72533f0bf0d2f90173 to your computer and use it in GitHub Desktop.
// 1. Assign the message "Hello, World!" to a variable.
var n = "Hello World";
// 2. Assign a different string to a different variable.
ar b = "Goodbye, cruel world!";
// 3. Assign a number to a variable.
var z = 14762;
// 4. Use string concatenation to display the number from #3 in a string.
var x = "14762";
// 5. Make an array of at least four of your favorite movies or books or bands.
var me = ["Muse", "Step Brothers", "Old Man and the Sea", "Commando"];
// 6. Make a object of information about yourself with at least four properties.
const Brian = {
name: "Brian",
favorite_KoolAid: "Any KoolAid",
hobbies: "Smoking cigars and eating snakes alive",
favorite_cartoon: "Captain N The Game Master"
};
// 7. Make an array of objects containing more information about your favorite movies. The objects should have at least three properties.
var movie_details = [
{title: "Commando", decade: "80s", detail: "Matrix broke his promise to kill Sully last"},
{title: "Karate Kid", decade: "80s", detail: "John Kreese does not train to be merciful. Mercy is for the weak"},
{title: "Step Brothers", decade: "2000s", detail: "Brennan didn't want salmon. He said it four times"}
];
for(var i = 0; i < movie_details.length; i++) {
console.log(movie_details[i].detail);
}
// 8. Use `for` to loop through the answer from exercise #7 and print only one property from the object. i.e., given `{ title: "Gone with the Wind" }` you print "Gone with the Wind".
for(var i = 0; i < movie_details.length; i++) {
console.log(movie_details[i].detail);
}
@ambethia
Copy link

Also, lol, Commando was one of my favorites from when I was a kid.

@basquith16
Copy link
Author

Commando is GOAT!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment