You might get a task like this.
Find the number of occurrences of minimum value in the list, which actually means we have an array
of numbers and with first of all, must find the minimum value inside and then calculate how many times
we have this value.
And actually, if you will try to use here for a loop, then it will be really tedious because you need
to use it twice.
First of all, to find the minimum value inside the ray and secondly, to calculate how many times we
have this value inside.
This is where extra legroom must find a correct function inside JavaScript to solve it easier.
And actually, we have such function in, say, JavaScript, and it is called math minimum.
As you can see, here are passing inside several arguments and it will return fire to the smallest.
This is why we can use this function, but it doesn't work with race.
What we can do instead, we can write math minimum and we can't pass inside the array, but we can use
a spread operator here and it will convert our array to arguments.
So here we can have an array one two three and we're getting back one.
And that is exactly what we wanted.
This is why, as you can see in a single line, we can replace our for loop, which will be much more
difficult to write.
So first of all, here, let's name it, mean value.
And here we want to call it on our rate.
And let's create our array, which will be one two three.
And here we want to spread out very sober, found our minimum value in there.
Now how we can find how many times we have this value inside the rate and actually the easiest way here
is by using filter.
If we will filter our rate by this minimum item, we will get in the way of our minimum items.
And then we simply can get a length of this rate.
So it will look something like this.
We can get here our minimum array and what we want to do is rate filter.
And here we have access to every single element.
And we just compare if our element equals our minimum value.
In this case, inside me in the rainbow, we have only our minimum values.
And now we can write here just console.log mean array dot length.
And it will return for us exactly how many occurrences of this minimum value we have inside of rape.
Let's check the SA time to load in the page where get in one, if we will add here one and one twice,
then here we have three of them.
And as you can see, our code is working and in three lines we solved our problem.
This is why I highly recommend you to always try and find the right tool for the right jump.