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