Skip to content
Subhajit Sahu edited this page Jan 30, 2021 · 15 revisions

Count no. of true values. 📦 😺 🏃 📼 🌔 📜 📰 📘


boolean.count([a], [b], [c], [d], [e], [f], [g], [h]);
// a: 1st boolean
// b: 2nd boolean
// c: 3rd boolean
// d: 4th boolean
// e: 5th boolean
// f: 6th boolean
// g: 7th boolean
// h: 8th boolean
const boolean = require('extra-boolean');

boolean.count(true, true);
// 2

boolean.count(true, false);
// 1

boolean.count(true, true, true, false);
// 3           ^     ^     ^

boolean.count(false, true, false, false);
// 1                  ^


References

Clone this wiki locally