Question regarding this syntax in functions

Here is how the code is written in the exercise:
const city = ‘New York City’;

const logCitySkyline = () => {

let skyscraper = ‘Empire State Building’;

return 'The stars over the ’ + skyscraper + ’ in ’ + city;

};

console.log(logCitySkyline());


Why wouldn’t you wite the code within the return statement with string interpolation? Like this:
The stars over the ${skyscraper} in ${city};

I am confused with the + signs within the function surrounding the variables.

All very well and good, once we understand concatenation That is the next step. It’s important to understand the process that the latter is emulating. Concatenation is the simplest form of interpolation since regardless of method used, the end result is a string.

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