I am curious to understand/figure-out if the ECMAScript-6 new-changes will work on the old browsers or not.
Why I am asking this question is:
I remember the introduction of 'use strict';
in ECMAScript-5, it was meant for the compatibility with the old versions.
That means the old browsers will keep working fine and they will just ignore it when they encounter the 'use strict';
statement while parsing the new JavaScript code.
And the new JS-engines will treat the statement 'use strict';
in some special way as detailed here Strict mode.
So, coming to the question
I seriously doubt and curious to know how would the ECMAScript-5 compliant browsers behave when they will parse the ECMAScript-6 code.
The reason for my doubt is ECMAScript-6 new features involve syntax change/updates. And the old browsers which are new-syntax-unaware-engines will start throwing errors when they encounter any of the new syntax from the following
yield[*], Map, Set, WeakMap, function* foo(){}, =>, for...of etc.
My concern is has the decision/inclusion of new features in ECMAScript-6 taken care of supporting the old-browsers without any break of code?
If Yes then how?
If Not then what should I do to keep my old-browser-users happy?
I see one solution to keep the users using old browsers happy by including some transpiler like traceur-compiler in my project. This will convert my ECMAScript-6 code to ECMAScript-5 equivalent. But do I have any other solution to keep my old-browser-users happy?
See Question&Answers more detail:os