5 ms·
Should one learn ES2015 before learning ES5? Is there any value or need to learn ES5 if you're not maintaining an old codebase?
by jchien17 9y ago
Should one learn ES2015 before learning ES5? Is there any value or need to learn ES5 if you're not maintaining an old codebase?
- pspeter3 9y agoNot all browsers support ES2015 so knowing ES5 first is helpful.
- EduardoBautista 9y agoExcept on almost any serious project you should be using a transpiler anyways.
- nawtacawp 9y agotranspiler?
- yunyu 9y agoConverts modern JavaScript to ES5
- tannhauser23 9y agoIt converts your ES6 code into Javascript that can run on all browsers. It's how you can get advanced Javascript features before the browsers fully implement them. Look up Babel.
- tasty_freeze 9y agoIt is a portmanteau of translater + compiler
- pspeter3 9y agoAgreed, but I find it helpful to understand the transpiled code. The "clean" ES5 output was a large reason for using TypeScript https://blog.asana.com/2014/11/asana-switching-typescript/ https://blog.asana.com/2014/11/asana-switching-typescript/
- jeremy_wiebe 9y agoI agree to an extent, but any modern transpired should also emit source maps which should shield most people from needing to look st or understand the "low level" generated code.
- nailer 9y agoAll current browsers support ES2017. If supporting IE or out of date mobile devices is worth your time (it might be, it might not be - consider CSS grid won't work, flexbox won't work, webcrypto won't work, HTML5 clipboard won't work, and you'll need double the time to deal with them and their awful devtools) transpiling is a good option.
- z3t4 9y agoIt's the same language. ES2015 is just syntax "sugar" for doing the same thing, it's mostly opinionated and for convenience. So I suggest both looking at the old style and the new style and write your code in a way that make most sense to you! Then when you join a company, there will be style guides and "linters" to enforce it. But if you have to choose, start with the old style because that's how JavaScript have been looking like for 15 years and a lot of code looks like that. Also I'm not a big fan of "trans-pilers".
- beeandapenguin 9y agoIf they are writing in Node, I'd say there's no need to learn ES5 as they should be using a node version with LTS. If they are writing JS in the browser? Then yes, they should learn ES5 as it's quite likely they will be debugging transpiled code at some point.