Scope syntax is unclear to me


The initial scope exercises provide the following lines of code to create what it calls local variables:

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

I get that const myNightSky = () makes that variable an empty function, but what does => do here? Why not just =? And how does this limit which variables can be accessed from where?


That function has no local variables in it. Note that what’s between the curly braces is the body of the function (google: mdn arrow function for description of syntax)


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