Question: Javascript input validation with while loop isnt working? const choices = [a, b, c, d]; let userChoice = prompt(Pick one from a, b, c, d:
Javascript input validation with while loop isnt working?
const choices = ["a", "b", "c", "d"];
let userChoice = prompt("Pick one from "a", "b", "c", "d": );
while (!choices.includes(userChoice));
alert("Invalid entry! Please re-enter!);
let userChoice = prompt("Pick one from "a", "b", "c", "d": );
alert("You picked " + userChoice);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
