Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] Binary Count by flairplaya
"use strict";
function binaryCount(number){
return number.toString(2).replace(/0/g, "").length;
}
var assert = require('assert');
if (!global.is_checking) {
assert.equal(binaryCount(4), 1);
assert.equal(binaryCount(15), 4);
assert.equal(binaryCount(1), 1);
assert.equal(binaryCount(1022), 9);
console.log("Coding complete? Click 'Check' to review your tests and earn cool rewards!");
}
Sept. 16, 2018