HTML Academy
Previous task
Arrays1/30
Back to the list of tasks
  • 1. Little Muffin and Big Data
  • 2. Average value
  • 3. Finishing the traffic analyzer
  • 4. New data
  • 5. A lot of data? An array!
  • 6. Reading an array element by index
  • 7. Using a variable as an index
  • 8. Array length
  • 9. Let’s hit arrays with loops!
  • 10. Summation in the loop
  • 11. Finishing refactoring
  • 12. One small analytical investigation
  • 13. Writing to an array by index
  • 14. The murderer is a butler!
  • 15. Summary of “Arrays”. Part 1
  • 16. Fifth program: Beginner decryptor
  • 17. Vague suspicions
  • 18. Swapping the elements
  • 19. Looking for the minimum element
  • 20. The minimum element is found!
  • 21. Starting sorting
  • 22. Continue sorting
  • 23. Finish sorting
  • 24. Testing the sorting
  • 25. Median of an odd number of elements
  • 26. Median of an even number of elements
  • 27. Green light
  • 28. The murderer is the butler, again!
  • 29. Summary of “Arrays”. Part 2
  • 30. Sixth program: Long jump records
Average value
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

Little Muffin and Big Data

Muffin started to run his video blog with the hyped-up name “Videoblob”. He talks about food for cats, techniques for sudden jumps off the wall, about clever methods of catching flies and hunting birds from the windowsill.

Muffin wants to know if his content is interesting for other cats, because video blogging takes a lot of effort. That’s why he started a visitor counter.

You need to write a program that will help Muffin evaluate his traffic. On different days, a different number of people can visit the blog, but the main thing is that the average number of visits at first stays above 1,000. If traffic falls, the program will need to notify Muffin.

Muffin has already sent you traffic data for the first three days, and the figures are stored in variables. The recommended average traffic value is stored in the variable expectedUsers.

To track blog popularity and changes in traffic, Muffin bought a program from third-party developers that draws values on a graph. You can start this program with a special command muffin.plot().

The command builds the graph based on all the passed arguments, except the last one. The last value is drawn as a horizontal line so that it is possible to estimate how far each of the points in the graph deviates from the recommended value.

Comments

  • script.js
JavaScript
var expectedUsers = 1000; var firstDayUsers = 812; var secondDayUsers = 1360; var thirdDayUsers = 657;

What didn’t you like in this task?

Thanks! We’ll fix everything at once!

Console

The code has changed, click “Run” or turn autorun on.

Result

Goalscompleted

Let’s add a graph on the screen.

  1. After declaring the variables, add the command muffin.plot(firstDayUsers, secondDayUsers, thirdDayUsers, expectedUsers);.

Cookies ∙ Privacy ∙ License Agreement ∙ About ∙ Contacts ∙ © HTML Academy OÜ, 2019−2026

VISAMastercard

Log in

or

Forgot your password?

Sign up

Sign up

or
Log in

Restore access

Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.

Forgot to connect your email to the profile? Email us and we’ll help.