That first post

Written by Posted on Categories: Projects Tags:

So a blog has always got to start somewhere and I thought I’d set the bar low, on the basis that it can only get better from here.

And finally, the bit you’ve been waiting for, what the actual post is about – a binary to decimal converter. This was one of the first tasks we were set in our computing class and rather than model it with a flowchart this is how it would be done in Javascript:

var n = "11011010", total=0;
for(var i=0; i<n.length;i++) {
var x=Number(n.substring(n.length-(i+1),n.length-i));

Where the variable n is your binary string. Here’s a live demo:

Binary string: