From 833f7ba70e38b6b780e578511443b292425e62ad Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Tue, 7 Apr 2015 15:22:06 +0300 Subject: [PATCH] final cleanup regexps --- 1-js/1-getting-started/1-intro/article.md | 4 +- .../10-arguments-pseudoarray/article.md | 132 ++++++------- .../5-class-inheritance/article.md | 2 +- .../class-inheritance-rabbit-run-animal.svg | 2 +- 1-js/9-prototypes/7-oop-errors/article.md | 116 ++++++++---- 1-js/9-prototypes/8-mixins/article.md | 174 ++++++++++++++++++ .../1-regexp-introduction/article.md | 0 .../1-start-end/solution.md | 0 .../10-regexp-ahchors}/1-start-end/task.md | 0 .../10-regexp-ahchors/2-test-mac/solution.md | 21 +++ .../10-regexp-ahchors/2-test-mac/task.md | 20 ++ .../10-regexp-ahchors}/article.md | 0 .../11-regexp-multiline-mode}/article.md | 0 .../12-regexp-lookahead/article.md | 4 + .../article.md | 0 .../bad_backtrack_greedy1.png | Bin .../bad_backtrack_greedy11.png | Bin .../bad_backtrack_greedy2.png | Bin .../bad_backtrack_greedy3.png | Bin .../bad_backtrack_greedy4.png | Bin .../bad_backtrack_greedy5.png | Bin .../2-regexp-methods/article.md | 0 .../1-find-time-hh-mm/solution.md | 0 .../1-find-time-hh-mm/task.md | 0 .../3-regexp-character-classes/article.md | 0 .../hello-java-boundaries.svg | 0 .../love-html5-classes.svg | 0 .../1-find-range-1/solution.md | 0 .../1-find-range-1/task.md | 0 .../2-find-time-2-formats/solution.md | 0 .../2-find-time-2-formats/task.md | 2 +- .../article.md | 0 .../1-find-text-manydots/solution.md | 0 .../1-find-text-manydots/task.md | 0 .../2-find-html-colors-6hex/solution.md | 0 .../2-find-html-colors-6hex/task.md | 0 .../solution.md | 0 .../3-find-decimal-positive-numbers/task.md | 0 .../4-find-decimal-numbers/solution.md | 0 .../4-find-decimal-numbers/task.md | 0 .../5-regexp-quantifiers}/article.md | 0 .../1-lazy-greedy/solution.md | 0 .../1-lazy-greedy/task.md | 0 .../2-difference-find-quote/solution.md | 0 .../2-difference-find-quote/task.md | 0 .../3-find-html-comments/solution.md | 0 .../3-find-html-comments/task.md | 0 .../4-find-html-tags-greedy-lazy/solution.md | 0 .../4-find-html-tags-greedy-lazy/task.md | 0 .../6-regexp-greedy-and-lazy}/article.md | 0 .../witch_greedy1.svg | 0 .../witch_greedy2.svg | 0 .../witch_greedy3.svg | 0 .../witch_greedy4.svg | 0 .../witch_greedy5.svg | 0 .../witch_greedy6.svg | 0 .../6-regexp-greedy-and-lazy}/witch_lazy3.svg | 0 .../6-regexp-greedy-and-lazy}/witch_lazy4.svg | 0 .../6-regexp-greedy-and-lazy}/witch_lazy5.svg | 0 .../6-regexp-greedy-and-lazy}/witch_lazy6.svg | 0 .../1-find-webcolor-3-or-6/solution.md | 0 .../1-find-webcolor-3-or-6/task.md | 0 .../2-parse-expression/solution.md | 0 .../2-parse-expression/task.md | 0 .../7-regexp-groups}/article.md | 0 .../7-regexp-groups}/regexp-nested-groups.svg | 0 .../1-find-matching-bbtags/solution.md | 0 .../1-find-matching-bbtags/task.md | 0 .../8-regexp-backreferences}/article.md | 0 .../1-find-programming-language/solution.md | 0 .../1-find-programming-language/task.md | 0 .../2-match-quoted-string/solution.md | 0 .../2-match-quoted-string/task.md | 0 .../3-match-exact-tag/solution.md | 18 ++ .../3-match-exact-tag/task.md | 14 ++ .../9-regexp-alternation}/article.md | 0 .../index.md | 2 +- {10-extra => 11-extra}/10-cookie/article.md | 0 {10-extra => 11-extra}/10-cookie/cookie.js | 0 .../10-cookie/safari-nocookie.png | Bin .../10-cookie/safari-nocookie@2x.png | Bin .../11-intl/1-collate-array-sort/solution.md | 0 .../11-intl/1-collate-array-sort/task.md | 0 {10-extra => 11-extra}/11-intl/article.md | 0 .../12-regexp-specials/article.md | 0 {10-extra => 11-extra}/3-templates/article.md | 0 {10-extra => 11-extra}/4-books/article.md | 0 .../5-setimmediate}/article.md | 0 .../setimmediate.view}/index.html | 0 .../setimmediate.view}/setImmediate.js | 0 {10-extra => 11-extra}/6-bind-late/article.md | 0 {10-extra => 11-extra}/7-sublime/article.md | 0 {10-extra => 11-extra}/7-sublime/sheet.pdf | Bin .../8-range-textrange-selection/56.gif | Bin .../8-range-textrange-selection/57.gif | Bin .../8-range-textrange-selection/58.gif | Bin .../8-range-textrange-selection/article.md | 0 .../domRangeCreate.view/index.html | 0 .../domRangeHighlight.view/index.html | 0 .../fix-ie.view/fixIERangeObject.js | 0 .../fix-ie.view/index.html | 0 .../ieTextRangeHighlight.view/index.html | 0 .../setSelection.view/index.html | 0 .../9-drag-and-drop-plus/DragAvatar.js | 0 .../9-drag-and-drop-plus/DragManager.js | 0 .../9-drag-and-drop-plus/DragZone.js | 0 .../9-drag-and-drop-plus/DropTarget.js | 0 .../9-drag-and-drop-plus/TreeDragAvatar.js | 0 .../9-drag-and-drop-plus/TreeDragZone.js | 0 .../9-drag-and-drop-plus/TreeDropTarget.js | 0 .../9-drag-and-drop-plus/article.md | 0 .../dragTree.view/DragAvatar.js | 0 .../dragTree.view/DragManager.js | 0 .../dragTree.view/DragZone.js | 0 .../dragTree.view/DropTarget.js | 0 .../dragTree.view/TreeDragAvatar.js | 0 .../dragTree.view/TreeDragZone.js | 0 .../dragTree.view/TreeDropTarget.js | 0 .../dragTree.view/dragTree.css | 0 .../dragTree.view/index.html | 0 .../9-drag-and-drop-plus/dragTree.view/lib.js | 0 .../9-drag-and-drop-plus/dragzonetarget.png | Bin {10-extra => 11-extra}/index.md | 0 .../15-regexp-word-boundary/article.md | 69 ------- .../15-regexp-word-boundary/boundary1.png | Bin 1058 -> 0 bytes .../15-regexp-word-boundary/boundary2.png | Bin 2445 -> 0 bytes .../15-regexp-word-boundary/boundary3.png | Bin 2351 -> 0 bytes .../15-regexp-word-boundary/boundary4.png | Bin 2447 -> 0 bytes .../16-regexp-todo/article.md | 5 - .../18-regexp-orphans/article.md | 5 - 2-ui/1-document/4-traversing-dom/article.md | 3 +- figures.sketch | Bin 8953856 -> 8953856 bytes 132 files changed, 410 insertions(+), 183 deletions(-) create mode 100644 1-js/9-prototypes/8-mixins/article.md rename {11-regular-expressions-javascript => 10-regular-expressions-javascript}/1-regexp-introduction/article.md (100%) rename {11-regular-expressions-javascript/13-regexp-ahchors => 10-regular-expressions-javascript/10-regexp-ahchors}/1-start-end/solution.md (100%) rename {11-regular-expressions-javascript/13-regexp-ahchors => 10-regular-expressions-javascript/10-regexp-ahchors}/1-start-end/task.md (100%) create mode 100644 10-regular-expressions-javascript/10-regexp-ahchors/2-test-mac/solution.md create mode 100644 10-regular-expressions-javascript/10-regexp-ahchors/2-test-mac/task.md rename {11-regular-expressions-javascript/13-regexp-ahchors => 10-regular-expressions-javascript/10-regexp-ahchors}/article.md (100%) rename {11-regular-expressions-javascript/14-regexp-multiline-mode => 10-regular-expressions-javascript/11-regexp-multiline-mode}/article.md (100%) create mode 100644 10-regular-expressions-javascript/12-regexp-lookahead/article.md rename {11-regular-expressions-javascript/17-regexp-infinite-backtracking-problem => 10-regular-expressions-javascript/13-regexp-infinite-backtracking-problem}/article.md (100%) rename {11-regular-expressions-javascript/17-regexp-infinite-backtracking-problem => 10-regular-expressions-javascript/13-regexp-infinite-backtracking-problem}/bad_backtrack_greedy1.png (100%) rename {11-regular-expressions-javascript/17-regexp-infinite-backtracking-problem => 10-regular-expressions-javascript/13-regexp-infinite-backtracking-problem}/bad_backtrack_greedy11.png (100%) rename {11-regular-expressions-javascript/17-regexp-infinite-backtracking-problem => 10-regular-expressions-javascript/13-regexp-infinite-backtracking-problem}/bad_backtrack_greedy2.png (100%) rename {11-regular-expressions-javascript/17-regexp-infinite-backtracking-problem => 10-regular-expressions-javascript/13-regexp-infinite-backtracking-problem}/bad_backtrack_greedy3.png (100%) rename {11-regular-expressions-javascript/17-regexp-infinite-backtracking-problem => 10-regular-expressions-javascript/13-regexp-infinite-backtracking-problem}/bad_backtrack_greedy4.png (100%) rename {11-regular-expressions-javascript/17-regexp-infinite-backtracking-problem => 10-regular-expressions-javascript/13-regexp-infinite-backtracking-problem}/bad_backtrack_greedy5.png (100%) rename {11-regular-expressions-javascript => 10-regular-expressions-javascript}/2-regexp-methods/article.md (100%) rename {11-regular-expressions-javascript => 10-regular-expressions-javascript}/3-regexp-character-classes/1-find-time-hh-mm/solution.md (100%) rename {11-regular-expressions-javascript => 10-regular-expressions-javascript}/3-regexp-character-classes/1-find-time-hh-mm/task.md (100%) rename {11-regular-expressions-javascript => 10-regular-expressions-javascript}/3-regexp-character-classes/article.md (100%) rename {11-regular-expressions-javascript => 10-regular-expressions-javascript}/3-regexp-character-classes/hello-java-boundaries.svg (100%) rename {11-regular-expressions-javascript => 10-regular-expressions-javascript}/3-regexp-character-classes/love-html5-classes.svg (100%) rename {11-regular-expressions-javascript/5-regexp-character-sets-and-ranges => 10-regular-expressions-javascript/4-regexp-character-sets-and-ranges}/1-find-range-1/solution.md (100%) rename {11-regular-expressions-javascript/5-regexp-character-sets-and-ranges => 10-regular-expressions-javascript/4-regexp-character-sets-and-ranges}/1-find-range-1/task.md (100%) rename {11-regular-expressions-javascript/5-regexp-character-sets-and-ranges => 10-regular-expressions-javascript/4-regexp-character-sets-and-ranges}/2-find-time-2-formats/solution.md (100%) rename {11-regular-expressions-javascript/5-regexp-character-sets-and-ranges => 10-regular-expressions-javascript/4-regexp-character-sets-and-ranges}/2-find-time-2-formats/task.md (87%) rename {11-regular-expressions-javascript/5-regexp-character-sets-and-ranges => 10-regular-expressions-javascript/4-regexp-character-sets-and-ranges}/article.md (100%) rename {11-regular-expressions-javascript/7-regexp-quantifiers => 10-regular-expressions-javascript/5-regexp-quantifiers}/1-find-text-manydots/solution.md (100%) rename {11-regular-expressions-javascript/7-regexp-quantifiers => 10-regular-expressions-javascript/5-regexp-quantifiers}/1-find-text-manydots/task.md (100%) rename {11-regular-expressions-javascript/7-regexp-quantifiers => 10-regular-expressions-javascript/5-regexp-quantifiers}/2-find-html-colors-6hex/solution.md (100%) rename {11-regular-expressions-javascript/7-regexp-quantifiers => 10-regular-expressions-javascript/5-regexp-quantifiers}/2-find-html-colors-6hex/task.md (100%) rename {11-regular-expressions-javascript/7-regexp-quantifiers => 10-regular-expressions-javascript/5-regexp-quantifiers}/3-find-decimal-positive-numbers/solution.md (100%) rename {11-regular-expressions-javascript/7-regexp-quantifiers => 10-regular-expressions-javascript/5-regexp-quantifiers}/3-find-decimal-positive-numbers/task.md (100%) rename {11-regular-expressions-javascript/7-regexp-quantifiers => 10-regular-expressions-javascript/5-regexp-quantifiers}/4-find-decimal-numbers/solution.md (100%) rename {11-regular-expressions-javascript/7-regexp-quantifiers => 10-regular-expressions-javascript/5-regexp-quantifiers}/4-find-decimal-numbers/task.md (100%) rename {11-regular-expressions-javascript/7-regexp-quantifiers => 10-regular-expressions-javascript/5-regexp-quantifiers}/article.md (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/1-lazy-greedy/solution.md (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/1-lazy-greedy/task.md (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/2-difference-find-quote/solution.md (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/2-difference-find-quote/task.md (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/3-find-html-comments/solution.md (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/3-find-html-comments/task.md (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/4-find-html-tags-greedy-lazy/solution.md (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/4-find-html-tags-greedy-lazy/task.md (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/article.md (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/witch_greedy1.svg (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/witch_greedy2.svg (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/witch_greedy3.svg (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/witch_greedy4.svg (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/witch_greedy5.svg (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/witch_greedy6.svg (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/witch_lazy3.svg (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/witch_lazy4.svg (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/witch_lazy5.svg (100%) rename {11-regular-expressions-javascript/8-regexp-greedy-and-lazy => 10-regular-expressions-javascript/6-regexp-greedy-and-lazy}/witch_lazy6.svg (100%) rename {11-regular-expressions-javascript/9-regexp-groups => 10-regular-expressions-javascript/7-regexp-groups}/1-find-webcolor-3-or-6/solution.md (100%) rename {11-regular-expressions-javascript/9-regexp-groups => 10-regular-expressions-javascript/7-regexp-groups}/1-find-webcolor-3-or-6/task.md (100%) rename {11-regular-expressions-javascript/9-regexp-groups => 10-regular-expressions-javascript/7-regexp-groups}/2-parse-expression/solution.md (100%) rename {11-regular-expressions-javascript/9-regexp-groups => 10-regular-expressions-javascript/7-regexp-groups}/2-parse-expression/task.md (100%) rename {11-regular-expressions-javascript/9-regexp-groups => 10-regular-expressions-javascript/7-regexp-groups}/article.md (100%) rename {11-regular-expressions-javascript/9-regexp-groups => 10-regular-expressions-javascript/7-regexp-groups}/regexp-nested-groups.svg (100%) rename {11-regular-expressions-javascript/10-regexp-backreferences => 10-regular-expressions-javascript/8-regexp-backreferences}/1-find-matching-bbtags/solution.md (100%) rename {11-regular-expressions-javascript/10-regexp-backreferences => 10-regular-expressions-javascript/8-regexp-backreferences}/1-find-matching-bbtags/task.md (100%) rename {11-regular-expressions-javascript/10-regexp-backreferences => 10-regular-expressions-javascript/8-regexp-backreferences}/article.md (100%) rename {11-regular-expressions-javascript/12-regexp-alternation => 10-regular-expressions-javascript/9-regexp-alternation}/1-find-programming-language/solution.md (100%) rename {11-regular-expressions-javascript/12-regexp-alternation => 10-regular-expressions-javascript/9-regexp-alternation}/1-find-programming-language/task.md (100%) rename {11-regular-expressions-javascript/12-regexp-alternation => 10-regular-expressions-javascript/9-regexp-alternation}/2-match-quoted-string/solution.md (100%) rename {11-regular-expressions-javascript/12-regexp-alternation => 10-regular-expressions-javascript/9-regexp-alternation}/2-match-quoted-string/task.md (100%) create mode 100644 10-regular-expressions-javascript/9-regexp-alternation/3-match-exact-tag/solution.md create mode 100644 10-regular-expressions-javascript/9-regexp-alternation/3-match-exact-tag/task.md rename {11-regular-expressions-javascript/12-regexp-alternation => 10-regular-expressions-javascript/9-regexp-alternation}/article.md (100%) rename {11-regular-expressions-javascript => 10-regular-expressions-javascript}/index.md (64%) rename {10-extra => 11-extra}/10-cookie/article.md (100%) rename {10-extra => 11-extra}/10-cookie/cookie.js (100%) rename {10-extra => 11-extra}/10-cookie/safari-nocookie.png (100%) rename {10-extra => 11-extra}/10-cookie/safari-nocookie@2x.png (100%) rename {10-extra => 11-extra}/11-intl/1-collate-array-sort/solution.md (100%) rename {10-extra => 11-extra}/11-intl/1-collate-array-sort/task.md (100%) rename {10-extra => 11-extra}/11-intl/article.md (100%) rename {10-extra => 11-extra}/12-regexp-specials/article.md (100%) rename {10-extra => 11-extra}/3-templates/article.md (100%) rename {10-extra => 11-extra}/4-books/article.md (100%) rename {10-extra/5-setImmediate => 11-extra/5-setimmediate}/article.md (100%) rename {10-extra/5-setImmediate/setImmediate.view => 11-extra/5-setimmediate/setimmediate.view}/index.html (100%) rename {10-extra/5-setImmediate/setImmediate.view => 11-extra/5-setimmediate/setimmediate.view}/setImmediate.js (100%) rename {10-extra => 11-extra}/6-bind-late/article.md (100%) rename {10-extra => 11-extra}/7-sublime/article.md (100%) rename {10-extra => 11-extra}/7-sublime/sheet.pdf (100%) rename {10-extra => 11-extra}/8-range-textrange-selection/56.gif (100%) rename {10-extra => 11-extra}/8-range-textrange-selection/57.gif (100%) rename {10-extra => 11-extra}/8-range-textrange-selection/58.gif (100%) rename {10-extra => 11-extra}/8-range-textrange-selection/article.md (100%) rename {10-extra => 11-extra}/8-range-textrange-selection/domRangeCreate.view/index.html (100%) rename {10-extra => 11-extra}/8-range-textrange-selection/domRangeHighlight.view/index.html (100%) rename {10-extra => 11-extra}/8-range-textrange-selection/fix-ie.view/fixIERangeObject.js (100%) rename {10-extra => 11-extra}/8-range-textrange-selection/fix-ie.view/index.html (100%) rename {10-extra => 11-extra}/8-range-textrange-selection/ieTextRangeHighlight.view/index.html (100%) rename {10-extra => 11-extra}/8-range-textrange-selection/setSelection.view/index.html (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/DragAvatar.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/DragManager.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/DragZone.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/DropTarget.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/TreeDragAvatar.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/TreeDragZone.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/TreeDropTarget.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/article.md (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/dragTree.view/DragAvatar.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/dragTree.view/DragManager.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/dragTree.view/DragZone.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/dragTree.view/DropTarget.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/dragTree.view/TreeDragAvatar.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/dragTree.view/TreeDragZone.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/dragTree.view/TreeDropTarget.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/dragTree.view/dragTree.css (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/dragTree.view/index.html (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/dragTree.view/lib.js (100%) rename {10-extra => 11-extra}/9-drag-and-drop-plus/dragzonetarget.png (100%) rename {10-extra => 11-extra}/index.md (100%) delete mode 100644 11-regular-expressions-javascript/15-regexp-word-boundary/article.md delete mode 100644 11-regular-expressions-javascript/15-regexp-word-boundary/boundary1.png delete mode 100644 11-regular-expressions-javascript/15-regexp-word-boundary/boundary2.png delete mode 100644 11-regular-expressions-javascript/15-regexp-word-boundary/boundary3.png delete mode 100644 11-regular-expressions-javascript/15-regexp-word-boundary/boundary4.png delete mode 100644 11-regular-expressions-javascript/16-regexp-todo/article.md delete mode 100644 11-regular-expressions-javascript/18-regexp-orphans/article.md diff --git a/1-js/1-getting-started/1-intro/article.md b/1-js/1-getting-started/1-intro/article.md index 9dc5df7d..efa1111c 100644 --- a/1-js/1-getting-started/1-intro/article.md +++ b/1-js/1-getting-started/1-intro/article.md @@ -210,13 +210,13 @@ Adobe Flash -- кросс-браузерная платформа для мул [smart header="ES6 и ES7 прямо сейчас"] Существуют также трансляторы, которые берут код, использующий возможности будущих стандартов JavaScript, и преобразуют его в более старый вариант, который понимают все браузеры. -Например, [6to5](https://6to5.org/). +Например, [babeljs](https://babeljs.io/). Благодаря этому, мы можем использовать многие возможности будущего уже сегодня. [/smart] diff --git a/1-js/4-data-structures/10-arguments-pseudoarray/article.md b/1-js/4-data-structures/10-arguments-pseudoarray/article.md index 8db94177..12bf784e 100644 --- a/1-js/4-data-structures/10-arguments-pseudoarray/article.md +++ b/1-js/4-data-structures/10-arguments-pseudoarray/article.md @@ -268,72 +268,6 @@ function showWarning(width, height, title, contents) { } ``` -### "Именованные аргументы" - -*Именованные аргументы* -- альтернативная техника работы с аргументами, которая вообще не использует `arguments`. - -Некоторые языки программирования позволяют передать параметры как-то так: `f(width=100, height=200)`, то есть по именам, а что не передано, тех аргументов нет. Это очень удобно в тех случаях, когда аргументов много, сложно запомнить их порядок и большинство вообще не надо передавать, по умолчанию подойдёт. - -Такая ситуация часто встречается в компонентах интерфейса. Например, у "меню" может быть масса настроек отображения, которые можно "подкрутить" но обычно нужно передать всего один-два главных параметра, а остальные возьмутся по умолчанию. - -В JavaScript для этих целей используется передача аргументов в виде объекта, а в его свойствах мы передаём параметры. - -Получается так: - -```js -function showWarning(options) { - var width = options.width || 200; // по умолчанию - var height = options.height || 100; - - var title = options.title || "Предупреждение"; - - // ... -} - -showWarning({ -``` - -Вызвать такую функцию очень легко. Достаточно передать объект аргументов, указав в нем только нужные: - -```js -showWarning({ - contents: "Вы вызвали функцию" // и всё понятно! -}); -``` - -Сравним это с передачей аргументов через список: - -```js -showWarning(null, null, "Предупреждение!"); -// мысль программиста "а что это за null, null в начале? ох, надо глядеть описание функции" -``` - -Не правда ли, объект -- гораздо проще и понятнее? - -Еще один бонус кроме красивой записи -- возможность повторного использования объекта аргументов: - -```js -var opts = { - width: 400, - height: 200, - contents: "Текст" -}; - -showWarning(opts); - -opts.contents = "Другой текст"; - -*!* -showWarning(opts); // вызвать с новым текстом, без копирования других аргументов -*/!* -``` - -Именованные аргументы применяются во многих JavaScript-фреймворках. - - - - - ## Устаревшее свойство arguments.callee [#arguments-callee] [warn header="Используйте NFE вместо `arguments.callee`"] @@ -407,6 +341,72 @@ function f3() { В учебнике мы это свойство также не будем использовать. + +## "Именованные аргументы" + +*Именованные аргументы* -- альтернативная техника работы с аргументами, которая вообще не использует `arguments`. + +Некоторые языки программирования позволяют передать параметры как-то так: `f(width=100, height=200)`, то есть по именам, а что не передано, тех аргументов нет. Это очень удобно в тех случаях, когда аргументов много, сложно запомнить их порядок и большинство вообще не надо передавать, по умолчанию подойдёт. + +Такая ситуация часто встречается в компонентах интерфейса. Например, у "меню" может быть масса настроек отображения, которые можно "подкрутить" но обычно нужно передать всего один-два главных параметра, а остальные возьмутся по умолчанию. + +В JavaScript для этих целей используется передача аргументов в виде объекта, а в его свойствах мы передаём параметры. + +Получается так: + +```js +function showWarning(options) { + var width = options.width || 200; // по умолчанию + var height = options.height || 100; + + var title = options.title || "Предупреждение"; + + // ... +} + +showWarning({ +``` + +Вызвать такую функцию очень легко. Достаточно передать объект аргументов, указав в нем только нужные: + +```js +showWarning({ + contents: "Вы вызвали функцию" // и всё понятно! +}); +``` + +Сравним это с передачей аргументов через список: + +```js +showWarning(null, null, "Предупреждение!"); +// мысль программиста "а что это за null, null в начале? ох, надо глядеть описание функции" +``` + +Не правда ли, объект -- гораздо проще и понятнее? + +Еще один бонус кроме красивой записи -- возможность повторного использования объекта аргументов: + +```js +var opts = { + width: 400, + height: 200, + contents: "Текст" +}; + +showWarning(opts); + +opts.contents = "Другой текст"; + +*!* +showWarning(opts); // вызвать с новым текстом, без копирования других аргументов +*/!* +``` + +Именованные аргументы применяются во многих JavaScript-фреймворках. + + + + ## Итого