Thanks. I searched more on Google and ES6 seems to be recommended more often. My confusion comes from these two udemy courses - course1 and course2. The same instructor has created two courses, one on JS and the other on ES6 JS. I don't know why he'd have two courses. Probably the JS one is for working with browsers and the ES6 one is mainly for working with node js and such, besides browsers.
Bear Bibeault wrote:What does your test automation engine support?
Tom Joe wrote:I don't know why he'd have two courses. Probably the JS one is for working with browsers and the ES6 one is mainly for working with node js and such, besides browsers.
As Steven pointed out, broad browser support requires ES5 -- so if you are writing a basic web app that will use jQuery or other legacy tools, and don't want to deal with a build toolchain, you'd learn and use ES5.
However, modern web apps use ES6 (or TypeScript) and employ a transpiler to convert ES6 to ES5 for the legacy browsers. So ES6 is not limited to the NodeJS environment, but is widely used for browser web apps as well.
It all depends whether you want to be up-to-date with modern tooling, or write code as if it were still 2012.
Then ES6. The most widely used transpiler is Babel. It is usually used with webpack (or other bundler) to create a build toolchain.