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 144,349 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
Treehouse Moderator 56,261 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.

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.