View Single Post
Old 10-13-2012, 03:29 AM   PM User | #2
Logic Ali
Regular Coder

 
Logic Ali's Avatar
 
Join Date: Sep 2010
Location: London
Posts: 959
Thanks: 0
Thanked 198 Times in 193 Posts
Logic Ali will become famous soon enoughLogic Ali will become famous soon enough
You are trying to perform the calculation from left to right, but it should be right to left, in other words, start at the end of the string.

Quote:
Code:
if (binary.charAt(i) === 1)
=== is the wrong operator because you are comparing an integerr to a character.

Try again.
Logic Ali is online now   Reply With Quote