Question: / / declare variables var name = getColumn ( TheRoot: 1 0 0 Influential African Americans, Name ) ; var rank = getColumn (

//declare variables
var name = getColumn("TheRoot: 100 Influential African Americans", "Name");
var rank = getColumn("TheRoot: 100 Influential African Americans", "Rank");
var profession = getColumn("TheRoot: 100 Influential African Americans", "Profession");
var followers = getColumn("TheRoot: 100 Influential African Americans", "Twitter Followers");
var sector = getColumn("TheRoot: 100 Influential African Americans", "Sector");
//Gets the rank of a specified influencer
//If the celebName matches a name in the name list,
//return the celeb rank
function getRank(celebName){
for (var i=0; i < name.length; i++){
if (celebName == name[i]){
return rank[i];
}
}
}
console.log("Get Stacey Abrams rank (1):"+getRank("Stacey Abrams"));
console.log("Get Beyonc rank (18):"+getRank("Beyonc"));
console.log("Get Allyson Felix rank (26):"+getRank("Allyson Felix"));
//Gets the profession of a specified influencer
//If the celebName matches a name in the name list,
//return the celeb profession
function getProfession(celebName){
for (var i=0; i < name.length; i++){
if (celebName == name[i]){
return profession[i];
}
}
}
console.log("
Get Stacey Abrams profession (Politician):"+getProfession("Stacey Abrams"));
console.log("Get Beyonc profession (Entertainer, Entrepreneur):"+getProfession("Beyonc"));
console.log("Get Allyson Felix profession (Track Champion):"+getProfession("Allyson Felix"));
//Gets the followers of a specified influencer
//If the celebName matches a name in the name list,
//return the celeb followers
function getFollowers(celebName){
for (var i=0; i < name.length; i++){
if (celebName == name[i]){
return followers[i];
}
}
}
console.log("
Get Stacey Abrams followers (548861):"+getFollowers("Stacey Abrams"));
console.log("Get Beyonc followers (15360340):"+getFollowers("Beyonc"));
console.log("Get Allyson Felix followers (745781):"+getFollowers("Allyson Felix"));
//Gets the sector of a specified influencer
//If the celebName matches a name in the name list,
//return the celeb followers
function getSector(celebName){
for (var i=0; i < name.length; i++){
if (celebName == name[i]){
return sector[i];
}
}
}
console.log("
Get Stacey Abrams sector (Politics):"+getSector("Stacey Abrams"));
console.log("Get Beyonc sector (Entertainment):"+getSector("Beyonc"));
console.log("Get Allyson Felix sector (Sports):"+getSector("Allyson Felix"));
//Compare the rank of two celebs
//Return the influencer with more rank
function compareRank(celeb1, celeb2){
if(getRank(celeb1)< getRank(celeb2)){
return celeb1;
} else {
return celeb2;
}
}
console.log("
Compare rank of Stacey and Beyonce (Stacey):"+compareRank("Stacey Abrams", "Beyonc"));
console.log("Compare rank of Beyonce and Allyson (Beyonce):"+compareRank("Allyson Felix", "Beyonc"));
console.log("Compare rank of Stacey and Allyson (Stacey):"+compareRank("Stacey Abrams", "Allyson Felix"));
//Compare the followers of two celebs
//Return the influencer with more followers
function compareFollowers(celeb1, celeb2){
if(getFollowers(celeb1)> getFollowers(celeb2)){
return celeb1;
} else {
return celeb2;
}
}
console.log("
Compare followers of Stacey and Beyonce (Beyonce):"+compareFollowers("Stacey Abrams", "Beyonc"));
console.log("Compare followers of Beyonce and Allyson (Beyonce):"+compareFollowers("Allyson Felix", "Beyonc"));
console.log("Compare followers of Stacey and Allyson (Allyson):"+compareFollowers("Stacey Abrams", "Allyson Felix"));
//Returns list of influencers in a named sector
function getListOfCelebsInSector(celebSector){
var celebList =[];
for(var i=0; i
Can you make a minigame with this code in code.org where you have to guess something with an image and if you get it right it gives you a happy screen and if you get it wrong you can try again but it tells you its wrong using the functions from this library with an if statemnt and parameters?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!