@stdlib/array-base-count-falsy
v0.2.0
Published
Count the number of falsy elements in an array.
Downloads
329
Readme
countFalsy
Count the number of falsy elements in an array.
Installation
npm install @stdlib/array-base-count-falsy
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 );
Notice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2024. The Stdlib Authors.