Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Introducing ES2015 Objects and New Collection Types Set

how the teacher added sarah for example to the classrom set if he didnt declared sarah?

It's not an array of objects, i don't understand how he did it and why it's valid. another question is the syntax of the if statements where is the {}?

2 Answers

Steven Parker
Steven Parker
208,481 Points

The variable "sarah" is declared in the big "let" statement. When items are separated by a comma, it's just like each one was a separate statement with "let" in front of it.

And an "if" can control either a code block (surrounded by braces), or a single statement. The braces aren't needed when the "if" is controlling a single statement.

It’s new to es6? another thing i want to ask is how i continue from here. i decided to do the full stack js track first and then the front end because i find it more interesting. i did all the courses until dom manipulation. we didn’t had any major projects in the new es6 syntax. i also want to be do some algo challenges which i don’t find a lot in the js track like in the python track for example.

Steven Parker
Steven Parker
208,481 Points

"Let" is new with ES6, but declaring more than one thing at a time using commas is not (it just used to be "var" you would do it with).

There's lots of third-party challenge sites for more practice. One I've used is "codewars".