scrimba
Frontend Career Path
Getting hired
JavaScript Interview Challenges
Challenge - Popularity Contest
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Challenge - Popularity Contest
AboutCommentsNotes
Challenge - Popularity Contest
Expand for more info
index.js
run
preview
console
import postData from "./data.js";

/* Popularity Contest

Iggy the Influencer and Toby the Tiktoker are dying to know
who's more popular on social media.

Toby's TikToks get an average of 400 likes. On average, how many
likes do Iggy's Instagram posts get?

In data.js you'll find a list of Iggy's recent posts.
Use reduce() to write a function that returns the average number of likes.
To find the average, add up the total number of likes, then divide
by the total number of posts.
*/

function calcAverageLikes(data){

}


console.log(calcAverageLikes(postData))
Console
undefined
,
/index.html
-0:52