Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialVladimir Plokhotniuk
5,464 PointsIntroducing ES2015, dont working the same code
hi, i copied the code in WebStorm, but in console.log i have this " Good undefined, undefined! " Then i cannot working from this beginning step ( What is wrong?
function greet(name, timeOfDay) {
console.log(Good ${timeOfDay}, ${name}!
);
}
greet()
4 Answers
Hannah De Los Reyes
18,289 PointsYou are missing the back-ticks around Good ${timeOfDay}, ${name}!
Also, like others have said, you need to pass in arguments when you call the function.
Steven Parker
231,248 PointsThe "greet" function shown here is designed to take two arguments, and include them in the display.
But when you call it without arguments ("greet()
"), the system displays "undefined" in the places that the values would be shown.
So when you call it, pass it some arguments to use. For example:
greet("Vladimir", "morning");
Fradely Dilone
24,037 PointsAll the workspaces starting AJAX by Js full-stack course have errors
af09
10,704 Pointsfunction greet(name, timeOfDay) {
console.log(`Good ${timeOfDay}, ${name}!`);
}
//You need to pass the parameters to the function, like this:
greet("Paco","15:00");
Vladimir Plokhotniuk
5,464 PointsThanks to everyone. I entered another character, like " ' " instead of " ` ". I did not know that they affect the function differently.
Steven Parker
231,248 PointsI could tell that you had used backticks correctly by the way the font changed. To have code appear correctly, see the instructions I mentioned in my previous comment.
Steven Parker
231,248 PointsSteven Parker
231,248 PointsThe back-ticks were used in the question, but were not shown because the code is not formatted. Use the instructions for code formatting in the Markdown Cheatsheet pop-up below the "Add an Answer" area. Or watch this video on code formatting.