How can you build an Array.count() method in javascript?

Is it possible to actually write a function so I could always use it like this:

const arr = [1, 3, 3, 5];
arr.count(3) //should return 2

or even

[1, 3, 3, 5].count(3);

If so, what do I have to study to achieve that?