@anonymous/

ComfortableOrdinaryConversions

Nodejs

No description

fork
loading
Files
  • index.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function count(str) {
  var sum = 0;
  
  for (var i = 0, length = str.length; i < length; i++) {
    sum += Number(str[i]);
  }
  
  return {
    'zero': str.length - sum,
    'One': sum
  };
}

count('101011')
node v10.16.0