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 trialJamin Jones
1,532 PointsIn the function below, set the default value of the partOfDay parameter to 'morning'
when I set the default value to "=morning" it says bummer why is that?
1 Answer
Rabin Gharti Magar
Front End Web Development Techdegree Graduate 20,928 PointsHey Jamin Jones,
The reason you are getting an error message is that when declaring a default value
you placed a quotation mark
before the equal sign
.
It should look like this instead: partOfDay = "morning"
.
function greet( name, partOfDay ="morning" ) {
return `Good ${partOfDay}, ${name}!`;
}
Hope this helps!