Another implementation just for functional JS practicing could be
var bin2int = s => Array.prototype.reduce.call(s, (p,c) => p*2 + +c)_x000D_
console.log(bin2int("101010"));
_x000D_
+c
coerces String
type c
to a Number
type value for proper addition.