Search code examples
javascriptecmascript-6ecmascript-5

Confused about ecma/es5, ecma/es6. How do i know what my codebase is?


I'm a bit confused about the whole "javascript version" in general. How do i know what version is supported by what browser, and how do i know what my framework (in example stenciljs) outputs? How can i check if an existing, minified file is ecma5 or ecma6?

Thanks


Solution

  • It is not about language version, it's about language features which comes from ECMAscript specification.

    You can check JS features supported by browsers on caniuse or kangax's table

    When it comes about libraries they often write about browser support.

    For example, Stencil does, React does

    Also there are tools like Babel which are created for for code transpilation. It means that we can put ES-next code to babel, specify target browsers, for example IE11. And it returns code which is able to run in older environments. But not all features may be transpilated.