function that counts 1 in strings
function count(str) {
var countForZero = 0;
var countForOne = 0;
for (var i = 0, length = str.length; i < length; i++) {
if (str[i] === '0') {
countForZero++;
}
else {
countForOne++;
}
}
return {
'zero': countForZero,
'One': countForOne
};
}