- script.js
JavaScript
var expectedUsers = 1000;
var firstDayUsers = 812;
var secondDayUsers = 1360;
var thirdDayUsers = 657;
var fourthDayUsers = 1247;
// Drawing the traffic graph
muffin.plot(
firstDayUsers,
secondDayUsers,
thirdDayUsers,
fourthDayUsers,
expectedUsers
);
// Calculating the average traffic value
var averageUsers = (firstDayUsers + secondDayUsers + thirdDayUsers + fourthDayUsers) / 4;
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
- Instead of calculating the average value, assign the variable
averageUsers
value0
. - Before the
muffin.plot()
command, add variableusersByDay
with value[812, 1360, 657, 1247]
. - Inside
muffin.plot()
, setusersByDay
as first parameter,expectedUsers
as second parameter and delete the remaining parameters. - Feel free to delete variables
firstDayUsers
,secondDayUsers
,thirdDayUsers
andfourthDayUsers
.
Comments