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 JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Create an Array

treehouse doesn't support --- let --- ???!

let data = [1,2,3]

script.js
let data = [1,2,3]
index.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

only reason it's annoying is i'm fairly used to this approach vs var in my daily work ... just wondering if babel or full js latest standards are on the roadmap to be supported in code challenges/quizes/etc???

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,545 Points

Hey Samuel,

I'm going to guess that it is because (according to the MDN Documentation) there is no support with any currently available major browser. To be honest, I have never used let nor have I seen it used in JavaScript. :confused:

:dizzy:

Seth Kroger
Seth Kroger
56,392 Points

let works perfectly well in modern browsers (it's some proposed extra features that have no support). Older IE's are still a problem, of course. But let's face it (sorry...), so much code is written with var, it's not going away anytime soon.

I find that very odd, the reason for not using 'let' is curious to me atleast in the context of not using 'const'... I've learned to stop using 'var' in all situations in favor of using one of the previously mentioned options. I'm sure 'var' may still have a use case in 2016 but I am unaware of it. Can you please explain the reasoning... has it been a while since you have worked in js then?

I should note all my work has 'babel' so I'm not trying to question the browser/language support only the fact that treehouse appears to not support it.

Mikis Woodwinter
Mikis Woodwinter
44,941 Points

Really? Three question-marks and an exclamation point? Even NodeJS only "supports" let in strict-mode ... No browsers currently support it ... you even admit to needing an ES6 transpiler to use it... why then would you expect Treehouse to support it? The const spec, on the other hand, is almost-fully implemented in all major runtimes; you should try to use that whenever you can.

I understand your reasoning, on the other hand I would hope that my point would hold weight in your mind as well. As far as I know there is no downside to getting used to using something like 'babel' which when you think about the movement on the tc39 committee should make sense. It's not even the lack of support for 'let' it's that now I have to think what else isn't supported.... Therein lies my issue as I don't want to be trying to go backwards. Thank you for the quick replies and answers to my questions as well.