countFalsy
Count the number of falsy elements in an array.
Usage
var countFalsy = require( '@stdlib/array/base/count-falsy' );
countFalsy( x )
Counts the number of falsy elements in an array.
var x = [ 0, 1, 0, 1, 2 ];
var out = countFalsy( x );
// returns 2
Examples
var bernoulli = require( '@stdlib/random/array/bernoulli' );
var countFalsy = require( '@stdlib/array/base/count-falsy' );
var x = bernoulli( 100, 0.5, {
'dtype': 'generic'
});
console.log( x );
var n = countFalsy( x );
console.log( n );