As warmup, let's being with some simple questions.
The comments data is imported as data.comments
.
// TODO: write code to answer this question
return _.size(data.comments)
There are 26 submissions.
We can get the data of the first comment by
// TODO: use lodash's method instead of direct array access via [0]
return _.first(data.comments)
The result is
{ "url": "https://api.github.com/repos/bigdatahci2015/forum/issues/comments/133203904", "html_url": "https://github.com/bigdatahci2015/forum/issues/1#issuecomment-133203904", "issue_url": "https://api.github.com/repos/bigdatahci2015/forum/issues/1", "id": 133203904, "user": { "login": "willzfarmer", "id": 546524, "avatar_url": "https://avatars.githubusercontent.com/u/546524?v=3", "gravatar_id": "", "url": "https://api.github.com/users/willzfarmer", "html_url": "https://github.com/willzfarmer", "followers_url": "https://api.github.com/users/willzfarmer/followers", "following_url": "https://api.github.com/users/willzfarmer/following{/other_user}", "gists_url": "https://api.github.com/users/willzfarmer/gists{/gist_id}", "starred_url": "https://api.github.com/users/willzfarmer/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/willzfarmer/subscriptions", "organizations_url": "https://api.github.com/users/willzfarmer/orgs", "repos_url": "https://api.github.com/users/willzfarmer/repos", "events_url": "https://api.github.com/users/willzfarmer/events{/privacy}", "received_events_url": "https://api.github.com/users/willzfarmer/received_events", "type": "User", "site_admin": false }, "created_at": "2015-08-20T22:39:50Z", "updated_at": "2015-08-20T22:39:50Z", "body": "Name: William Farmer\r\nMajor: Applied Math w/ Minor in Computer Science\r\nFavorite Programming Language: Python\r\nFavorite Food: Sushi" }
The person's name is willzfarmer.
We will need to parse the comment to retrieve this data.
The comment text is
"Name: William Farmer\r\nMajor: Applied Math w/ Minor in Computer Science\r\nFavorite Programming Language: Python\r\nFavorite Food: Sushi"
The code to retrieve the data about the favorite food is (hint: use split()).
var text = _.first(data.comments).body
console.log(text)
console.log(text.split('\n'))
// TODO: add code to process text to get the person's favorite food
return _.last(text.split("Favorite Food:"))
So, willzfarmer's favorite food is Sushi.