You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/1-getting-started/2-es-modern-now/article.md
+10-4Lines changed: 10 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,8 +5,14 @@ The [latest standard](http://www.ecma-international.org/publications/standards/E
5
5
6
6
As it includes a lot of new features, most browsers implement them partially. You can find the current state of the support at [](https://kangax.github.io/compat-table/es6/).
7
7
8
+
## Single-engine app
9
+
8
10
If a project is developed for a single JavaScript engine, like V8 (Node.JS, Chrome), then we can use V8-supported features. That's a lot.
9
11
12
+
Most notably, V8 supports many of the new features only if the code is running in the "strict mode" (modern mode), which should be enabled explicitly using a directive `'use strict';` at the start.
13
+
14
+
You will find most code in this tutorial using this directive and, because of that, runnable in Chrome.
15
+
10
16
But what if we're writing a cross-browser application? Different browsers support different subsets of ES-2015.
11
17
12
18
Here comes Babel.JS.
@@ -68,13 +74,13 @@ That doesn't mean that the example is wrong! It's just the browser lacking the s
68
74
69
75
[Chrome Canary](https://www.google.com/chrome/browser/canary.html) is recommended, most examples work in it.
70
76
71
-
[Firefox Developer Edition](https://www.mozilla.org/en-US/firefox/channel/#developer) is fine too, but it has certain glitches. Like: [let](/let-const) variables working only with when the script type contains `version=1.7` or `1.8`: `<script type="application/javascript;version=1.7">`. Most other browsers do not understand such script type. This site uses a special trick to workaround.
77
+
[Firefox Developer Edition](https://www.mozilla.org/en-US/firefox/channel/#developer) is fine too, but it has certain glitches. Like: [let](/let-const) variables working only with when the script type contains `version=1.7` or `1.8`: `<script type="application/javascript;version=1.7">`. Most other browsers do not understand such script type. This site uses a special trick to workaround that, so that the scripts work in both Firefox and other browsers.
72
78
73
-
And in any case you can go [Babel: try it out](https://babeljs.io/repl/) page and run the example there!
79
+
And even if your browser does not support some code, you can run it through Babel.JS, on the page [Babel: try it out](https://babeljs.io/repl/)!
74
80
75
-
On production everyone's using Babel anyway.
81
+
That would be fine, because on production everyone's using Babel anyway.
76
82
77
83
Once again, let's note that the most up-to-date situation with support is reflected on [](https://kangax.github.io/compat-table/es6/).
78
84
79
-
Now we can go coding, but we need a good code editor for that, right? That is discussed in the next session.
85
+
Now we can go coding, but we need a good code editor for that. That is discussed in the next session.
0 commit comments