Global Variables and Function Parameters


Let’s say we have the code:
const satellite = ‘The Moon’;
const galaxy = ‘The Milky Way’;
let stars = ‘North Star’;

const myNightSky = () =>
return 'Night Sky: ’ + satellite + ’ , ’ + stars + ’ , ’ + galaxy;


My main problem is that I fail to understand why myNightSky is able to execute at all. After all, myNightSky does not explicitly include any parameters in the parantheses. Yet, satellite, stars, and galaxy are returned. How is it possible to have a function with no explicitly specified parameters return global variables?


Function don’t need parameters? Parameter are optionally

that is why they are called global variable, they are global and can be accessed by any part of the program (including inside a function)


Did you set the variable ‘satellite’ equal to ‘The Moon’?

This is an error message i get in multiple browsers… i made a separate post but no one has responded just yet…

my code is correct, but for some odd reason I cannot proceed past the first step of the instructions for the lesson


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