What is wrong with that code?


#1
const satellite = 'The Moon';
const galaxy = 'The Milky Way';
let stars = 'North Star';
const myNightSky = () => { stars = 'Sirius'; return 'Night Sky:' satellite + ',' + stars + ',' + galaxy};
console.log(myNightSky());
console.log(stars);

https://www.codecademy.com/courses/learn-javascript-scope/lessons/scope/exercises/global-scope-ii?action=lesson_resume&course_redirect=introduction-to-javascript


#2

you really have to be more careful with your string concatenation:

return 'Night Sky:' satellite

missing + to concat string and variable


#3

Thanks a lot for your answer.


#4

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