Skip to content

Instantly share code, notes, and snippets.

@pushmatrix
Created October 1, 2013 12:01
Show Gist options
  • Save pushmatrix/6777403 to your computer and use it in GitHub Desktop.
Save pushmatrix/6777403 to your computer and use it in GitHub Desktop.
Le example # 1991
/*
Exercise Nouveau!
*/
console.log("exercise nouveau!");
person1 = {
name: "Pippi",
gender: "Female",
city: "Stockholm"
}
person2 = {
name: "Bamse",
gender: "Male",
city: "Finland"
}
function describePerson(p) {
// This function takes in an object as an argument. It takes the object, and prints out something in the format:
// "This is [name]. He/She is [gender] and from [city].
}
// Example calls
describePerson(person1); // Should print out "This is Pippi. She is female, and from Stockholm."
describePerson(person2); // Should print out "This is Bamse. He is male, and from Finland."
// Create a function that takes this object as an argument, and
/*
Exercise Nouveau #2!
*/
console.log("exercise nouveau 2!");
tweets = [{
message: "This is such a cool app",
username: "pushmatrix",
date: "today"
},
{
message: "How do I twitter?",
username: "justinbieber",
date: "yesterday"
},
{
message: "George pretends to belong to a gym just to use their bathroom. Kramer 'borrows' Jerry's computer and is offended by his Internet history.",
username: "modernseinfeld",
date: "last week"
},
{
message: "Something something something...",
username: "pushmatrix",
date: "2 weeks ago"
},
{
message: "First tweet.",
username: "pushmatrix",
date: "3 weeks ago"
},
{
message: "I like javascript.",
username: "dhh",
date: "2 months ago"
}
];
// Above is an array of objects. In this case, and "object" representds a "tweet".
// Loop through each tweet, and only print out the tweet if the username is "pushmatrix"/
// When printing a tweet, it's ok to just show the message...
// Hint: There should only be 3 tweets listed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment