${} Format note displaying value


#1

Doing the Javascript Intro exercise to convert temp (Kelvin) and the value does not display - The temp is ${fahrenheit} degrees Fahrenheit. No idea what I am doing wrong here - here is my code:

//kelvin will be used to convert to Celcius
const kelvin = 294;
//celsius is 273 minue kelvin
const celsius = kelvin - 273;
//fahrenheit is the below
let fahrenheit = celsius * (9 / 5) + 32;
fahrenheit = Math.floor(fahrenheit);
console.log(‘The temp is ${fahrenheit} degrees Fahrenheit.’);


#2

Please use the editors’ button for formatting code so that it remains intact (otherwise people cannot accurately copy it and thus would be looking at other code)


#3

How do I select the Editors button when in the console for CodeAcademy?


#4

The problem here is that if I copy code from your post and run it, this is the result:

When asking about a piece of code you need to make sure that others receive an exact copy so that when they run it, the same thing as what you are asking about happens for them. (Otherwise the point of posting the code is missed, because the code you ask about isn’t there)


#5

Regardless,

A good start would be to read up on the thing you’re trying to use (template literals)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals

A good approach to solving your trouble here is to copy an example from that webpage, run it and verify that it does what you mean to do, and then adapt your own code to match.
(And finally take note of what needed to be different, this is likely the most important part)


#6

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