Global Scope 2 Sky lesson help please


#1

Hi, I am stuck on part 2 of Global Scope 2 lesson. Lesson link:
https://www.codecademy.com/courses/learn-javascript-scope/lessons/scope/exercises/global-scope-ii?action=resume_content_item&course_redirect=introduction-to-javascript

Here is my code:

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());
conosle.log(stars);

I get this message regarding my code: Did you create another console.log() statement ‘console.log(myNightSky());’?
Did you log the value of the ‘stars’ value to the console?

I have been asked to:
2.
Outside the function, under the previous console.log() statement, console.log() the value of stars.

You’ll notice that the global variable stars was reassigned to ‘Sirius’. In other words, we unexpectedly changed the value of the global variable, and this could impact our program in ways we do not intend.

Please could someone tell me where I am going wrong on this? Thank you,

Zoe


#2

Hi, your second log contains a typo. Fix that and try to submit again :slight_smile:


#3

Thank you very much - I was very tired doing this and obviously missed a silly, easily identifiable error! :see_no_evil:

Thank you. I will double check typos in future!

Zoe


#4

Np, it happens all the time. Happy coding!


#5

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