Easy there, pal!
To access the Arrays challenges in the JavaScript programming, you need to sign up and subscribe first.
After a couple of meowtalities, the popularity growth of the video blog was resumed, and the updated version of the analyzer program eliminated all the cheating. Now Muffin can devote himself to his favorite thing to do.
Every year the boss participates in all-cat competitions in long jumps from the wall. Competitions are held among the best cats in the country and require serious preparation.
Selection for competitions is tough, it’s hard to qualify for them, and that’s Muffin needs a program that runs qualification rounds according to the rules of the championship. Anyway, here is the technical assignment:
Meow! I train regularly and I want to understand if I will qualify.
During the training I do a few jumps and collect the lengths of the jumps into the array
attempts.The qualification value is stored in the
qualificationDistancevariable.The program must choose the three best jumps, calculate the average value of these three jumps and write it into the
averageBestvariable.If the average of the best three jumps is greater than the qualification value, then I passed the qualification and variable
qualifiedmust containtrue. If qualification round is not passed, thenqualifiedmust containfalse.
You can find the best three values in different ways. You can sort the array in ascending order (you already know how to do it) and take the last three elements (you practiced that as well).
You can test yourself and try to sort the array in descending order. Then after the sorting, the best three values will be at the beginning of the array.
When you are done, press Hey boss, here’s your program!
You’ve gone to a different page
Click inside the mini-browser to shift the focus onto this window.
To access the Arrays challenges in the JavaScript programming, you need to sign up and subscribe first.
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.