I can't see the error in sky.js


#1

Hello, I have an error in the global scope task sky.js

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

The errors are flagged at the fourth task.

Does the code contain a function named myNightSky() defined with const?
Did you write a console.log() statement beneath the close of the function block?
Did you pass the myNightSky() function to console.log() as an argument?

const satellite = 'The Moon';
const galaxy = 'The Milky Way';
let stars = 'North Star';

const myNightSky = () => `Night Sky: ${satellite}, ${stars}, ${galaxy}`;

console.log(myNightSky()); 



#2

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


#3

Thanks. It worked. But codecademy should be able to accept different styles
of function expression. After all they taught that form in the functions
topic.

Thanks again.


#4

Actually, I have just tried your solution again and it works the same. Could it be the browser that you’re using to connect to codecademy?


#5

It is also annoying that they let you use ` in defining sometimes and then will cry that it isn’t inside of a ’ in others.


#6

It accepted this for question 2:

const satellite = ‘The Moon’;
const galaxy = ‘The Milky Way’;
let stars = ‘North Star’;

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

But gave me the same errors for Question 3 with this:

const satellite = ‘The Moon’;
const galaxy = ‘The Milky Way’;
let stars = ‘North Star’;

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

console.log (myNightSky());

Why?


#7

I don’t know, perhaps. I’ve always used chrome.

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
Virus-free.
www.avast.com
https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>


#9

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