How do I declare a more global variable that overrides a previous global variable?


const satellite = 'The Moon';
const galaxy = 'The Milky Way';

let stars = 'North Star';

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


I am specifically talking about the syntax for the last consol.log(stars)

Hoping to help the other members by asking this too!

Here is the link:


global means everywhere. There’s no such thing as “more everywhere”.
You can create scopes (functions) within other scopes though, so you can always make something less global (local)

Not sure what this has to do with syntax or your code though, so if there’s something you wonder about your code, you’ll need to describe what you want to accomplish and what’s stopping you.

Not a syntax issue, but one of names: I would compare the last two lines with each other closely, one of them refers to something that hasn’t been defined.


Simple spelling mistake! I figured it out.


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