From 1d236fddf8841d7ddcdf252ab3b2439aeb8ccdca Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Fri, 25 Sep 2015 13:56:55 +0200 Subject: [PATCH] var -> et --- .../2-es-modern-now/article.md | 14 +- .../11-uibasic/1-simple-page/solution.md | 6 +- 1-js/2-first-steps/11-uibasic/article.md | 8 +- .../2-check-standard/ifelse_task2/index.html | 6 +- .../12-ifelse/3-sign/if_sign/index.html | 6 +- .../12-ifelse/3-sign/solution.md | 2 +- .../12-ifelse/4-check-login/solution.md | 4 +- .../6-rewrite-if-else-question/solution.md | 2 +- .../6-rewrite-if-else-question/task.md | 2 +- 1-js/2-first-steps/12-ifelse/article.md | 28 ++-- 1-js/2-first-steps/13-logical-ops/article.md | 24 +-- .../1-loop-last-value/solution.md | 4 +- .../15-while-for/1-loop-last-value/task.md | 2 +- .../2-which-value-while/solution.md | 4 +- .../15-while-for/2-which-value-while/task.md | 4 +- .../3-which-value-for/solution.md | 6 +- .../15-while-for/3-which-value-for/task.md | 6 +- .../15-while-for/4-for-even/solution.md | 2 +- .../5-replace-for-while/solution.md | 2 +- .../15-while-for/5-replace-for-while/task.md | 2 +- .../6-repeat-until-correct/solution.md | 4 +- .../15-while-for/7-list-primes/solution.md | 4 +- 1-js/2-first-steps/15-while-for/article.md | 40 ++--- .../16-switch/2-rewrite-if-switch/solution.md | 2 +- .../16-switch/2-rewrite-if-switch/task.md | 2 +- 1-js/2-first-steps/16-switch/article.md | 12 +- .../18-function-basics/4-pow/solution.md | 8 +- .../18-function-basics/article.md | 32 ++-- .../article.md | 32 ++-- .../2-external-script/article.md | 2 +- .../20-recursion/1-sum-to/solution.md | 6 +- .../3-fibonacci-numbers/solution.md | 10 +- 1-js/2-first-steps/20-recursion/article.md | 4 +- .../21-named-function-expression/article.md | 16 +- .../22-javascript-specials/article.md | 32 ++-- .../5-variables/1-hello-variables/solution.md | 2 +- .../2-declare-variables/solution.md | 4 +- 1-js/2-first-steps/5-variables/article.md | 138 +++++++++--------- 1-js/2-first-steps/7-types/article.md | 38 ++--- .../8-operators/1-increment-order/solution.md | 2 +- .../8-operators/1-increment-order/task.md | 2 +- .../2-assignment-result/solution.md | 4 +- .../8-operators/2-assignment-result/task.md | 4 +- 1-js/2-first-steps/8-operators/article.md | 58 ++++---- 1-js/2-first-steps/9-comparison/article.md | 8 +- 45 files changed, 305 insertions(+), 295 deletions(-) diff --git a/1-js/1-getting-started/2-es-modern-now/article.md b/1-js/1-getting-started/2-es-modern-now/article.md index c582b2de..31913d72 100644 --- a/1-js/1-getting-started/2-es-modern-now/article.md +++ b/1-js/1-getting-started/2-es-modern-now/article.md @@ -5,8 +5,14 @@ The [latest standard](http://www.ecma-international.org/publications/standards/E 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/). +## Single-engine app + 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. +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. + +You will find most code in this tutorial using this directive and, because of that, runnable in Chrome. + But what if we're writing a cross-browser application? Different browsers support different subsets of ES-2015. 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 [Chrome Canary](https://www.google.com/chrome/browser/canary.html) is recommended, most examples work in it. -[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`: ` diff --git a/1-js/2-first-steps/11-uibasic/article.md b/1-js/2-first-steps/11-uibasic/article.md index 381e2cd7..0ba8975b 100644 --- a/1-js/2-first-steps/11-uibasic/article.md +++ b/1-js/2-first-steps/11-uibasic/article.md @@ -45,7 +45,7 @@ As with `alert`, the `prompt` window is modal. ```js //+ run -var age = prompt('How old are you?', 100); +let age = prompt('How old are you?', 100); alert(`You are ${age} years old!`) ``` @@ -57,14 +57,14 @@ Run this code in Internet Explorer to see that: ```js //+ run -var test = prompt("Test"); +let test = prompt("Test"); ``` So, to look good in IE, it's recommended to always provide the second argument: ```js //+ run -var test = prompt("Test", ''); // <-- for IE +let test = prompt("Test", ''); // <-- for IE ``` [/warn] @@ -85,7 +85,7 @@ For example: ```js //+ run -var isBoss = confirm("Are you the boss?"); +let isBoss = confirm("Are you the boss?"); alert( isBoss ); // true is OK is pressed ``` diff --git a/1-js/2-first-steps/12-ifelse/2-check-standard/ifelse_task2/index.html b/1-js/2-first-steps/12-ifelse/2-check-standard/ifelse_task2/index.html index b6e3b589..52a68f1d 100644 --- a/1-js/2-first-steps/12-ifelse/2-check-standard/ifelse_task2/index.html +++ b/1-js/2-first-steps/12-ifelse/2-check-standard/ifelse_task2/index.html @@ -3,7 +3,9 @@