-
Notifications
You must be signed in to change notification settings - Fork 0
count
Subhajit Sahu edited this page Dec 28, 2022
·
14 revisions
Count values which satisfy a test.
function count(x, ft)
// x: lists
// ft: test function (v, k, x)
const xlists = require('extra-lists');
var x = [['a', 'b', 'c', 'd', 'e'], [1, 1, 2, 2, 4]];
xlists.count(x, v => v % 2 === 1);
// → 2
xlists.count(x, v => v % 2 === 0);
// → 3