Simple number guessing game in javascript