I'm working on a JavaScript assignment that requires me to use prompt-synch in Node.JS. It works fine until I try to use a newline character \n
within the prompt, at which point every character or backspace typed causes the prompt to repeat itself.
What could I do to get the user input to appear on a new line (a requirement of this exercise) without this issue?
Problem code:
if (guess < answer) {
guess = prompt("Too low!\n> ");
} else if (guess > answer) {
guess = prompt("Too high!\n> ");
}
output screenshot