I've tried to find answer to my question but i couldn't find and that's why I'm here, so question is - why I'm getting "TypeError: arr.coincidenсe not a function" when I'm trying to launch this code
var arr = [0, 2, 3, 3, 3, 4, 5, 6, 6];
alert(arr.occurencesCount(0)); // 1
Array.prototype.occurencesCount = function (value) {
var count = 0;
for (var i=0;i<this.length;i++){
if (value===this[i]){
count++;
}
}
return count;
}
It should count how many times some value repeating in code, but somewhere is mistake and I can't find it. Please, help, thanks.