Help

im trying to learn how to code but stuck on the first project for game developing and it keeps saying my Fahrenheit is undefined ???

// convert tempature in kelvin degrees

const kelvin = 0;

//converting kelvin to celsius

const celsius = kelvin - 273;

// convert celsius to fahrenheit

let fahrenheit = celsius * (9/5) + 32;

//round down fahrenheit variable

fahrenheit = Math.floor(fahrenheit);

console.log(`The tempature is ${fahrennheit}degrees Fahrenheit.`);

//conver to Newton

let newton = celsius * (33/100);

//Round down

newton = Math.floor(newton);

console.log(`The temature is ${newtond}egrees Newton.`);

Hello, @blog8917374394, and welcome to the forums.

Are you sure the error doesn’t say that fahrennheit is undefined? You’ve defined fahrenheit here:

let fahrenheit = celsius * (9/5) + 32;

But, I see no definition for fahrennheit. :wink:

Also, for future posts, please review How do I format code in my posts? Following these guidelines will allow your code to look as it does now after I edited your post.

1 Like

After checking @midlindner’s reply, make sure you add a space between ${fahrennheit} (which contains an error) and the next word.

Otherwise, the sentence will log (after you correct the error)

The tempature is 92degrees Fahrenheit.

Make sure you provide a descriptive title as well on your post. This can help people discover your post better.