Javascript Implementation of radix number guessing game