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 JavaScript Arrays Store Multiple Values in an Array Review Adding, Removing, and Copying Array Elements

if ${attendees.length} is not the right answer, Whats the right answer?

if ${attendees.length} is not the right answer, Whats the right answer?

i asked gpt about it, and he responded

You can use the length property of the attendees array to get the number of elements in it. Here's the completed code:

const attendees = ['Anwar', 'Meg', 'Hope', 'Toni']; let message = There are ${attendees.length} attendees in the meeting.;

console.log(message); // Outputs: There are 4 attendees in the meeting.

In this code, the ${attendees.length} expression within the template string will be replaced by the actual number of elements in the attendees array when the code is executed.

1 Answer

Steven Parker
Steven Parker
231,198 Points

While it can be helpful, I wouldn't consider the GPT AI to be a definitive source for programming information. It may have potentially contributed to a bit of confusion in this case.   :see_no_evil:

You're right that attendees.length is indeed the correct answer to the quiz question. But note that the dollar sign and braces are provided outside the blank, so ${attendees.length} would not be the correct answer to fill in the blank. It that perhaps what you were entering?