How Does Binary Counting Work In Javascript