After completing the warmup exercises, your task is to do four more slightly more challenges analyses.
var comments = data.comments
var list=_.filter(_.pluck(comments, 'body'), function(text){
var food=_.last(text.split("Favorite Food:"))
return _.includes(food, "Sushi")
})
return _.size(list)
The answer is 5.
var pythonList=_.filter(_.pluck(data.comments, 'body'), function(text){
return _.includes(text, "Python") || _.includes(text, "python")
})
var names=_.map(pythonList, function(name){
var a=name.split("\r\n")[0]
return _.last(a.split("Name:"))
})
return names
Their names are William Farmer, Heather Witte, Zach Lamb, Zhili Yang, John Cronk, Denis Kazakov, Caleb Hsu, Karen Blakemore, Sanketh S Shetty, Andrey Shprengel.
var jsList=_.filter(_.pluck(data.comments, 'body'), function(text){
return _.includes(text, "Javascript") || _.includes(text, "javascript")
})
var javaList=_.filter(_.pluck(data.comments, 'body'), function(text){
return _.includes(text, "Java") || _.includes(text, "java")
})
if(_.size(jsList) > _.size(javaList))
return "Javascript"
else
return "Java"
The answer is Java.
kjblakemore
?var foodList=_.filter(_.pluck(data.comments, 'body'), function(text){
return _.includes(text, "Vegan")
})
var names=_.map(foodList, function(name){
var a=name.split("\r\n")[0]
return _.last(a.split("Name:"))
})
return names
Their names are Karen Blakemore.