Javascript implementation of regnier's abacus