Input random user question in Magic Eight Ball

Hello community, I want to make the user ask his or her own question into an input field while the computer randomly picks a number between 0 and 7 to answer. I just want to be more creative. Thanks

const userName = ‘Enitan’;

userName ? console.log(Hello user: ${userName}!)

: console.log(‘Hello!’);

const userQuestion = ‘Would I be a Master Javascript Developer?’;

console.log(${userName}: ${userQuestion});

let randomNumber = Math.floor(Math.random() * 8);

let eightBall = randomNumber;

if (randomNumber === 0) {

console.log(‘It is certain’);

} else if (randomNumber === 1) {

console.log(‘It is decidedly so’);

} else if (randomNumber === 2) {

console.log(‘Reply hazy try again’);

} else if (randomNumber === 3) {

console.log(‘Cannot predict now’);

} else if (randomNumber === 4) {

console.log(‘Do not count on it’);

} else if (randomNumber === 5) {

console.log(‘My sources say no’);

} else if (randomNumber === 6) {

console.log(‘Outlook not so good’);

} else {

console.log(‘Signs point to yes’);


console.log(The value of the eightBall variable is ${eightBall})

The easiest way would be to use a prompt for the user input. In a later step it would be a nice exercise to build a website with a form field, where the user could enter their name etc., and a submit button that triggers the Javascript. And the output would be rendered to the website.