JSFiddle - React, Tailwind, and code Playground

by Salmin Skenderovic

JavaScript

const str = "10101010100";
let count = 0;
for (let i=0;i<str.length;i++) {
	count += even(str[i]) ? 1 : 0; 
}

console.log(even(count));

function even(x) {
	return x % 2 == 0;
}