Answers for "js how many items in array are the same"

1

javascript get same elments from multiple arrays

var result = arrays.shift().filter(function(v) {
    return arrays.every(function(a) {
        return a.indexOf(v) !== -1;
    });
});
Posted by: Guest on August-27-2020
0

javascript check how many times value in array

function f(array,value){
    var n = 0;
    for(i = 0; i < array.length; i++){
        if(array[i] == value){n++}
    }
    return n;
}
Posted by: Guest on September-18-2021

Code answers related to "js how many items in array are the same"

Code answers related to "Javascript"

Browse Popular Code Answers by Language