Hi, I’m complete new to coding. According to the instruction, the result should be 68F ,but this is what I got:
The temperature is ${fahrenheit} degrees Fahrenheit.
what i did wrong and how to make it becomes 68?
thank you for your help!
Hi, I’m complete new to coding. According to the instruction, the result should be 68F ,but this is what I got:
The temperature is ${fahrenheit} degrees Fahrenheit.
what i did wrong and how to make it becomes 68?
thank you for your help!
Hello! Could you please post your full code? Without it, I can only speculate, but I’d say you used quotation marks instead of back ticks:
let user = "Me";
//printing a normal string:
console.log("hello ${user}");//prints: hello ${user}
//printing using template literal:
console.log(`hello ${user}`);//prints: hello Me
//notice the backticks (``) used in the second example?
To post correctly formatted code in the forums, see this thread.
my code
//this is today's weather forecasst in Kelvin
const kelvin =293;
//this is formula to convert kelvin to celsius
const celsius=kelvin-273
//this is formula to conver celsius to fahrenheit
let fahrenheit=celsius* (9/5)+32;
//this is to round down to fahrentheit
fahrenheit = Math.floor(fahrenheit);
console.log("The temperature is ${fahrenheit} degrees Fahrenheit.")
i changed to back tick and it works.
thank u