I would like to know if there is a native javascript code that does the same thing as this:
function f(array,value){ var n = 0; for(i = 0; i < arr
You may want to use indexOf() function to find and count each value in array
indexOf()
value
array
function g(array,value){ var n = -1; var i = -1; do { n++; i = array.indexOf(value, i+1); } while (i >= 0 ); return n; }