Get unlimited access
Open in app
Home
Notifications
Lists
Stories

Write
Ole Ersoy
Ole Ersoy

Sep 20, 2020

·
1 min read

Counting the Number of Zeroes in a Javascript Array

Scenario

We have this array const a = [0,1,0] .

We want to count the number of zeroes in it.

Approach

a.filter(v => v === 0).length;

Brought to You By Firefly Semantics

Firefly Semantics Supply Chain and Big Data Analytics for the Cloud

Firefly Semantics Supply Chain and Big Data Analytics for the Cloud

Firefly Semantics Supply Chain and Big Data Analytics for the Cloud fireflysemantics.com

--

--

More from Ole Ersoy

Founder of Firefly Semantics Corporation

Love podcasts or audiobooks? Learn on the go with our new app.

Try Knowable

Recommended from Medium

Eric L

Eric L

Webpack for React v17, a minimalistic setup Part II

Ole Ersoy

Ole Ersoy

Derived Reactive Observable State with Slice

Akash Ranjan Patel

Akash Ranjan Patel

Web development | Build Website to Show Particles Game

Madza

Madza

in

JavaScript in Plain English

20 Famous Quotes for DEV Inspiration ✨🧙‍♂️

Title Image
Code Factory

Code Factory

Java 8 — Two Argument Functional Interfaces | Code Factory

Dnegeyra

Dnegeyra

Linking Tailwind CSS

Ole Ersoy

Ole Ersoy

Loading JSON on Stackblitz with Angular

Akaninyene Udosen

Akaninyene Udosen

Creating forms with django.

AboutHelpTermsPrivacy


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ole Ersoy

Ole Ersoy

Founder of Firefly Semantics Corporation

More from Medium

Ole Ersoy

Ole Ersoy

Adding Search To the Firefly Semantics Slice Angular Todo Application

Ayyash Ayyash

Ayyash Ayyash

Writing a wrapper for console.log for better control in JavaScript, Part I

chetan

chetan

Angular: Build your own Context Menu

Piyush Jain

Piyush Jain

How to set up Jest in Angular App

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Knowable