Javascript eightball module trouble

I thought I put my code in right, but the console.log() function keeps spitting back partial code. Below is my code for the exercise:

let userName = ‘M’;

userName ? console.log(‘Hello, M!’) : console.log(‘Hello!’);

let userQuestion = ‘Will I complete the coding, reading, and Arabic lessons for today?’;

console.log(‘The user asked: ${userQuestion}’);

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

let eightBall = ‘’;

switch (randomNumber) {

case 0:

eightBall = 'It is certain';


case 1:

eightBall = 'It is decidedly so';


case 2:

eightBall = 'Reply hazy try again';


case 3:

eightBall = 'Cannot predict now';


case 4:

eightBall = 'Do not count on it';


case 5:

eightBall = 'My sources say no';


case 6:

eightBall = 'OUtlook not so good';


case 7:

eightBall = 'Signs point to yes';



console.log(‘The eight ball answered: ${eightBall}’);

Now below is what the console was displaying:

Hello, M!
The user asked: {userQuestion} The eight ball answered: {eightBall}

Hello @mattd18, welcome to the forums. The reason this is doing this is to interpolate strings, you must use backticks:

let vara = "lorem ipsum";
console.log(`This is interpolating the variable ${vara}`); 
console.log('This is not interpolating the variable ${vara}');

Notice how the first one has backticks, but the second one has speech marks?

See how here:

and here:

You are using quotation marks, not back ticks?
I hope this helps!
P.S. To correctly format your code, click this button:

and put your code in-between the back ticks:
Screen Shot 2020-05-02 at 14.06.13

Thank you for your help with this!

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.