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

Jacob Bender
Jacob Bender
15,300 Points

Updated the coding challenges to accept ES6 syntax

Hi all,

Just renewed my subscription to take a few courses in the library - I noted that during the coding challenges during a series there seems to be a lack of support for ES6. Now I know some of the older videos were made before things like 'let' became convention but it's a little frustrating not being able to use newer syntax when completing these challenges. I noticed that work-spaces do accept modern syntax (arrow functions, etc) but the challenges do not. Any chance this will be addressed?

Thanks,

Jake

3 Answers

Jacob Bender
Jacob Bender
15,300 Points

Hi Jacob,

I figured as much - but I disagree about starting people on older syntax. First off, I don't think it really is cleaner.

For example, in the AJAX section the video uses vanilla JS is used instead of JQuery, resulting in:

document.getElementById("ajax").innerHTML = xhr.responseText;

instead of

$("#ajax").html(xhr.responseText);

Which of those do you find cleaner?

In the full stack JS track, JQuery is taught before AJAX in the track. Shouldn't we immediately build on that?

Pretty much every video (on other resources, like youtube) starting new people on JS start with the newer syntax and many do not even mention the old ways except in passing. I wonder how useful it is to spend a lot of time getting used to code to you will end up changing in projects you would build going forward.

Just my thoughts though - I understand re-writing the editor for coding challenges to accept this would have a cost to the TH team and do appreciate the resources they do provide (being able to use the Workspaces inside the browser is really useful).

Edit: Looks like I got ahead of myself, jQuery and AJAX is in the AJAX section.

For not having to reshoot JS basics course again, I think "var" for absolute beginners is fine. Would it be better if they rewrote the course, to have const and let, sure, but the point of these classes is to create a basic understanding of programming concepts rather than the newer syntax.

The AJAX course really needs to be revamped. I totally agree.

Yes, AJAX with jQuery is easier and less clunky, than vanilla JS, but learning how to code AJAX in vanilla JS is super important, its about learning. Even Dave himself in the videos state AJAX in jQuery is a lot easier, so they teach you the Flicker project in jQuery rather than vanilla JS. It's responsible teaching to show how to code in the native language as well as using a framework. as long as the concept can be applied to both native and by using the framework.

I hear ya though, using the new syntax is important, but in my mind its more important to understand the concept behind the syntax more.

Jacob Bender
Jacob Bender
15,300 Points

Jacob,

Fair enough - I forget that this may be first time exposure for some folks. I have a bit more experience with JS so sometimes sections I just want a quick refresher on seem very slow to me. It's hard to find a video that is the right speed for everyone so if you have to choose that does make the most sense for the most people.

Cheers,

Jake

Jacob,

yeah man, and if you're at that level where some of theses classes are kinda on the slow side especially AJAX, I'd look into working with the fetch() API. Native JS and it's pretty awesome.

You totally have a valid point, and these discussions need to be discussed. and even when using jQuery const and let is a must for me as well as most people who write JS.

I'd say probably not. It would mean they would have to refactor all their code challenges, to allow let and const and arrow functions, and ect. to be accepted as correct answers. If someone is starting out in JS for the first time, I would assume for learning purposes to keep it clean and simple, ie. var and brackets as syntax. The higher level you go, the new syntax should be applied. It would be nice to see a reworked OOP JS course with es6, and so on.

Side note though, there is a es6 course that will accept es6 syntax.

My advice is to use WorkSpaces and try the challenges there. You will be able out put the correct answer and use es6.