because I am always afraid of size of my js files, their performances and browsers compatibility. I understand that features of ES6 and TypeScript can possibly ease development but I am unsure to take this road because I don't know if transpiling my code will make it work 100% on older browsers and if size and performance gets negatively affected.
Is it better for me to master just ES5?
> I don't know if transpiling my code will make it work 100% on older browsers Babeling will transpile such that the JavaScript will work in older browsers, but you will need to polyfill APIs like Promise, Map, Symbol — those that aren't available in older browsers. There's a Babel plugin for this iirc. > Is it better for me to master just ES5? I don't think so, going forward we're getting newer language features, and you'll be left behind. > Right now each of my js file takes like 1-2 KB, sometimes 10 KB If your JS is generally small, you may not need to worry at the moment, but picking up newer JavaScript features will be useful in the long run. Notwithstanding, JavaScript will continue to support everything it had since ES1
I'm a big fan of writing as close to your target as possible, so if I'm writing for web browsers, I'll wait to use a feature until every browser I NEED to support can use it natively. Life's too short for transpiling a dynamic language if you don't need to :D
Обсуждают сегодня