HTML Academy
Finishing refactoring
Arrays12/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 from an array using index
  • 7. Variable as 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
Writing to an array by index
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

One small analytical investigation

  • Again, tr-r-raffic rating is so-so?! Puffs the tail, pulls the whiskers forward
  • But, boss boss, we’ve talked about this already. Statistics help us identify problems.
  • And what do I care about these problems? The whiskers go back
  • If you noticed any problems, you can find out why they occurred and fix them.
  • Look for them and correct them! The tail goes back down

Got away with it this time. But now we need to delve deeper into the data. Maybe we’ll find the problem. I have an idea.

What if we highlight days when traffic is at its lowest? For example, those days when traffic is 100 or even 200 people less than expected.

Yes, exactly. Let us make the value of the dip adjustable.

Now let’s test the hypothesis. Introduce a variable with the minimum admissible traffic. We will then check the traffic for the current day in the loop, and if it does not reach the minimum value, we will log it in the console. I wonder if there will be many of such poor values?

Comments

  • script.js
JavaScript
1
2
var expectedUsers = 1000;
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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 0 out of 3
  1. After the variable totalUsers, add a variable minUsers with the value of expectedUsers - 100.
  2. Inside the loop, add a check to make sure that usersByDay[i] is less than minUsers.
  3. If the check is passed, log the number of visitors for the current day in the console.

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

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.