- script.js
JavaScript
var expectedUsers = 1000;
var firstDayUsers = 812;
var secondDayUsers = 1360;
var thirdDayUsers = 657;
// Drawing the traffic graph
muffin.plot(firstDayUsers, secondDayUsers, thirdDayUsers, expectedUsers);
// Calculating the average traffic value
var averageUsers = (firstDayUsers + secondDayUsers + thirdDayUsers) / 3;
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
- In the next line after the
thirdDayUsers
variable, addfourthDayUsers
variable with1247
value. - Add the
fourthDayUsers
parameter afterthirdDayUsers
in themuffin.plot()
command. - Change average value calculation. Add
fourthDayUsers
as the last summand and change the divisor to4
.
Comments