-
Notifications
You must be signed in to change notification settings - Fork 3
count
Subhajit Sahu edited this page Jun 11, 2020
·
13 revisions
Counts values which satisfy a test. 🏃 📼 📦 🌔 📒
object.count(x, fn, [ths]);
// x: an object
// fn: test function (v, k, x)
// ths: this argumentconst object = require('extra-object');
var x = {a: 1, b: 1, c: 2, d: 2, e: 4};
object.count(x, v => v % 2 === 1);
// 2
object.count(x, v => v % 2 === 0);
// 3