- script.js
JavaScript
var expectedUsers = 1000;
var usersByDay = [812, 1360, 657, 1247];
// Drawing the traffic graph
muffin.plot(usersByDay, expectedUsers);
// Calculating the average traffic value
var averageUsers = 0;
console.log('Average traffic: ' + averageUsers);
if (averageUsers > expectedUsers) {
console.log('Traffic is amazing. Keep up the good work!');
} else {
console.log('Traffic is so-so. You need to try harder!');
}
Result
Goalscompleted
- After the command
muffin.plot(), add a loop that increases variableifrom zero tousersByDay.length - 1inclusively. Value ofimust increase by one after each iteration. - Inside the loop, log in the console a value of
usersByDay[i].
Comments