3 ms·
Thanks for the answer. I was not doubting the survey methodology or results. My question was simply out of curiosity. I would like to request more details on y
by foo101 10y ago
Thanks for the answer. I was not doubting the survey methodology or results. My question was simply out of curiosity.
I would like to request more details on your answer.
1. What kind of ES6 requires transpiling to ES5. I mean, I once tried using Promise and something like Promise.resolve("foo") works just fine. Are there any ES6 constructs that would require transpiling, to work fine on, say, Chrome or Firefox?
2. Is ES6 not completely backward compatible with ES5? If yes, I would consider ES6 as the same (although upgraded version of) language as ES5. If no (e.g. Python 2 vs. Python 3), then it would be justified to consider ES6 to be different from ES5. What's your opinion?
Disclaimer: I am not a JavaScript developer. I am a system programmer. But I do a little bit of web-designing once in a while, for example, to maintain my blog etc. That's why I would like to understand why ES6 is considered a different language than ES5.
- SiVal 10y agoHere's a little bit for you. Most people prefer the semantics of `let` to `var` for variable declarations in JavaScript. It's how JavaScript should have been designed from the start. It has been officially standard for a year or two and became available in some browsers even earlier. I want to use `let` (and `const`) for everything and never use `var` again, but I couldn't even do that on my own PRIVATE website (for me alone) until today, because I didn't upgrade my iPhone to iOS 10 until last night, and iOS Safari never supported `let` (or arrow functions or so many other things) before v10 (and Apple won't allow anyone to break their browser monopoly on their platform). I could just use Android, but I can't switch everyone else to Android, and LOTS of Android and Windows (and even Mac) users are stuck with even older browsers, because they don't know how to (or can't) upgrade. Are there any ES6 constructs that would require transpiling, to work fine on, say, Chrome or Firefox? Not on the latest Chrome or Firefox, but that hardly matters in a world where so many people aren't using the latest Chrome or Firefox. The question for a developer is not whether some in their market can run their software but whether some CAN'T. Is ES6 not completely backward compatible with ES5? It is (in practice) completely backward compatible, but I suspect you are a little confused about what that means. It doesn't mean "forward compatible". Backward compatible means that a new ES6 browser is still compatible with old ES5 code, which it is. Old ES5 code will keep working. It does NOT mean that my new ES6 code, full of `let` and arrow functions will run in an old ES5-only browser, and there are still plenty of them out there. As long as you choose to target a market that includes ES5-only browsers (and you may or may not, but if you do), the things that are new in ES6 (Google "what's new in ES6") have to be transpiled to ES5 to run in ES5-only browsers.
- Roboprog 10y agoI get "const", but is "let" really that big a deal? Are your functions so deeply nested that you need block scope inside of if statements and for loops? (vs forEach callbacks or IIFE blocks or simply splitting complicated stuff into smaller functions) There is some cool stuff in ES6, but "let" is kind of a yawn, and "class" most definitely is NOT something I really needed. But I'm still running ES5 on IE11 at work, so it's academic :-(
- Aldo_MX 10y agoSometimes you just need to do something the old way: let element = document.getElementById('some-element'); while (element) { // do something element = element.parentElement; } let doesn't get in the way with behavior such as hoisting, and the code will break if you redeclare a variable.
- Roboprog 10y agoHow does var/hoisting get in the way of that, or at least, that particular, construct? FWIW, that would also be a nice "for" loop :-) var el for ( el = document.getElement... ; el ; el = el.parentElement ) { // do something }