- 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 variablei
from zero tousersByDay.length - 1
inclusively. Value ofi
must increase by one after each iteration. - Inside the loop, log in the console a value of
usersByDay[i]
.
Comments