JavaScript The Solution

Nancy Chen
Nancy Chen
1,483 Points

Can someone please check my code? It's not showing up in the browser.

Hello, I'm trying to preview this but nothing shows up. What did I do wrong?

let question = prompt("How are you doing today?");

let question2 = prompt("What are you going to do today?");

let comboquestions = question.toUpperCase() + ' ' + question2.toUpperCase();

let numberlength = comboquestions.length;

alert(The string ${comboquestions} is ${numberlength} number of characters long.)

Zaid Khan
Zaid Khan
12,501 Points

Is your JS file linked in HTML?

1 Answer

Peter Vann
Peter Vann
26,484 Points

One error is that your template literals (template strings) need surrounding backticks (in the alert). (See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) Example: This:

alert(The string ${comboquestions} is ${numberlength} number of characters long.)

should be typed like this:

alert(`The string ${comboquestions} is ${numberlength} number of characters long.`)
Peter Vann
Peter Vann
26,484 Points

Please lemmeeno if that was the issue... :)

Nancy Chen
Nancy Chen
1,483 Points

Oh no, I had backticks for when I pasted it here, it ended up turning the code into a different font haha. I had them so it turned out well! Thank you!