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 trial

JavaScript Introducing ES2015 The Cooler Parts of ES2015 Functions and Parameters Review

Tiger Wang
Tiger Wang
26,548 Points

The Quiz question is holding a wrong answer.

In question 'Which of the following functions correctly implements default parameters?', I think the answer is obviously "function myFunction(name = 'Ken')". But I'd tried for several times, it always said I was wrong. Could you please check the setting of the Quiz?

2 Answers

Ken Howard
STAFF
Ken Howard
Treehouse Guest Teacher

Thank you for point this out! The correct answer (per the quiz) is using invalid syntax. We'll get it fixed.

The correct syntax should be:

function myFunction(name = 'Ken') { … }

cc Guil Hernandez

Tiger Wang
Tiger Wang
26,548 Points

Thank you for your timely response, Ken.

Tiger Wang
Tiger Wang
26,548 Points

Well, I made a mistake, the answer is "function myFunction(let name = 'Ken') { … } ", Another question is, when I add it to my project , the error comes like

function myFunc(let name = 'Tiger'){
                    ^^^^
SyntaxError: Unexpected identifier
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:513:28)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)