Kelvin Weather Syntax

I entered everything as indicated in the Hints and the Unstuck video, but still couldn’t get the code to work correctly.

This is what I have:

const k = 293;
const c = k - 273;
let f = c * (9/5) + 32;
f = Math.floor(f);
console.log(‘The temperature is ${f} degrees Fahrenheit.’);

However, the following result is what appears in the console:

“The temperature is ${f} degrees Fahrenheit.”

Why is the string interpolation not executing?

const k = 293;
const c = k - 273;
let f = c * (9/5) + 32;
f = Math.floor(f);
console.log(‘The temperature is ${f} degrees Fahrenheit.’);

In JavaScript, we interpolate string like this with backtick:

const name = "Alex";
console.log(`My name is ${name}.`) // Prints: My name is Alex.

There is a cheatsheet regarding String Interpolation in JavaScript here:
https://www.codecademy.com/learn/paths/full-stack-engineer-career-path/tracks/fscp-javascript-syntax-part-i/modules/fecp-learn-javascript-syntax-introduction/cheatsheet

2 Likes