Need help with a JavaScript assignment (solved)

I have been working on this assignment for over a week and I have no idea what to do next. My teacher wants our page to look like this after we put in any name, any age, and any hours of sleep: jscript_asgn1_2 and then he wants us to use this formula: Years a Person Slept = Person’s Age * (Number of Hours they Sleep per night / 24) and then round it using Math.round()
So far, I have it like this:

Here’s my Javascript:

If I take away the math, it’ll say “Hi Alicia. You have slept.” but obviously I need the rest of the sentence.

Why do you have 2 variables named Years? That’s going to cause some issues, to calculate the amount of hours slept, do the calculation in one “Year” variable. You already have the formula for that, so basically you would take the age that the user typed in, presumably you have it stored in myAge variable, and insert it into your formula. And since it needs to be rounded, you would then need to wrap your entire formula in Math.round().

let age = Math.round(myAge * (#'s of hours slept / 24))

Of course the numbers of hours slept will be from a user input, from which I don’t see currently in your code. But once you have the basic calculation figured out and stored in one variable, you would just simply concatenate them together. For this I would highly suggest looking into template strings to combine values from variables and strings to text together. For example, it would look like this:

`Hi, ${name}. You have slept for ${numOfYears} years of your life away.`

It’s easier to read, and understand especially if you end up having just a bunch of plus signs everywhere.

if you want exactly what’s wrong… you have a variable named myText with the first half, and a variable named Years with the other half of the sentence, you never join them in anyway, and you set innerHTML to just myText