Magic Ball from codepen

Just sharing because this code is an inspiration and a goal to achieve

$(document).ready(function(){

var magic8Ball = {};
magic8Ball.listofanswers = [“It is certain.”, “It is decidedly so.”, “Without a doubt.”, “Yes, definitely.”, “You may rely on it.”, “As I see it, yes.”, “Most likely.”, “Outlook good.”, “Yes.”, “Signs point to yes.”, “Reply hazy, try again.”, “Ask again later.”, “Better not tell you now.”, “Cannot predict now.”, “Concentrate and ask again.”, “Don’t count on it.”, “My reply is no.”, “My sources say no.”, “Outlook not so good.”, “Very doubtful.”];

magic8Ball.getAnswer = function(question)
{
var randomNumber = Math.random();
var randomAnswer = Math.floor(randomNumber * this.listofanswers.length);
var answer = this.listofanswers[randomAnswer];

$("#8ball").effect( "shake" );
$("#answer").text( answer );
$("#answer").fadeIn(3000);
$("#8ball").attr("src", "https://s3.amazonaws.com/media.skillcrush.com/skillcrush/wp-content/uploads/2016/09/answerside.png");

console.log(question);
console.log(answer);

};
$("#answer").hide();

var onClick = function()
{
$("#answer").hide();
$("#8ball").attr(“src”, “https://s3.amazonaws.com/media.skillcrush.com/skillcrush/wp-content/uploads/2016/09/magic8ballQuestion.png”);
var question = prompt(“What do you want to know?”);
magic8Ball.getAnswer(question);
};

$("#questionButton").click( onClick );
});

hi there,

wrote the following code:
let myName = ‘John’;
let userQuestion=‘will i be rich in a year?’;
console.log(‘my name is’+’ ’ +myName+’ ’ + ‘and i would like to ask the following question’+’: '+userQuestion );

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

let eightBall=’’;
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 if(randomNumber===7) {console.log(‘Signs point to yes’);}

seems to work fine. The only thing I could not understand is the purpose of the following variable:
let eightBall=’’;

with, or without it, the code working fine… unless I am missing something.

thank you.