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 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
229,644 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
229,644 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".