- 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
thirdDayUsersvariable, addfourthDayUsersvariable with1247value. - Add the
fourthDayUsersparameter afterthirdDayUsersin themuffin.plot()command. - Change average value calculation. Add
fourthDayUsersas the last summand and change the divisor to4.
Comments