From eb49340d65e23a12b521dbe0e5033fb1d12ccaff Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Fri, 29 Jul 2016 23:56:40 +0300 Subject: [PATCH] ok --- .../15-function-expressions-arrows/article.md | 6 +- .../1-debugging-chrome/article.md | 0 .../1-debugging-chrome/chrome_break_error.png | Bin .../chrome_break_error@2x.png | Bin .../1-debugging-chrome/chrome_sources.png | Bin .../1-debugging-chrome/chrome_sources@2x.png | Bin .../chrome_sources_break.png | Bin .../chrome_sources_break@2x.png | Bin .../chrome_sources_breakpoint.png | Bin .../chrome_sources_breakpoint@2x.png | Bin .../chrome_sources_buttons.png | Bin .../chrome_sources_buttons@2x.png | Bin .../1-debugging-chrome/console_error.png | Bin .../1-debugging-chrome/console_error@2x.png | Bin .../debugging.view/index.html | 0 .../1-debugging-chrome/debugging.view/pow.js | 0 .../1-debugging-chrome/error.view/index.html | 0 .../1-debugging-chrome/error.view/pow.js | 0 .../1-debugging-chrome/head.html | 0 .../1-debugging-chrome/manage1.png | Bin .../1-debugging-chrome/manage1@2x.png | Bin .../1-debugging-chrome/manage2.png | Bin .../1-debugging-chrome/manage2@2x.png | Bin .../1-debugging-chrome/manage3.png | Bin .../1-debugging-chrome/manage3@2x.png | Bin .../1-debugging-chrome/manage4.png | Bin .../1-debugging-chrome/manage4@2x.png | Bin .../1-debugging-chrome/manage5.png | Bin .../1-debugging-chrome/manage5@2x.png | Bin .../1-debugging-chrome/manage6.png | Bin .../1-debugging-chrome/manage6@2x.png | Bin .../statusbarButtonGlyphs.svg | 0 .../2-coding-style/1-style-errors/solution.md | 0 .../2-coding-style/1-style-errors/task.md | 0 .../2-coding-style/article.md | 0 .../2-coding-style/code-style.png | Bin .../2-coding-style/code-style@2x.png | Bin .../2-coding-style/figure-bracket-style.png | Bin .../figure-bracket-style@2x.png | Bin .../3-write-unmain-code/article.md | 0 .../1-pow-nan-spec/_js.view/solution.js | 0 .../1-pow-nan-spec/_js.view/source.js | 0 .../4-testing/1-pow-nan-spec/_js.view/test.js | 0 .../4-testing/1-pow-nan-spec/solution.md | 0 .../4-testing/1-pow-nan-spec/task.md | 0 .../4-testing/2-pow-test-0/solution.md | 0 .../2-pow-test-0/solution.view/index.html | 0 .../2-pow-test-0/solution.view/test.js | 0 .../2-pow-test-0/source.view/index.html | 0 .../2-pow-test-0/source.view/test.js | 0 .../4-testing/2-pow-test-0/task.md | 0 .../4-testing/3-pow-test-wrong/solution.md | 0 .../4-testing/3-pow-test-wrong/task.md | 0 .../4-testing/article.md | 0 .../4-testing/beforeafter.view/index.html | 0 .../4-testing/beforeafter.view/test.js | 0 .../4-testing/index.html | 0 .../4-testing/pow-1.view/index.html | 0 .../4-testing/pow-1.view/test.js | 0 .../4-testing/pow-2.view/index.html | 0 .../4-testing/pow-2.view/test.js | 0 .../4-testing/pow-3.view/index.html | 0 .../4-testing/pow-3.view/test.js | 0 .../4-testing/pow-4.view/index.html | 0 .../4-testing/pow-4.view/test.js | 0 .../4-testing/pow-full.view/index.html | 0 .../4-testing/pow-full.view/test.js | 0 .../4-testing/pow-min.view/index.html | 0 .../4-testing/pow-min.view/test.js | 0 .../4-testing/pow-nan-assert.view/index.html | 0 .../4-testing/pow-nan-assert.view/test.js | 0 .../4-testing/pow-nan.view/index.html | 0 .../4-testing/pow-nan.view/test.js | 0 .../5-polyfills/article.md | 0 .../index.md | 0 1-js/3-object-basics/index.md | 1 - .../01-object}/2-hello-object/solution.md | 0 .../01-object}/2-hello-object/task.md | 0 .../3-is-empty/_js.view/solution.js | 0 .../01-object}/3-is-empty/_js.view/test.js | 0 .../01-object}/3-is-empty/solution.md | 0 .../01-object}/3-is-empty/task.md | 0 .../01-object}/4-sum-object/solution.md | 0 .../01-object}/4-sum-object/task.md | 0 .../8-multiply-numeric/_js.view/solution.js | 0 .../8-multiply-numeric/_js.view/source.js | 0 .../8-multiply-numeric/_js.view/test.js | 0 .../01-object}/8-multiply-numeric/solution.md | 0 .../01-object}/8-multiply-numeric/task.md | 0 .../01-object}/article.md | 105 +++++----- .../01-object}/object-user-delete.png | Bin .../01-object}/object-user-delete@2x.png | Bin .../01-object}/object-user-empty.png | Bin .../01-object}/object-user-empty@2x.png | Bin .../01-object}/object-user-isadmin.png | Bin .../01-object}/object-user-isadmin@2x.png | Bin .../01-object}/object-user-props.png | Bin .../01-object}/object-user-props@2x.png | Bin .../01-object}/object-user.png | Bin .../01-object}/object-user@2x.png | Bin .../01-object}/object.png | Bin .../01-object}/object@2x.png | Bin .../variable-contains-reference.png | Bin .../variable-contains-reference@2x.png | Bin .../01-object}/variable-copy-reference.png | Bin .../01-object}/variable-copy-reference@2x.png | Bin .../01-object}/variable-copy-value.png | Bin .../01-object}/variable-copy-value@2x.png | Bin .../02-garbage-collection}/article.md | 0 .../family-no-family.png | Bin .../family-no-family@2x.png | Bin .../family-no-father-2.png | Bin .../family-no-father-2@2x.png | Bin .../family-no-father.png | Bin .../family-no-father@2x.png | Bin .../02-garbage-collection}/family.png | Bin .../02-garbage-collection}/family@2x.png | Bin .../garbage-collection-1.png | Bin .../garbage-collection-1@2x.png | Bin .../garbage-collection-2.png | Bin .../garbage-collection-2@2x.png | Bin .../garbage-collection-3.png | Bin .../garbage-collection-3@2x.png | Bin .../garbage-collection-4.png | Bin .../garbage-collection-4@2x.png | Bin .../garbage-collection-5.png | Bin .../garbage-collection-5@2x.png | Bin .../garbage-collection.png | Bin .../garbage-collection@2x.png | Bin .../memory-user-john-admin.png | Bin .../memory-user-john-admin@2x.png | Bin .../memory-user-john-lost.png | Bin .../memory-user-john-lost@2x.png | Bin .../memory-user-john.png | Bin .../memory-user-john@2x.png | Bin .../2-check-syntax/solution.md | 0 .../03-object-methods}/2-check-syntax/task.md | 0 .../03-object-methods}/3-why-this/solution.md | 0 .../03-object-methods}/3-why-this/task.md | 0 .../4-object-property-this/solution.md | 0 .../4-object-property-this/task.md | 0 .../7-calculator/_js.view/solution.js | 0 .../7-calculator/_js.view/test.js | 0 .../7-calculator/solution.md | 0 .../03-object-methods}/7-calculator/task.md | 0 .../8-chain-calls/solution.md | 0 .../03-object-methods}/8-chain-calls/task.md | 0 .../9-string-new-property}/solution.md | 0 .../9-string-new-property}/task.md | 0 .../03-object-methods}/article.md | 128 +++++++++--- .../1-two-functions-one-object/solution.md | 18 ++ .../1-two-functions-one-object/task.md | 19 ++ .../_js.view/solution.js | 15 ++ .../2-calculator-constructor/_js.view/test.js | 25 +++ .../2-calculator-constructor/solution.md | 26 +++ .../2-calculator-constructor/task.md | 24 +++ .../3-accumulator/_js.view/solution.js | 8 + .../3-accumulator/_js.view/test.js | 37 ++++ .../3-accumulator/solution.md | 18 ++ .../04-constructor-new/3-accumulator/task.md | 27 +++ .../_js.view/solution.js | 29 +++ .../4-calculator-extendable/_js.view/test.js | 26 +++ .../4-calculator-extendable/solution.md | 52 +++++ .../4-calculator-extendable/task.md | 42 ++++ .../04-constructor-new/article.md | 182 ++++++++++++++++++ .../05-symbol}/article.md | 87 ++++++--- .../06-object-toprimitive}/article.md | 2 +- .../1-string-new-property/solution.md | 31 +++ .../1-string-new-property/task.md | 18 ++ .../07-primitives-methods}/article.md | 0 .../08-number}/1-sum-interface/solution.md | 0 .../08-number}/1-sum-interface/task.md | 0 .../08-number}/2-why-rounded-down/solution.md | 0 .../08-number}/2-why-rounded-down/task.md | 0 .../_js.view/solution.js | 0 .../3-repeat-until-number/_js.view/test.js | 0 .../3-repeat-until-number/solution.md | 0 .../08-number}/3-repeat-until-number/task.md | 0 .../4-endless-loop-error/solution.md | 0 .../08-number}/4-endless-loop-error/task.md | 0 .../08-number}/8-random-min-max/solution.md | 0 .../08-number}/8-random-min-max/task.md | 0 .../9-random-int-min-max/solution.md | 0 .../08-number}/9-random-int-min-max/task.md | 0 .../08-number}/article.md | 2 +- .../09-string}/1-ucfirst/_js.view/solution.js | 0 .../09-string}/1-ucfirst/_js.view/test.js | 0 .../09-string}/1-ucfirst/solution.md | 0 .../09-string}/1-ucfirst/task.md | 0 .../2-check-spam/_js.view/solution.js | 0 .../09-string}/2-check-spam/_js.view/test.js | 0 .../09-string}/2-check-spam/solution.md | 0 .../09-string}/2-check-spam/task.md | 0 .../3-truncate/_js.view/solution.js | 0 .../09-string}/3-truncate/_js.view/test.js | 0 .../09-string}/3-truncate/solution.md | 0 .../09-string}/3-truncate/task.md | 0 .../4-extract-currency/_js.view/solution.js | 0 .../4-extract-currency/_js.view/test.js | 0 .../09-string}/4-extract-currency/solution.md | 0 .../09-string}/4-extract-currency/task.md | 0 .../09-string}/article.md | 2 +- .../11-array}/1-item-value/solution.md | 0 .../11-array}/1-item-value/task.md | 0 .../10-maximal-subarray/_js.view/solution.js | 0 .../10-maximal-subarray/_js.view/test.js | 0 .../11-array}/10-maximal-subarray/solution.md | 0 .../11-array}/10-maximal-subarray/task.md | 0 .../11-array}/2-create-array/solution.md | 0 .../11-array}/2-create-array/task.md | 0 .../11-array}/3-call-array-this/solution.md | 0 .../11-array}/3-call-array-this/task.md | 0 .../11-array}/5-array-input-sum/solution.md | 0 .../11-array}/5-array-input-sum/task.md | 0 .../11-array}/array-pop.png | Bin .../11-array}/array-pop@2x.png | Bin .../11-array}/array-shift.png | Bin .../11-array}/array-shift@2x.png | Bin .../11-array}/array-speed.png | Bin .../11-array}/array-speed@2x.png | Bin .../11-array}/article.md | 0 .../11-array}/queue.png | Bin .../11-array}/queue@2x.png | Bin .../11-array}/stack.png | Bin .../11-array}/stack@2x.png | Bin .../1-camelcase/_js.view/solution.js | 0 .../1-camelcase/_js.view/test.js | 0 .../12-array-methods/1-camelcase}/solution.md | 0 .../12-array-methods}/1-camelcase/task.md | 0 .../11-array-unique/_js.view/solution.js | 0 .../11-array-unique/_js.view/test.js | 0 .../11-array-unique/solution.md | 0 .../12-array-methods}/11-array-unique/task.md | 0 .../2-filter-range/_js.view/solution.js | 0 .../2-filter-range/_js.view/test.js | 0 .../2-filter-range}/solution.md | 0 .../12-array-methods}/2-filter-range/task.md | 0 .../_js.view/solution.js | 0 .../3-filter-range-in-place/_js.view/test.js | 0 .../3-filter-range-in-place}/solution.md | 0 .../3-filter-range-in-place/task.md | 0 .../12-array-methods}/4-sort-back/solution.md | 0 .../12-array-methods}/4-sort-back/task.md | 0 .../5-copy-sort-array/solution.md | 0 .../5-copy-sort-array/task.md | 0 .../6-array-get-names/solution.md | 0 .../6-array-get-names/task.md | 0 .../7-sort-objects/solution.md | 0 .../12-array-methods}/7-sort-objects/task.md | 0 .../8-average-age/solution.md | 0 .../12-array-methods}/8-average-age/task.md | 0 .../12-array-methods}/article.md | 0 .../12-array-methods}/reduce.png | Bin .../12-array-methods}/reduce@2x.png | Bin .../14-iterable}/article.md | 0 .../1-filter-anagrams/_js.view/solution.js | 0 .../1-filter-anagrams/_js.view/test.js | 0 .../1-filter-anagrams/solution.md | 0 .../1-filter-anagrams/task.md | 0 .../2-recipients-set/solution.md | 0 .../2-recipients-set/task.md | 0 .../15-map-set-weakmap-weakset}/article.md | 12 -- .../17-date}/1-new-date/solution.md | 0 .../17-date}/1-new-date/task.md | 0 .../2-get-week-day/_js.view/solution.js | 0 .../17-date}/2-get-week-day/_js.view/test.js | 0 .../17-date}/2-get-week-day/solution.md | 0 .../17-date}/2-get-week-day/task.md | 0 .../17-date}/3-weekday/_js.view/solution.js | 0 .../17-date}/3-weekday/_js.view/test.js | 0 .../17-date}/3-weekday/solution.md | 0 .../17-date}/3-weekday/task.md | 0 .../4-get-date-ago/_js.view/solution.js | 0 .../17-date}/4-get-date-ago/_js.view/test.js | 0 .../17-date}/4-get-date-ago/solution.md | 0 .../17-date}/4-get-date-ago/task.md | 0 .../5-last-day-of-month/_js.view/solution.js | 0 .../5-last-day-of-month/_js.view/test.js | 0 .../17-date}/5-last-day-of-month/solution.md | 0 .../17-date}/5-last-day-of-month/task.md | 0 .../17-date}/6-get-seconds-today/solution.md | 0 .../17-date}/6-get-seconds-today/task.md | 0 .../7-get-seconds-to-tomorrow/solution.md | 0 .../7-get-seconds-to-tomorrow/task.md | 0 .../8-format-date-ddmmyy/_js.view/solution.js | 0 .../8-format-date-ddmmyy/_js.view/test.js | 0 .../17-date}/8-format-date-ddmmyy/solution.md | 0 .../17-date}/8-format-date-ddmmyy/task.md | 0 .../_js.view/solution.js | 0 .../9-format-date-relative/_js.view/test.js | 0 .../9-format-date-relative/solution.md | 0 .../17-date}/9-format-date-relative/task.md | 0 .../17-date}/article.md | 8 +- .../19-json}/1-serialize-object/solution.md | 0 .../19-json}/1-serialize-object/task.md | 0 .../2-serialize-object-circular/solution.md | 0 .../2-serialize-object-circular/task.md | 0 .../19-json}/article.md | 0 1-js/{6-data-types => 4-data-types}/index.md | 0 .../article.md | 0 .../1-destructuring-assignment/solution.md | 0 .../1-destructuring-assignment/task.md | 0 .../2-destructuring-assignment/article.md | 0 .../destructuring-complex.png | Bin .../destructuring-complex@2x.png | Bin .../1-iterable-keys/solution.md | 0 .../3-advanced-loops/1-iterable-keys/task.md | 0 .../5-sum-salaries/_js.view/solution.js | 0 .../5-sum-salaries/_js.view/test.js | 0 .../5-sum-salaries}/solution.md | 0 .../3-advanced-loops/5-sum-salaries/task.md | 0 .../6-max-salary/_js.view/solution.js | 0 .../6-max-salary/_js.view/test.js | 0 .../6-max-salary}/solution.md | 0 .../3-advanced-loops/6-max-salary/task.md | 0 .../7-count-properties/_js.view/solution.js | 0 .../7-count-properties/_js.view/test.js | 0 .../7-count-properties}/solution.md | 0 .../7-count-properties/task.md | 0 .../3-advanced-loops/article.md | 0 .../{4-more-syntax => 5-more-syntax}/index.md | 0 .../03-object2/article.md | 0 1-js/6-data-types2/index.md | 3 + 1-js/plan3.txt | 43 +++-- 324 files changed, 854 insertions(+), 142 deletions(-) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/article.md (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/chrome_break_error.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/chrome_break_error@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/chrome_sources.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/chrome_sources@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/chrome_sources_break.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/chrome_sources_break@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/chrome_sources_breakpoint.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/chrome_sources_breakpoint@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/chrome_sources_buttons.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/chrome_sources_buttons@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/console_error.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/console_error@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/debugging.view/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/debugging.view/pow.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/error.view/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/error.view/pow.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/head.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/manage1.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/manage1@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/manage2.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/manage2@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/manage3.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/manage3@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/manage4.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/manage4@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/manage5.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/manage5@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/manage6.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/manage6@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/1-debugging-chrome/statusbarButtonGlyphs.svg (100%) rename 1-js/{5-code-quality => 3-code-quality}/2-coding-style/1-style-errors/solution.md (100%) rename 1-js/{5-code-quality => 3-code-quality}/2-coding-style/1-style-errors/task.md (100%) rename 1-js/{5-code-quality => 3-code-quality}/2-coding-style/article.md (100%) rename 1-js/{5-code-quality => 3-code-quality}/2-coding-style/code-style.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/2-coding-style/code-style@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/2-coding-style/figure-bracket-style.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/2-coding-style/figure-bracket-style@2x.png (100%) rename 1-js/{5-code-quality => 3-code-quality}/3-write-unmain-code/article.md (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/1-pow-nan-spec/_js.view/solution.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/1-pow-nan-spec/_js.view/source.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/1-pow-nan-spec/_js.view/test.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/1-pow-nan-spec/solution.md (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/1-pow-nan-spec/task.md (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/2-pow-test-0/solution.md (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/2-pow-test-0/solution.view/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/2-pow-test-0/solution.view/test.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/2-pow-test-0/source.view/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/2-pow-test-0/source.view/test.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/2-pow-test-0/task.md (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/3-pow-test-wrong/solution.md (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/3-pow-test-wrong/task.md (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/article.md (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/beforeafter.view/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/beforeafter.view/test.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-1.view/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-1.view/test.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-2.view/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-2.view/test.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-3.view/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-3.view/test.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-4.view/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-4.view/test.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-full.view/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-full.view/test.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-min.view/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-min.view/test.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-nan-assert.view/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-nan-assert.view/test.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-nan.view/index.html (100%) rename 1-js/{5-code-quality => 3-code-quality}/4-testing/pow-nan.view/test.js (100%) rename 1-js/{5-code-quality => 3-code-quality}/5-polyfills/article.md (100%) rename 1-js/{5-code-quality => 3-code-quality}/index.md (100%) delete mode 100644 1-js/3-object-basics/index.md rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/2-hello-object/solution.md (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/2-hello-object/task.md (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/3-is-empty/_js.view/solution.js (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/3-is-empty/_js.view/test.js (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/3-is-empty/solution.md (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/3-is-empty/task.md (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/4-sum-object/solution.md (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/4-sum-object/task.md (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/8-multiply-numeric/_js.view/solution.js (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/8-multiply-numeric/_js.view/source.js (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/8-multiply-numeric/_js.view/test.js (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/8-multiply-numeric/solution.md (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/8-multiply-numeric/task.md (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/article.md (92%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/object-user-delete.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/object-user-delete@2x.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/object-user-empty.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/object-user-empty@2x.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/object-user-isadmin.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/object-user-isadmin@2x.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/object-user-props.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/object-user-props@2x.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/object-user.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/object-user@2x.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/object.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/object@2x.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/variable-contains-reference.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/variable-contains-reference@2x.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/variable-copy-reference.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/variable-copy-reference@2x.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/variable-copy-value.png (100%) rename 1-js/{3-object-basics/1-object => 4-data-types/01-object}/variable-copy-value@2x.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/article.md (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/family-no-family.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/family-no-family@2x.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/family-no-father-2.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/family-no-father-2@2x.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/family-no-father.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/family-no-father@2x.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/family.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/family@2x.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/garbage-collection-1.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/garbage-collection-1@2x.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/garbage-collection-2.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/garbage-collection-2@2x.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/garbage-collection-3.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/garbage-collection-3@2x.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/garbage-collection-4.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/garbage-collection-4@2x.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/garbage-collection-5.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/garbage-collection-5@2x.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/garbage-collection.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/garbage-collection@2x.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/memory-user-john-admin.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/memory-user-john-admin@2x.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/memory-user-john-lost.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/memory-user-john-lost@2x.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/memory-user-john.png (100%) rename 1-js/{3-object-basics/2-garbage-collection => 4-data-types/02-garbage-collection}/memory-user-john@2x.png (100%) rename 1-js/{3-object-basics/3-object-methods => 4-data-types/03-object-methods}/2-check-syntax/solution.md (100%) rename 1-js/{3-object-basics/3-object-methods => 4-data-types/03-object-methods}/2-check-syntax/task.md (100%) rename 1-js/{3-object-basics/3-object-methods => 4-data-types/03-object-methods}/3-why-this/solution.md (100%) rename 1-js/{3-object-basics/3-object-methods => 4-data-types/03-object-methods}/3-why-this/task.md (100%) rename 1-js/{3-object-basics/3-object-methods => 4-data-types/03-object-methods}/4-object-property-this/solution.md (100%) rename 1-js/{3-object-basics/3-object-methods => 4-data-types/03-object-methods}/4-object-property-this/task.md (100%) rename 1-js/{3-object-basics/3-object-methods => 4-data-types/03-object-methods}/7-calculator/_js.view/solution.js (100%) rename 1-js/{3-object-basics/3-object-methods => 4-data-types/03-object-methods}/7-calculator/_js.view/test.js (100%) rename 1-js/{3-object-basics/3-object-methods => 4-data-types/03-object-methods}/7-calculator/solution.md (100%) rename 1-js/{3-object-basics/3-object-methods => 4-data-types/03-object-methods}/7-calculator/task.md (100%) rename 1-js/{3-object-basics/3-object-methods => 4-data-types/03-object-methods}/8-chain-calls/solution.md (100%) rename 1-js/{3-object-basics/3-object-methods => 4-data-types/03-object-methods}/8-chain-calls/task.md (100%) rename 1-js/{3-object-basics/4-primitives-methods/1-string-new-property => 4-data-types/03-object-methods/9-string-new-property}/solution.md (100%) rename 1-js/{3-object-basics/4-primitives-methods/1-string-new-property => 4-data-types/03-object-methods/9-string-new-property}/task.md (100%) rename 1-js/{3-object-basics/3-object-methods => 4-data-types/03-object-methods}/article.md (50%) create mode 100644 1-js/4-data-types/04-constructor-new/1-two-functions-one-object/solution.md create mode 100644 1-js/4-data-types/04-constructor-new/1-two-functions-one-object/task.md create mode 100644 1-js/4-data-types/04-constructor-new/2-calculator-constructor/_js.view/solution.js create mode 100644 1-js/4-data-types/04-constructor-new/2-calculator-constructor/_js.view/test.js create mode 100644 1-js/4-data-types/04-constructor-new/2-calculator-constructor/solution.md create mode 100644 1-js/4-data-types/04-constructor-new/2-calculator-constructor/task.md create mode 100644 1-js/4-data-types/04-constructor-new/3-accumulator/_js.view/solution.js create mode 100644 1-js/4-data-types/04-constructor-new/3-accumulator/_js.view/test.js create mode 100644 1-js/4-data-types/04-constructor-new/3-accumulator/solution.md create mode 100644 1-js/4-data-types/04-constructor-new/3-accumulator/task.md create mode 100644 1-js/4-data-types/04-constructor-new/4-calculator-extendable/_js.view/solution.js create mode 100644 1-js/4-data-types/04-constructor-new/4-calculator-extendable/_js.view/test.js create mode 100644 1-js/4-data-types/04-constructor-new/4-calculator-extendable/solution.md create mode 100644 1-js/4-data-types/04-constructor-new/4-calculator-extendable/task.md create mode 100644 1-js/4-data-types/04-constructor-new/article.md rename 1-js/{3-object-basics/5-symbol => 4-data-types/05-symbol}/article.md (56%) rename 1-js/{3-object-basics/6-object-toprimitive => 4-data-types/06-object-toprimitive}/article.md (96%) create mode 100644 1-js/4-data-types/07-primitives-methods/1-string-new-property/solution.md create mode 100644 1-js/4-data-types/07-primitives-methods/1-string-new-property/task.md rename 1-js/{3-object-basics/4-primitives-methods => 4-data-types/07-primitives-methods}/article.md (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/1-sum-interface/solution.md (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/1-sum-interface/task.md (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/2-why-rounded-down/solution.md (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/2-why-rounded-down/task.md (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/3-repeat-until-number/_js.view/solution.js (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/3-repeat-until-number/_js.view/test.js (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/3-repeat-until-number/solution.md (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/3-repeat-until-number/task.md (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/4-endless-loop-error/solution.md (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/4-endless-loop-error/task.md (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/8-random-min-max/solution.md (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/8-random-min-max/task.md (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/9-random-int-min-max/solution.md (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/9-random-int-min-max/task.md (100%) rename 1-js/{6-data-types/01-number => 4-data-types/08-number}/article.md (99%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/1-ucfirst/_js.view/solution.js (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/1-ucfirst/_js.view/test.js (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/1-ucfirst/solution.md (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/1-ucfirst/task.md (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/2-check-spam/_js.view/solution.js (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/2-check-spam/_js.view/test.js (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/2-check-spam/solution.md (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/2-check-spam/task.md (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/3-truncate/_js.view/solution.js (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/3-truncate/_js.view/test.js (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/3-truncate/solution.md (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/3-truncate/task.md (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/4-extract-currency/_js.view/solution.js (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/4-extract-currency/_js.view/test.js (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/4-extract-currency/solution.md (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/4-extract-currency/task.md (100%) rename 1-js/{6-data-types/02-string => 4-data-types/09-string}/article.md (99%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/1-item-value/solution.md (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/1-item-value/task.md (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/10-maximal-subarray/_js.view/solution.js (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/10-maximal-subarray/_js.view/test.js (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/10-maximal-subarray/solution.md (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/10-maximal-subarray/task.md (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/2-create-array/solution.md (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/2-create-array/task.md (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/3-call-array-this/solution.md (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/3-call-array-this/task.md (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/5-array-input-sum/solution.md (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/5-array-input-sum/task.md (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/array-pop.png (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/array-pop@2x.png (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/array-shift.png (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/array-shift@2x.png (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/array-speed.png (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/array-speed@2x.png (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/article.md (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/queue.png (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/queue@2x.png (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/stack.png (100%) rename 1-js/{3-object-basics/7-array => 4-data-types/11-array}/stack@2x.png (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/1-camelcase/_js.view/solution.js (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/1-camelcase/_js.view/test.js (100%) rename 1-js/{4-more-syntax/3-advanced-loops/5-sum-salaries => 4-data-types/12-array-methods/1-camelcase}/solution.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/1-camelcase/task.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/11-array-unique/_js.view/solution.js (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/11-array-unique/_js.view/test.js (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/11-array-unique/solution.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/11-array-unique/task.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/2-filter-range/_js.view/solution.js (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/2-filter-range/_js.view/test.js (100%) rename 1-js/{4-more-syntax/3-advanced-loops/6-max-salary => 4-data-types/12-array-methods/2-filter-range}/solution.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/2-filter-range/task.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/3-filter-range-in-place/_js.view/solution.js (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/3-filter-range-in-place/_js.view/test.js (100%) rename 1-js/{4-more-syntax/3-advanced-loops/7-count-properties => 4-data-types/12-array-methods/3-filter-range-in-place}/solution.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/3-filter-range-in-place/task.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/4-sort-back/solution.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/4-sort-back/task.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/5-copy-sort-array/solution.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/5-copy-sort-array/task.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/6-array-get-names/solution.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/6-array-get-names/task.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/7-sort-objects/solution.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/7-sort-objects/task.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/8-average-age/solution.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/8-average-age/task.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/article.md (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/reduce.png (100%) rename 1-js/{6-data-types/07-array-methods => 4-data-types/12-array-methods}/reduce@2x.png (100%) rename 1-js/{3-object-basics/8-iterable => 4-data-types/14-iterable}/article.md (100%) rename 1-js/{6-data-types/08-map-set-weakmap-weakset => 4-data-types/15-map-set-weakmap-weakset}/1-filter-anagrams/_js.view/solution.js (100%) rename 1-js/{6-data-types/08-map-set-weakmap-weakset => 4-data-types/15-map-set-weakmap-weakset}/1-filter-anagrams/_js.view/test.js (100%) rename 1-js/{6-data-types/08-map-set-weakmap-weakset => 4-data-types/15-map-set-weakmap-weakset}/1-filter-anagrams/solution.md (100%) rename 1-js/{6-data-types/08-map-set-weakmap-weakset => 4-data-types/15-map-set-weakmap-weakset}/1-filter-anagrams/task.md (100%) rename 1-js/{6-data-types/08-map-set-weakmap-weakset => 4-data-types/15-map-set-weakmap-weakset}/2-recipients-set/solution.md (100%) rename 1-js/{6-data-types/08-map-set-weakmap-weakset => 4-data-types/15-map-set-weakmap-weakset}/2-recipients-set/task.md (100%) rename 1-js/{6-data-types/08-map-set-weakmap-weakset => 4-data-types/15-map-set-weakmap-weakset}/article.md (94%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/1-new-date/solution.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/1-new-date/task.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/2-get-week-day/_js.view/solution.js (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/2-get-week-day/_js.view/test.js (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/2-get-week-day/solution.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/2-get-week-day/task.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/3-weekday/_js.view/solution.js (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/3-weekday/_js.view/test.js (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/3-weekday/solution.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/3-weekday/task.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/4-get-date-ago/_js.view/solution.js (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/4-get-date-ago/_js.view/test.js (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/4-get-date-ago/solution.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/4-get-date-ago/task.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/5-last-day-of-month/_js.view/solution.js (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/5-last-day-of-month/_js.view/test.js (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/5-last-day-of-month/solution.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/5-last-day-of-month/task.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/6-get-seconds-today/solution.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/6-get-seconds-today/task.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/7-get-seconds-to-tomorrow/solution.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/7-get-seconds-to-tomorrow/task.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/8-format-date-ddmmyy/_js.view/solution.js (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/8-format-date-ddmmyy/_js.view/test.js (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/8-format-date-ddmmyy/solution.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/8-format-date-ddmmyy/task.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/9-format-date-relative/_js.view/solution.js (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/9-format-date-relative/_js.view/test.js (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/9-format-date-relative/solution.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/9-format-date-relative/task.md (100%) rename 1-js/{6-data-types/09-date => 4-data-types/17-date}/article.md (98%) rename 1-js/{3-object-basics/9-json => 4-data-types/19-json}/1-serialize-object/solution.md (100%) rename 1-js/{3-object-basics/9-json => 4-data-types/19-json}/1-serialize-object/task.md (100%) rename 1-js/{3-object-basics/9-json => 4-data-types/19-json}/2-serialize-object-circular/solution.md (100%) rename 1-js/{3-object-basics/9-json => 4-data-types/19-json}/2-serialize-object-circular/task.md (100%) rename 1-js/{3-object-basics/9-json => 4-data-types/19-json}/article.md (100%) rename 1-js/{6-data-types => 4-data-types}/index.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/1-function-arguments-rest-spread/article.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/2-destructuring-assignment/1-destructuring-assignment/solution.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/2-destructuring-assignment/1-destructuring-assignment/task.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/2-destructuring-assignment/article.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/2-destructuring-assignment/destructuring-complex.png (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/2-destructuring-assignment/destructuring-complex@2x.png (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/3-advanced-loops/1-iterable-keys/solution.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/3-advanced-loops/1-iterable-keys/task.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/3-advanced-loops/5-sum-salaries/_js.view/solution.js (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/3-advanced-loops/5-sum-salaries/_js.view/test.js (100%) rename 1-js/{6-data-types/07-array-methods/1-camelcase => 5-more-syntax/3-advanced-loops/5-sum-salaries}/solution.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/3-advanced-loops/5-sum-salaries/task.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/3-advanced-loops/6-max-salary/_js.view/solution.js (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/3-advanced-loops/6-max-salary/_js.view/test.js (100%) rename 1-js/{6-data-types/07-array-methods/2-filter-range => 5-more-syntax/3-advanced-loops/6-max-salary}/solution.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/3-advanced-loops/6-max-salary/task.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/3-advanced-loops/7-count-properties/_js.view/solution.js (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/3-advanced-loops/7-count-properties/_js.view/test.js (100%) rename 1-js/{6-data-types/07-array-methods/3-filter-range-in-place => 5-more-syntax/3-advanced-loops/7-count-properties}/solution.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/3-advanced-loops/7-count-properties/task.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/3-advanced-loops/article.md (100%) rename 1-js/{4-more-syntax => 5-more-syntax}/index.md (100%) rename 1-js/{6-data-types => 6-data-types2}/03-object2/article.md (100%) create mode 100644 1-js/6-data-types2/index.md diff --git a/1-js/2-first-steps/15-function-expressions-arrows/article.md b/1-js/2-first-steps/15-function-expressions-arrows/article.md index 47e86cdb..6426d3bb 100644 --- a/1-js/2-first-steps/15-function-expressions-arrows/article.md +++ b/1-js/2-first-steps/15-function-expressions-arrows/article.md @@ -385,12 +385,12 @@ let sum = (a, b) => a + b; alert( sum(1, 2) ); // 3 ``` -Here the function is same as: +Here the arrow function is a shorter form of: ```js let sum = function(a, b) { return a + b; -} +}; ``` If we have only one argument, then brackets can be omitted, making that even shorter: @@ -398,7 +398,9 @@ If we have only one argument, then brackets can be omitted, making that even sho ```js run // same as // let double = function(n) { return n*2 } +*!* let double = n => n*2; +*/!* alert( double(3) ); // 6 ``` diff --git a/1-js/5-code-quality/1-debugging-chrome/article.md b/1-js/3-code-quality/1-debugging-chrome/article.md similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/article.md rename to 1-js/3-code-quality/1-debugging-chrome/article.md diff --git a/1-js/5-code-quality/1-debugging-chrome/chrome_break_error.png b/1-js/3-code-quality/1-debugging-chrome/chrome_break_error.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/chrome_break_error.png rename to 1-js/3-code-quality/1-debugging-chrome/chrome_break_error.png diff --git a/1-js/5-code-quality/1-debugging-chrome/chrome_break_error@2x.png b/1-js/3-code-quality/1-debugging-chrome/chrome_break_error@2x.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/chrome_break_error@2x.png rename to 1-js/3-code-quality/1-debugging-chrome/chrome_break_error@2x.png diff --git a/1-js/5-code-quality/1-debugging-chrome/chrome_sources.png b/1-js/3-code-quality/1-debugging-chrome/chrome_sources.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/chrome_sources.png rename to 1-js/3-code-quality/1-debugging-chrome/chrome_sources.png diff --git a/1-js/5-code-quality/1-debugging-chrome/chrome_sources@2x.png b/1-js/3-code-quality/1-debugging-chrome/chrome_sources@2x.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/chrome_sources@2x.png rename to 1-js/3-code-quality/1-debugging-chrome/chrome_sources@2x.png diff --git a/1-js/5-code-quality/1-debugging-chrome/chrome_sources_break.png b/1-js/3-code-quality/1-debugging-chrome/chrome_sources_break.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/chrome_sources_break.png rename to 1-js/3-code-quality/1-debugging-chrome/chrome_sources_break.png diff --git a/1-js/5-code-quality/1-debugging-chrome/chrome_sources_break@2x.png b/1-js/3-code-quality/1-debugging-chrome/chrome_sources_break@2x.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/chrome_sources_break@2x.png rename to 1-js/3-code-quality/1-debugging-chrome/chrome_sources_break@2x.png diff --git a/1-js/5-code-quality/1-debugging-chrome/chrome_sources_breakpoint.png b/1-js/3-code-quality/1-debugging-chrome/chrome_sources_breakpoint.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/chrome_sources_breakpoint.png rename to 1-js/3-code-quality/1-debugging-chrome/chrome_sources_breakpoint.png diff --git a/1-js/5-code-quality/1-debugging-chrome/chrome_sources_breakpoint@2x.png b/1-js/3-code-quality/1-debugging-chrome/chrome_sources_breakpoint@2x.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/chrome_sources_breakpoint@2x.png rename to 1-js/3-code-quality/1-debugging-chrome/chrome_sources_breakpoint@2x.png diff --git a/1-js/5-code-quality/1-debugging-chrome/chrome_sources_buttons.png b/1-js/3-code-quality/1-debugging-chrome/chrome_sources_buttons.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/chrome_sources_buttons.png rename to 1-js/3-code-quality/1-debugging-chrome/chrome_sources_buttons.png diff --git a/1-js/5-code-quality/1-debugging-chrome/chrome_sources_buttons@2x.png b/1-js/3-code-quality/1-debugging-chrome/chrome_sources_buttons@2x.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/chrome_sources_buttons@2x.png rename to 1-js/3-code-quality/1-debugging-chrome/chrome_sources_buttons@2x.png diff --git a/1-js/5-code-quality/1-debugging-chrome/console_error.png b/1-js/3-code-quality/1-debugging-chrome/console_error.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/console_error.png rename to 1-js/3-code-quality/1-debugging-chrome/console_error.png diff --git a/1-js/5-code-quality/1-debugging-chrome/console_error@2x.png b/1-js/3-code-quality/1-debugging-chrome/console_error@2x.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/console_error@2x.png rename to 1-js/3-code-quality/1-debugging-chrome/console_error@2x.png diff --git a/1-js/5-code-quality/1-debugging-chrome/debugging.view/index.html b/1-js/3-code-quality/1-debugging-chrome/debugging.view/index.html similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/debugging.view/index.html rename to 1-js/3-code-quality/1-debugging-chrome/debugging.view/index.html diff --git a/1-js/5-code-quality/1-debugging-chrome/debugging.view/pow.js b/1-js/3-code-quality/1-debugging-chrome/debugging.view/pow.js similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/debugging.view/pow.js rename to 1-js/3-code-quality/1-debugging-chrome/debugging.view/pow.js diff --git a/1-js/5-code-quality/1-debugging-chrome/error.view/index.html b/1-js/3-code-quality/1-debugging-chrome/error.view/index.html similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/error.view/index.html rename to 1-js/3-code-quality/1-debugging-chrome/error.view/index.html diff --git a/1-js/5-code-quality/1-debugging-chrome/error.view/pow.js b/1-js/3-code-quality/1-debugging-chrome/error.view/pow.js similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/error.view/pow.js rename to 1-js/3-code-quality/1-debugging-chrome/error.view/pow.js diff --git a/1-js/5-code-quality/1-debugging-chrome/head.html b/1-js/3-code-quality/1-debugging-chrome/head.html similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/head.html rename to 1-js/3-code-quality/1-debugging-chrome/head.html diff --git a/1-js/5-code-quality/1-debugging-chrome/manage1.png b/1-js/3-code-quality/1-debugging-chrome/manage1.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/manage1.png rename to 1-js/3-code-quality/1-debugging-chrome/manage1.png diff --git a/1-js/5-code-quality/1-debugging-chrome/manage1@2x.png b/1-js/3-code-quality/1-debugging-chrome/manage1@2x.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/manage1@2x.png rename to 1-js/3-code-quality/1-debugging-chrome/manage1@2x.png diff --git a/1-js/5-code-quality/1-debugging-chrome/manage2.png b/1-js/3-code-quality/1-debugging-chrome/manage2.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/manage2.png rename to 1-js/3-code-quality/1-debugging-chrome/manage2.png diff --git a/1-js/5-code-quality/1-debugging-chrome/manage2@2x.png b/1-js/3-code-quality/1-debugging-chrome/manage2@2x.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/manage2@2x.png rename to 1-js/3-code-quality/1-debugging-chrome/manage2@2x.png diff --git a/1-js/5-code-quality/1-debugging-chrome/manage3.png b/1-js/3-code-quality/1-debugging-chrome/manage3.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/manage3.png rename to 1-js/3-code-quality/1-debugging-chrome/manage3.png diff --git a/1-js/5-code-quality/1-debugging-chrome/manage3@2x.png b/1-js/3-code-quality/1-debugging-chrome/manage3@2x.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/manage3@2x.png rename to 1-js/3-code-quality/1-debugging-chrome/manage3@2x.png diff --git a/1-js/5-code-quality/1-debugging-chrome/manage4.png b/1-js/3-code-quality/1-debugging-chrome/manage4.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/manage4.png rename to 1-js/3-code-quality/1-debugging-chrome/manage4.png diff --git a/1-js/5-code-quality/1-debugging-chrome/manage4@2x.png b/1-js/3-code-quality/1-debugging-chrome/manage4@2x.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/manage4@2x.png rename to 1-js/3-code-quality/1-debugging-chrome/manage4@2x.png diff --git a/1-js/5-code-quality/1-debugging-chrome/manage5.png b/1-js/3-code-quality/1-debugging-chrome/manage5.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/manage5.png rename to 1-js/3-code-quality/1-debugging-chrome/manage5.png diff --git a/1-js/5-code-quality/1-debugging-chrome/manage5@2x.png b/1-js/3-code-quality/1-debugging-chrome/manage5@2x.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/manage5@2x.png rename to 1-js/3-code-quality/1-debugging-chrome/manage5@2x.png diff --git a/1-js/5-code-quality/1-debugging-chrome/manage6.png b/1-js/3-code-quality/1-debugging-chrome/manage6.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/manage6.png rename to 1-js/3-code-quality/1-debugging-chrome/manage6.png diff --git a/1-js/5-code-quality/1-debugging-chrome/manage6@2x.png b/1-js/3-code-quality/1-debugging-chrome/manage6@2x.png similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/manage6@2x.png rename to 1-js/3-code-quality/1-debugging-chrome/manage6@2x.png diff --git a/1-js/5-code-quality/1-debugging-chrome/statusbarButtonGlyphs.svg b/1-js/3-code-quality/1-debugging-chrome/statusbarButtonGlyphs.svg similarity index 100% rename from 1-js/5-code-quality/1-debugging-chrome/statusbarButtonGlyphs.svg rename to 1-js/3-code-quality/1-debugging-chrome/statusbarButtonGlyphs.svg diff --git a/1-js/5-code-quality/2-coding-style/1-style-errors/solution.md b/1-js/3-code-quality/2-coding-style/1-style-errors/solution.md similarity index 100% rename from 1-js/5-code-quality/2-coding-style/1-style-errors/solution.md rename to 1-js/3-code-quality/2-coding-style/1-style-errors/solution.md diff --git a/1-js/5-code-quality/2-coding-style/1-style-errors/task.md b/1-js/3-code-quality/2-coding-style/1-style-errors/task.md similarity index 100% rename from 1-js/5-code-quality/2-coding-style/1-style-errors/task.md rename to 1-js/3-code-quality/2-coding-style/1-style-errors/task.md diff --git a/1-js/5-code-quality/2-coding-style/article.md b/1-js/3-code-quality/2-coding-style/article.md similarity index 100% rename from 1-js/5-code-quality/2-coding-style/article.md rename to 1-js/3-code-quality/2-coding-style/article.md diff --git a/1-js/5-code-quality/2-coding-style/code-style.png b/1-js/3-code-quality/2-coding-style/code-style.png similarity index 100% rename from 1-js/5-code-quality/2-coding-style/code-style.png rename to 1-js/3-code-quality/2-coding-style/code-style.png diff --git a/1-js/5-code-quality/2-coding-style/code-style@2x.png b/1-js/3-code-quality/2-coding-style/code-style@2x.png similarity index 100% rename from 1-js/5-code-quality/2-coding-style/code-style@2x.png rename to 1-js/3-code-quality/2-coding-style/code-style@2x.png diff --git a/1-js/5-code-quality/2-coding-style/figure-bracket-style.png b/1-js/3-code-quality/2-coding-style/figure-bracket-style.png similarity index 100% rename from 1-js/5-code-quality/2-coding-style/figure-bracket-style.png rename to 1-js/3-code-quality/2-coding-style/figure-bracket-style.png diff --git a/1-js/5-code-quality/2-coding-style/figure-bracket-style@2x.png b/1-js/3-code-quality/2-coding-style/figure-bracket-style@2x.png similarity index 100% rename from 1-js/5-code-quality/2-coding-style/figure-bracket-style@2x.png rename to 1-js/3-code-quality/2-coding-style/figure-bracket-style@2x.png diff --git a/1-js/5-code-quality/3-write-unmain-code/article.md b/1-js/3-code-quality/3-write-unmain-code/article.md similarity index 100% rename from 1-js/5-code-quality/3-write-unmain-code/article.md rename to 1-js/3-code-quality/3-write-unmain-code/article.md diff --git a/1-js/5-code-quality/4-testing/1-pow-nan-spec/_js.view/solution.js b/1-js/3-code-quality/4-testing/1-pow-nan-spec/_js.view/solution.js similarity index 100% rename from 1-js/5-code-quality/4-testing/1-pow-nan-spec/_js.view/solution.js rename to 1-js/3-code-quality/4-testing/1-pow-nan-spec/_js.view/solution.js diff --git a/1-js/5-code-quality/4-testing/1-pow-nan-spec/_js.view/source.js b/1-js/3-code-quality/4-testing/1-pow-nan-spec/_js.view/source.js similarity index 100% rename from 1-js/5-code-quality/4-testing/1-pow-nan-spec/_js.view/source.js rename to 1-js/3-code-quality/4-testing/1-pow-nan-spec/_js.view/source.js diff --git a/1-js/5-code-quality/4-testing/1-pow-nan-spec/_js.view/test.js b/1-js/3-code-quality/4-testing/1-pow-nan-spec/_js.view/test.js similarity index 100% rename from 1-js/5-code-quality/4-testing/1-pow-nan-spec/_js.view/test.js rename to 1-js/3-code-quality/4-testing/1-pow-nan-spec/_js.view/test.js diff --git a/1-js/5-code-quality/4-testing/1-pow-nan-spec/solution.md b/1-js/3-code-quality/4-testing/1-pow-nan-spec/solution.md similarity index 100% rename from 1-js/5-code-quality/4-testing/1-pow-nan-spec/solution.md rename to 1-js/3-code-quality/4-testing/1-pow-nan-spec/solution.md diff --git a/1-js/5-code-quality/4-testing/1-pow-nan-spec/task.md b/1-js/3-code-quality/4-testing/1-pow-nan-spec/task.md similarity index 100% rename from 1-js/5-code-quality/4-testing/1-pow-nan-spec/task.md rename to 1-js/3-code-quality/4-testing/1-pow-nan-spec/task.md diff --git a/1-js/5-code-quality/4-testing/2-pow-test-0/solution.md b/1-js/3-code-quality/4-testing/2-pow-test-0/solution.md similarity index 100% rename from 1-js/5-code-quality/4-testing/2-pow-test-0/solution.md rename to 1-js/3-code-quality/4-testing/2-pow-test-0/solution.md diff --git a/1-js/5-code-quality/4-testing/2-pow-test-0/solution.view/index.html b/1-js/3-code-quality/4-testing/2-pow-test-0/solution.view/index.html similarity index 100% rename from 1-js/5-code-quality/4-testing/2-pow-test-0/solution.view/index.html rename to 1-js/3-code-quality/4-testing/2-pow-test-0/solution.view/index.html diff --git a/1-js/5-code-quality/4-testing/2-pow-test-0/solution.view/test.js b/1-js/3-code-quality/4-testing/2-pow-test-0/solution.view/test.js similarity index 100% rename from 1-js/5-code-quality/4-testing/2-pow-test-0/solution.view/test.js rename to 1-js/3-code-quality/4-testing/2-pow-test-0/solution.view/test.js diff --git a/1-js/5-code-quality/4-testing/2-pow-test-0/source.view/index.html b/1-js/3-code-quality/4-testing/2-pow-test-0/source.view/index.html similarity index 100% rename from 1-js/5-code-quality/4-testing/2-pow-test-0/source.view/index.html rename to 1-js/3-code-quality/4-testing/2-pow-test-0/source.view/index.html diff --git a/1-js/5-code-quality/4-testing/2-pow-test-0/source.view/test.js b/1-js/3-code-quality/4-testing/2-pow-test-0/source.view/test.js similarity index 100% rename from 1-js/5-code-quality/4-testing/2-pow-test-0/source.view/test.js rename to 1-js/3-code-quality/4-testing/2-pow-test-0/source.view/test.js diff --git a/1-js/5-code-quality/4-testing/2-pow-test-0/task.md b/1-js/3-code-quality/4-testing/2-pow-test-0/task.md similarity index 100% rename from 1-js/5-code-quality/4-testing/2-pow-test-0/task.md rename to 1-js/3-code-quality/4-testing/2-pow-test-0/task.md diff --git a/1-js/5-code-quality/4-testing/3-pow-test-wrong/solution.md b/1-js/3-code-quality/4-testing/3-pow-test-wrong/solution.md similarity index 100% rename from 1-js/5-code-quality/4-testing/3-pow-test-wrong/solution.md rename to 1-js/3-code-quality/4-testing/3-pow-test-wrong/solution.md diff --git a/1-js/5-code-quality/4-testing/3-pow-test-wrong/task.md b/1-js/3-code-quality/4-testing/3-pow-test-wrong/task.md similarity index 100% rename from 1-js/5-code-quality/4-testing/3-pow-test-wrong/task.md rename to 1-js/3-code-quality/4-testing/3-pow-test-wrong/task.md diff --git a/1-js/5-code-quality/4-testing/article.md b/1-js/3-code-quality/4-testing/article.md similarity index 100% rename from 1-js/5-code-quality/4-testing/article.md rename to 1-js/3-code-quality/4-testing/article.md diff --git a/1-js/5-code-quality/4-testing/beforeafter.view/index.html b/1-js/3-code-quality/4-testing/beforeafter.view/index.html similarity index 100% rename from 1-js/5-code-quality/4-testing/beforeafter.view/index.html rename to 1-js/3-code-quality/4-testing/beforeafter.view/index.html diff --git a/1-js/5-code-quality/4-testing/beforeafter.view/test.js b/1-js/3-code-quality/4-testing/beforeafter.view/test.js similarity index 100% rename from 1-js/5-code-quality/4-testing/beforeafter.view/test.js rename to 1-js/3-code-quality/4-testing/beforeafter.view/test.js diff --git a/1-js/5-code-quality/4-testing/index.html b/1-js/3-code-quality/4-testing/index.html similarity index 100% rename from 1-js/5-code-quality/4-testing/index.html rename to 1-js/3-code-quality/4-testing/index.html diff --git a/1-js/5-code-quality/4-testing/pow-1.view/index.html b/1-js/3-code-quality/4-testing/pow-1.view/index.html similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-1.view/index.html rename to 1-js/3-code-quality/4-testing/pow-1.view/index.html diff --git a/1-js/5-code-quality/4-testing/pow-1.view/test.js b/1-js/3-code-quality/4-testing/pow-1.view/test.js similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-1.view/test.js rename to 1-js/3-code-quality/4-testing/pow-1.view/test.js diff --git a/1-js/5-code-quality/4-testing/pow-2.view/index.html b/1-js/3-code-quality/4-testing/pow-2.view/index.html similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-2.view/index.html rename to 1-js/3-code-quality/4-testing/pow-2.view/index.html diff --git a/1-js/5-code-quality/4-testing/pow-2.view/test.js b/1-js/3-code-quality/4-testing/pow-2.view/test.js similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-2.view/test.js rename to 1-js/3-code-quality/4-testing/pow-2.view/test.js diff --git a/1-js/5-code-quality/4-testing/pow-3.view/index.html b/1-js/3-code-quality/4-testing/pow-3.view/index.html similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-3.view/index.html rename to 1-js/3-code-quality/4-testing/pow-3.view/index.html diff --git a/1-js/5-code-quality/4-testing/pow-3.view/test.js b/1-js/3-code-quality/4-testing/pow-3.view/test.js similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-3.view/test.js rename to 1-js/3-code-quality/4-testing/pow-3.view/test.js diff --git a/1-js/5-code-quality/4-testing/pow-4.view/index.html b/1-js/3-code-quality/4-testing/pow-4.view/index.html similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-4.view/index.html rename to 1-js/3-code-quality/4-testing/pow-4.view/index.html diff --git a/1-js/5-code-quality/4-testing/pow-4.view/test.js b/1-js/3-code-quality/4-testing/pow-4.view/test.js similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-4.view/test.js rename to 1-js/3-code-quality/4-testing/pow-4.view/test.js diff --git a/1-js/5-code-quality/4-testing/pow-full.view/index.html b/1-js/3-code-quality/4-testing/pow-full.view/index.html similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-full.view/index.html rename to 1-js/3-code-quality/4-testing/pow-full.view/index.html diff --git a/1-js/5-code-quality/4-testing/pow-full.view/test.js b/1-js/3-code-quality/4-testing/pow-full.view/test.js similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-full.view/test.js rename to 1-js/3-code-quality/4-testing/pow-full.view/test.js diff --git a/1-js/5-code-quality/4-testing/pow-min.view/index.html b/1-js/3-code-quality/4-testing/pow-min.view/index.html similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-min.view/index.html rename to 1-js/3-code-quality/4-testing/pow-min.view/index.html diff --git a/1-js/5-code-quality/4-testing/pow-min.view/test.js b/1-js/3-code-quality/4-testing/pow-min.view/test.js similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-min.view/test.js rename to 1-js/3-code-quality/4-testing/pow-min.view/test.js diff --git a/1-js/5-code-quality/4-testing/pow-nan-assert.view/index.html b/1-js/3-code-quality/4-testing/pow-nan-assert.view/index.html similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-nan-assert.view/index.html rename to 1-js/3-code-quality/4-testing/pow-nan-assert.view/index.html diff --git a/1-js/5-code-quality/4-testing/pow-nan-assert.view/test.js b/1-js/3-code-quality/4-testing/pow-nan-assert.view/test.js similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-nan-assert.view/test.js rename to 1-js/3-code-quality/4-testing/pow-nan-assert.view/test.js diff --git a/1-js/5-code-quality/4-testing/pow-nan.view/index.html b/1-js/3-code-quality/4-testing/pow-nan.view/index.html similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-nan.view/index.html rename to 1-js/3-code-quality/4-testing/pow-nan.view/index.html diff --git a/1-js/5-code-quality/4-testing/pow-nan.view/test.js b/1-js/3-code-quality/4-testing/pow-nan.view/test.js similarity index 100% rename from 1-js/5-code-quality/4-testing/pow-nan.view/test.js rename to 1-js/3-code-quality/4-testing/pow-nan.view/test.js diff --git a/1-js/5-code-quality/5-polyfills/article.md b/1-js/3-code-quality/5-polyfills/article.md similarity index 100% rename from 1-js/5-code-quality/5-polyfills/article.md rename to 1-js/3-code-quality/5-polyfills/article.md diff --git a/1-js/5-code-quality/index.md b/1-js/3-code-quality/index.md similarity index 100% rename from 1-js/5-code-quality/index.md rename to 1-js/3-code-quality/index.md diff --git a/1-js/3-object-basics/index.md b/1-js/3-object-basics/index.md deleted file mode 100644 index 33e45246..00000000 --- a/1-js/3-object-basics/index.md +++ /dev/null @@ -1 +0,0 @@ -# Object basics \ No newline at end of file diff --git a/1-js/3-object-basics/1-object/2-hello-object/solution.md b/1-js/4-data-types/01-object/2-hello-object/solution.md similarity index 100% rename from 1-js/3-object-basics/1-object/2-hello-object/solution.md rename to 1-js/4-data-types/01-object/2-hello-object/solution.md diff --git a/1-js/3-object-basics/1-object/2-hello-object/task.md b/1-js/4-data-types/01-object/2-hello-object/task.md similarity index 100% rename from 1-js/3-object-basics/1-object/2-hello-object/task.md rename to 1-js/4-data-types/01-object/2-hello-object/task.md diff --git a/1-js/3-object-basics/1-object/3-is-empty/_js.view/solution.js b/1-js/4-data-types/01-object/3-is-empty/_js.view/solution.js similarity index 100% rename from 1-js/3-object-basics/1-object/3-is-empty/_js.view/solution.js rename to 1-js/4-data-types/01-object/3-is-empty/_js.view/solution.js diff --git a/1-js/3-object-basics/1-object/3-is-empty/_js.view/test.js b/1-js/4-data-types/01-object/3-is-empty/_js.view/test.js similarity index 100% rename from 1-js/3-object-basics/1-object/3-is-empty/_js.view/test.js rename to 1-js/4-data-types/01-object/3-is-empty/_js.view/test.js diff --git a/1-js/3-object-basics/1-object/3-is-empty/solution.md b/1-js/4-data-types/01-object/3-is-empty/solution.md similarity index 100% rename from 1-js/3-object-basics/1-object/3-is-empty/solution.md rename to 1-js/4-data-types/01-object/3-is-empty/solution.md diff --git a/1-js/3-object-basics/1-object/3-is-empty/task.md b/1-js/4-data-types/01-object/3-is-empty/task.md similarity index 100% rename from 1-js/3-object-basics/1-object/3-is-empty/task.md rename to 1-js/4-data-types/01-object/3-is-empty/task.md diff --git a/1-js/3-object-basics/1-object/4-sum-object/solution.md b/1-js/4-data-types/01-object/4-sum-object/solution.md similarity index 100% rename from 1-js/3-object-basics/1-object/4-sum-object/solution.md rename to 1-js/4-data-types/01-object/4-sum-object/solution.md diff --git a/1-js/3-object-basics/1-object/4-sum-object/task.md b/1-js/4-data-types/01-object/4-sum-object/task.md similarity index 100% rename from 1-js/3-object-basics/1-object/4-sum-object/task.md rename to 1-js/4-data-types/01-object/4-sum-object/task.md diff --git a/1-js/3-object-basics/1-object/8-multiply-numeric/_js.view/solution.js b/1-js/4-data-types/01-object/8-multiply-numeric/_js.view/solution.js similarity index 100% rename from 1-js/3-object-basics/1-object/8-multiply-numeric/_js.view/solution.js rename to 1-js/4-data-types/01-object/8-multiply-numeric/_js.view/solution.js diff --git a/1-js/3-object-basics/1-object/8-multiply-numeric/_js.view/source.js b/1-js/4-data-types/01-object/8-multiply-numeric/_js.view/source.js similarity index 100% rename from 1-js/3-object-basics/1-object/8-multiply-numeric/_js.view/source.js rename to 1-js/4-data-types/01-object/8-multiply-numeric/_js.view/source.js diff --git a/1-js/3-object-basics/1-object/8-multiply-numeric/_js.view/test.js b/1-js/4-data-types/01-object/8-multiply-numeric/_js.view/test.js similarity index 100% rename from 1-js/3-object-basics/1-object/8-multiply-numeric/_js.view/test.js rename to 1-js/4-data-types/01-object/8-multiply-numeric/_js.view/test.js diff --git a/1-js/3-object-basics/1-object/8-multiply-numeric/solution.md b/1-js/4-data-types/01-object/8-multiply-numeric/solution.md similarity index 100% rename from 1-js/3-object-basics/1-object/8-multiply-numeric/solution.md rename to 1-js/4-data-types/01-object/8-multiply-numeric/solution.md diff --git a/1-js/3-object-basics/1-object/8-multiply-numeric/task.md b/1-js/4-data-types/01-object/8-multiply-numeric/task.md similarity index 100% rename from 1-js/3-object-basics/1-object/8-multiply-numeric/task.md rename to 1-js/4-data-types/01-object/8-multiply-numeric/task.md diff --git a/1-js/3-object-basics/1-object/article.md b/1-js/4-data-types/01-object/article.md similarity index 92% rename from 1-js/3-object-basics/1-object/article.md rename to 1-js/4-data-types/01-object/article.md index 404de663..770286df 100644 --- a/1-js/3-object-basics/1-object/article.md +++ b/1-js/4-data-types/01-object/article.md @@ -1,12 +1,14 @@ -# Objects as dictionaries +# Objects -The `object` type is special. +As we know, there are 7 language types in Javascript. -All other types are called "primitive", because their values can contain only a single thing (be it a string or a number or whatever). +Six of them are called "primitive", because their values contain only a single thing (be it a string or a number or whatever). In contrast, objects are used to store *keyed collections* of various data and more complex entities. +In Javascript, objects penetrate almost every aspect of the language. So we must understand them first before going in-depth anywhere else. + [cut] An object is defined with the figure brackets `{…}` with an optional list of "key: value" pairs. In programming that's sometimes called an "associative array" or a "hash". @@ -112,7 +114,7 @@ user[key] = true; // same as above The square brackets mean: "take the property name from the variable". -The variable can be assigned at run-time, for instance: +That variable can be assigned at run-time, for instance: ```js run let user = { @@ -126,9 +128,9 @@ let key = prompt("What do you want to know about the user?", "name"); alert( user[key] ); // John (if enter "name") ``` -Square brackets also can be used in an object literal. +### Computed properties -That's called a *computed property*: +*Computed properties* are square brackets used inside an object literal: ```js run let fruit = prompt("Which fruit to buy?", "apple"); @@ -142,15 +144,18 @@ let bag = { alert( bag.apple ); // 5 if fruit="apple" ``` -Here, the object `bag` is created with a property with the name from `fruit` variable and the value `5`. +Here, the object `bag` is created with a property with the name from `fruit` variable and the value `5`. So, if a visitor enters `"apple"`, `bag` will become `{apple: 5}`. Essentially, that works the same as: -```js +```js run +let fruit = prompt("Which fruit to buy?", "apple"); let bag = {}; + +// take property name from the fruit variable, assign 5 to it bag[fruit] = 5; ``` -We could have used a more complex expression inside square brackets. Anything that results in a property name: +We can use more complex expressions inside square brackets. Anything that results in a property name: ```js let fruit = 'apple'; @@ -159,12 +164,51 @@ let bag = { }; ``` -Square brackets are much more powerful than the dot notation. They allow any property names and variables. But they are more cumbersome to write. So most of the time, when property names are known and simple, the dot is used. And if we need something more complex, then we can switch to square brackets. +Square brackets are much more powerful than the dot notation. They allow any property names and variables. But they are more cumbersome to write. So most of the time, when property names are known and simple, the dot is used. And if we need something more complex, then we switch to square brackets. + + + +````smart header="Trailing comma" +The last property in the list may end with a comma: +```js +let user = { + name: "John", + age: 30*!*,*/!* +} +``` +That is called a "trailing" or "hanging" comma. Makes it easier to add/remove/move around properties, because all lines become alike. +```` + + +````smart header="Reserved words are allowed as property names" +A variable cannot have a name equal to one of language-reserved words like "for", "let", "return" etc. + +But for an object property, there's no such restruction. Any name is fine: + +```js run +let obj = { + for: 1, + let: 2, + return: 3 +} + +alert( obj.for + obj.let + obj.return ); // 6 +``` + +Basically, any name is allowed, but there's a special one: `"__proto__"` that gets special treatment for historical reasons. For instance, we can't set it to a non-object value: + +```js run +let obj = { __proto__: 5 }; +alert(obj.__proto__); // [object Object], didn't work as intended +``` + +Later we'll learn more about that `__proto__` and see how to work that problem [todo Object.create(null)]. Also we'll learn another data structure [Map](info:map-set-weakmap-weakset) that doesn't have such problems and supports arbitrary keys. +```` ## Property name shorthand -In real code we quite often want to create an object with a property from a variable. +In real code we often use existing variables as values for property names. For instance: @@ -183,7 +227,7 @@ let user = makeUser("John", 30); alert(user.name); // John ``` -There's a special shorthand notation that is shorter. +In the example above, properties have same names as variables. There's a special shorthand notation that is shorter. Instead of `name:name` we can just write `name`, like this: @@ -208,43 +252,6 @@ let user = { ``` -````smart header="Trailing comma" -The last property may end with a comma: -```js -let user = { - name: "John", - age: 30*!*,*/!* -} -``` -That is called a "trailing" or "hanging" comma. Makes it easier to add/move/remove properties, because all lines become alike. -```` - - -````smart header="Reserved words are allowed as property names" -A variable cannot have a name equal to one of language-reserved words like "for", "let", "return" etc. - -But for an object property, there's no such restruction. Any name is fine: - -```js run -let obj = { - for: 1, - let: 2, - return: 3 -} - -alert( obj.for + obj.let + obj.return ); // 6 -``` - -Basically, any name is allowed, but there's a special one: `"__proto__"`. We can't set it to a non-object value: - -```js run -let obj = { __proto__: 5 }; -alert(obj.__proto__); // [object Object], didn't work as intended -``` - -Later we'll learn more about that `__proto__` and see how to work around it [todo Object.create(null)]. Also we'll learn another data structure [Map](info:map-set-weakmap-weakset) that doesn't have such problems and supports arbitrary keys. -```` - ## Existance check A notable objects feature is that it's possible to access any property. There will be no error if the property doesn't exist! Accessing a non-existing property just returns `undefined`. It provides a very common way to test whether the property exists -- to get it and compare vs undefined: diff --git a/1-js/3-object-basics/1-object/object-user-delete.png b/1-js/4-data-types/01-object/object-user-delete.png similarity index 100% rename from 1-js/3-object-basics/1-object/object-user-delete.png rename to 1-js/4-data-types/01-object/object-user-delete.png diff --git a/1-js/3-object-basics/1-object/object-user-delete@2x.png b/1-js/4-data-types/01-object/object-user-delete@2x.png similarity index 100% rename from 1-js/3-object-basics/1-object/object-user-delete@2x.png rename to 1-js/4-data-types/01-object/object-user-delete@2x.png diff --git a/1-js/3-object-basics/1-object/object-user-empty.png b/1-js/4-data-types/01-object/object-user-empty.png similarity index 100% rename from 1-js/3-object-basics/1-object/object-user-empty.png rename to 1-js/4-data-types/01-object/object-user-empty.png diff --git a/1-js/3-object-basics/1-object/object-user-empty@2x.png b/1-js/4-data-types/01-object/object-user-empty@2x.png similarity index 100% rename from 1-js/3-object-basics/1-object/object-user-empty@2x.png rename to 1-js/4-data-types/01-object/object-user-empty@2x.png diff --git a/1-js/3-object-basics/1-object/object-user-isadmin.png b/1-js/4-data-types/01-object/object-user-isadmin.png similarity index 100% rename from 1-js/3-object-basics/1-object/object-user-isadmin.png rename to 1-js/4-data-types/01-object/object-user-isadmin.png diff --git a/1-js/3-object-basics/1-object/object-user-isadmin@2x.png b/1-js/4-data-types/01-object/object-user-isadmin@2x.png similarity index 100% rename from 1-js/3-object-basics/1-object/object-user-isadmin@2x.png rename to 1-js/4-data-types/01-object/object-user-isadmin@2x.png diff --git a/1-js/3-object-basics/1-object/object-user-props.png b/1-js/4-data-types/01-object/object-user-props.png similarity index 100% rename from 1-js/3-object-basics/1-object/object-user-props.png rename to 1-js/4-data-types/01-object/object-user-props.png diff --git a/1-js/3-object-basics/1-object/object-user-props@2x.png b/1-js/4-data-types/01-object/object-user-props@2x.png similarity index 100% rename from 1-js/3-object-basics/1-object/object-user-props@2x.png rename to 1-js/4-data-types/01-object/object-user-props@2x.png diff --git a/1-js/3-object-basics/1-object/object-user.png b/1-js/4-data-types/01-object/object-user.png similarity index 100% rename from 1-js/3-object-basics/1-object/object-user.png rename to 1-js/4-data-types/01-object/object-user.png diff --git a/1-js/3-object-basics/1-object/object-user@2x.png b/1-js/4-data-types/01-object/object-user@2x.png similarity index 100% rename from 1-js/3-object-basics/1-object/object-user@2x.png rename to 1-js/4-data-types/01-object/object-user@2x.png diff --git a/1-js/3-object-basics/1-object/object.png b/1-js/4-data-types/01-object/object.png similarity index 100% rename from 1-js/3-object-basics/1-object/object.png rename to 1-js/4-data-types/01-object/object.png diff --git a/1-js/3-object-basics/1-object/object@2x.png b/1-js/4-data-types/01-object/object@2x.png similarity index 100% rename from 1-js/3-object-basics/1-object/object@2x.png rename to 1-js/4-data-types/01-object/object@2x.png diff --git a/1-js/3-object-basics/1-object/variable-contains-reference.png b/1-js/4-data-types/01-object/variable-contains-reference.png similarity index 100% rename from 1-js/3-object-basics/1-object/variable-contains-reference.png rename to 1-js/4-data-types/01-object/variable-contains-reference.png diff --git a/1-js/3-object-basics/1-object/variable-contains-reference@2x.png b/1-js/4-data-types/01-object/variable-contains-reference@2x.png similarity index 100% rename from 1-js/3-object-basics/1-object/variable-contains-reference@2x.png rename to 1-js/4-data-types/01-object/variable-contains-reference@2x.png diff --git a/1-js/3-object-basics/1-object/variable-copy-reference.png b/1-js/4-data-types/01-object/variable-copy-reference.png similarity index 100% rename from 1-js/3-object-basics/1-object/variable-copy-reference.png rename to 1-js/4-data-types/01-object/variable-copy-reference.png diff --git a/1-js/3-object-basics/1-object/variable-copy-reference@2x.png b/1-js/4-data-types/01-object/variable-copy-reference@2x.png similarity index 100% rename from 1-js/3-object-basics/1-object/variable-copy-reference@2x.png rename to 1-js/4-data-types/01-object/variable-copy-reference@2x.png diff --git a/1-js/3-object-basics/1-object/variable-copy-value.png b/1-js/4-data-types/01-object/variable-copy-value.png similarity index 100% rename from 1-js/3-object-basics/1-object/variable-copy-value.png rename to 1-js/4-data-types/01-object/variable-copy-value.png diff --git a/1-js/3-object-basics/1-object/variable-copy-value@2x.png b/1-js/4-data-types/01-object/variable-copy-value@2x.png similarity index 100% rename from 1-js/3-object-basics/1-object/variable-copy-value@2x.png rename to 1-js/4-data-types/01-object/variable-copy-value@2x.png diff --git a/1-js/3-object-basics/2-garbage-collection/article.md b/1-js/4-data-types/02-garbage-collection/article.md similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/article.md rename to 1-js/4-data-types/02-garbage-collection/article.md diff --git a/1-js/3-object-basics/2-garbage-collection/family-no-family.png b/1-js/4-data-types/02-garbage-collection/family-no-family.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/family-no-family.png rename to 1-js/4-data-types/02-garbage-collection/family-no-family.png diff --git a/1-js/3-object-basics/2-garbage-collection/family-no-family@2x.png b/1-js/4-data-types/02-garbage-collection/family-no-family@2x.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/family-no-family@2x.png rename to 1-js/4-data-types/02-garbage-collection/family-no-family@2x.png diff --git a/1-js/3-object-basics/2-garbage-collection/family-no-father-2.png b/1-js/4-data-types/02-garbage-collection/family-no-father-2.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/family-no-father-2.png rename to 1-js/4-data-types/02-garbage-collection/family-no-father-2.png diff --git a/1-js/3-object-basics/2-garbage-collection/family-no-father-2@2x.png b/1-js/4-data-types/02-garbage-collection/family-no-father-2@2x.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/family-no-father-2@2x.png rename to 1-js/4-data-types/02-garbage-collection/family-no-father-2@2x.png diff --git a/1-js/3-object-basics/2-garbage-collection/family-no-father.png b/1-js/4-data-types/02-garbage-collection/family-no-father.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/family-no-father.png rename to 1-js/4-data-types/02-garbage-collection/family-no-father.png diff --git a/1-js/3-object-basics/2-garbage-collection/family-no-father@2x.png b/1-js/4-data-types/02-garbage-collection/family-no-father@2x.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/family-no-father@2x.png rename to 1-js/4-data-types/02-garbage-collection/family-no-father@2x.png diff --git a/1-js/3-object-basics/2-garbage-collection/family.png b/1-js/4-data-types/02-garbage-collection/family.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/family.png rename to 1-js/4-data-types/02-garbage-collection/family.png diff --git a/1-js/3-object-basics/2-garbage-collection/family@2x.png b/1-js/4-data-types/02-garbage-collection/family@2x.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/family@2x.png rename to 1-js/4-data-types/02-garbage-collection/family@2x.png diff --git a/1-js/3-object-basics/2-garbage-collection/garbage-collection-1.png b/1-js/4-data-types/02-garbage-collection/garbage-collection-1.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/garbage-collection-1.png rename to 1-js/4-data-types/02-garbage-collection/garbage-collection-1.png diff --git a/1-js/3-object-basics/2-garbage-collection/garbage-collection-1@2x.png b/1-js/4-data-types/02-garbage-collection/garbage-collection-1@2x.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/garbage-collection-1@2x.png rename to 1-js/4-data-types/02-garbage-collection/garbage-collection-1@2x.png diff --git a/1-js/3-object-basics/2-garbage-collection/garbage-collection-2.png b/1-js/4-data-types/02-garbage-collection/garbage-collection-2.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/garbage-collection-2.png rename to 1-js/4-data-types/02-garbage-collection/garbage-collection-2.png diff --git a/1-js/3-object-basics/2-garbage-collection/garbage-collection-2@2x.png b/1-js/4-data-types/02-garbage-collection/garbage-collection-2@2x.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/garbage-collection-2@2x.png rename to 1-js/4-data-types/02-garbage-collection/garbage-collection-2@2x.png diff --git a/1-js/3-object-basics/2-garbage-collection/garbage-collection-3.png b/1-js/4-data-types/02-garbage-collection/garbage-collection-3.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/garbage-collection-3.png rename to 1-js/4-data-types/02-garbage-collection/garbage-collection-3.png diff --git a/1-js/3-object-basics/2-garbage-collection/garbage-collection-3@2x.png b/1-js/4-data-types/02-garbage-collection/garbage-collection-3@2x.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/garbage-collection-3@2x.png rename to 1-js/4-data-types/02-garbage-collection/garbage-collection-3@2x.png diff --git a/1-js/3-object-basics/2-garbage-collection/garbage-collection-4.png b/1-js/4-data-types/02-garbage-collection/garbage-collection-4.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/garbage-collection-4.png rename to 1-js/4-data-types/02-garbage-collection/garbage-collection-4.png diff --git a/1-js/3-object-basics/2-garbage-collection/garbage-collection-4@2x.png b/1-js/4-data-types/02-garbage-collection/garbage-collection-4@2x.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/garbage-collection-4@2x.png rename to 1-js/4-data-types/02-garbage-collection/garbage-collection-4@2x.png diff --git a/1-js/3-object-basics/2-garbage-collection/garbage-collection-5.png b/1-js/4-data-types/02-garbage-collection/garbage-collection-5.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/garbage-collection-5.png rename to 1-js/4-data-types/02-garbage-collection/garbage-collection-5.png diff --git a/1-js/3-object-basics/2-garbage-collection/garbage-collection-5@2x.png b/1-js/4-data-types/02-garbage-collection/garbage-collection-5@2x.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/garbage-collection-5@2x.png rename to 1-js/4-data-types/02-garbage-collection/garbage-collection-5@2x.png diff --git a/1-js/3-object-basics/2-garbage-collection/garbage-collection.png b/1-js/4-data-types/02-garbage-collection/garbage-collection.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/garbage-collection.png rename to 1-js/4-data-types/02-garbage-collection/garbage-collection.png diff --git a/1-js/3-object-basics/2-garbage-collection/garbage-collection@2x.png b/1-js/4-data-types/02-garbage-collection/garbage-collection@2x.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/garbage-collection@2x.png rename to 1-js/4-data-types/02-garbage-collection/garbage-collection@2x.png diff --git a/1-js/3-object-basics/2-garbage-collection/memory-user-john-admin.png b/1-js/4-data-types/02-garbage-collection/memory-user-john-admin.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/memory-user-john-admin.png rename to 1-js/4-data-types/02-garbage-collection/memory-user-john-admin.png diff --git a/1-js/3-object-basics/2-garbage-collection/memory-user-john-admin@2x.png b/1-js/4-data-types/02-garbage-collection/memory-user-john-admin@2x.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/memory-user-john-admin@2x.png rename to 1-js/4-data-types/02-garbage-collection/memory-user-john-admin@2x.png diff --git a/1-js/3-object-basics/2-garbage-collection/memory-user-john-lost.png b/1-js/4-data-types/02-garbage-collection/memory-user-john-lost.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/memory-user-john-lost.png rename to 1-js/4-data-types/02-garbage-collection/memory-user-john-lost.png diff --git a/1-js/3-object-basics/2-garbage-collection/memory-user-john-lost@2x.png b/1-js/4-data-types/02-garbage-collection/memory-user-john-lost@2x.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/memory-user-john-lost@2x.png rename to 1-js/4-data-types/02-garbage-collection/memory-user-john-lost@2x.png diff --git a/1-js/3-object-basics/2-garbage-collection/memory-user-john.png b/1-js/4-data-types/02-garbage-collection/memory-user-john.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/memory-user-john.png rename to 1-js/4-data-types/02-garbage-collection/memory-user-john.png diff --git a/1-js/3-object-basics/2-garbage-collection/memory-user-john@2x.png b/1-js/4-data-types/02-garbage-collection/memory-user-john@2x.png similarity index 100% rename from 1-js/3-object-basics/2-garbage-collection/memory-user-john@2x.png rename to 1-js/4-data-types/02-garbage-collection/memory-user-john@2x.png diff --git a/1-js/3-object-basics/3-object-methods/2-check-syntax/solution.md b/1-js/4-data-types/03-object-methods/2-check-syntax/solution.md similarity index 100% rename from 1-js/3-object-basics/3-object-methods/2-check-syntax/solution.md rename to 1-js/4-data-types/03-object-methods/2-check-syntax/solution.md diff --git a/1-js/3-object-basics/3-object-methods/2-check-syntax/task.md b/1-js/4-data-types/03-object-methods/2-check-syntax/task.md similarity index 100% rename from 1-js/3-object-basics/3-object-methods/2-check-syntax/task.md rename to 1-js/4-data-types/03-object-methods/2-check-syntax/task.md diff --git a/1-js/3-object-basics/3-object-methods/3-why-this/solution.md b/1-js/4-data-types/03-object-methods/3-why-this/solution.md similarity index 100% rename from 1-js/3-object-basics/3-object-methods/3-why-this/solution.md rename to 1-js/4-data-types/03-object-methods/3-why-this/solution.md diff --git a/1-js/3-object-basics/3-object-methods/3-why-this/task.md b/1-js/4-data-types/03-object-methods/3-why-this/task.md similarity index 100% rename from 1-js/3-object-basics/3-object-methods/3-why-this/task.md rename to 1-js/4-data-types/03-object-methods/3-why-this/task.md diff --git a/1-js/3-object-basics/3-object-methods/4-object-property-this/solution.md b/1-js/4-data-types/03-object-methods/4-object-property-this/solution.md similarity index 100% rename from 1-js/3-object-basics/3-object-methods/4-object-property-this/solution.md rename to 1-js/4-data-types/03-object-methods/4-object-property-this/solution.md diff --git a/1-js/3-object-basics/3-object-methods/4-object-property-this/task.md b/1-js/4-data-types/03-object-methods/4-object-property-this/task.md similarity index 100% rename from 1-js/3-object-basics/3-object-methods/4-object-property-this/task.md rename to 1-js/4-data-types/03-object-methods/4-object-property-this/task.md diff --git a/1-js/3-object-basics/3-object-methods/7-calculator/_js.view/solution.js b/1-js/4-data-types/03-object-methods/7-calculator/_js.view/solution.js similarity index 100% rename from 1-js/3-object-basics/3-object-methods/7-calculator/_js.view/solution.js rename to 1-js/4-data-types/03-object-methods/7-calculator/_js.view/solution.js diff --git a/1-js/3-object-basics/3-object-methods/7-calculator/_js.view/test.js b/1-js/4-data-types/03-object-methods/7-calculator/_js.view/test.js similarity index 100% rename from 1-js/3-object-basics/3-object-methods/7-calculator/_js.view/test.js rename to 1-js/4-data-types/03-object-methods/7-calculator/_js.view/test.js diff --git a/1-js/3-object-basics/3-object-methods/7-calculator/solution.md b/1-js/4-data-types/03-object-methods/7-calculator/solution.md similarity index 100% rename from 1-js/3-object-basics/3-object-methods/7-calculator/solution.md rename to 1-js/4-data-types/03-object-methods/7-calculator/solution.md diff --git a/1-js/3-object-basics/3-object-methods/7-calculator/task.md b/1-js/4-data-types/03-object-methods/7-calculator/task.md similarity index 100% rename from 1-js/3-object-basics/3-object-methods/7-calculator/task.md rename to 1-js/4-data-types/03-object-methods/7-calculator/task.md diff --git a/1-js/3-object-basics/3-object-methods/8-chain-calls/solution.md b/1-js/4-data-types/03-object-methods/8-chain-calls/solution.md similarity index 100% rename from 1-js/3-object-basics/3-object-methods/8-chain-calls/solution.md rename to 1-js/4-data-types/03-object-methods/8-chain-calls/solution.md diff --git a/1-js/3-object-basics/3-object-methods/8-chain-calls/task.md b/1-js/4-data-types/03-object-methods/8-chain-calls/task.md similarity index 100% rename from 1-js/3-object-basics/3-object-methods/8-chain-calls/task.md rename to 1-js/4-data-types/03-object-methods/8-chain-calls/task.md diff --git a/1-js/3-object-basics/4-primitives-methods/1-string-new-property/solution.md b/1-js/4-data-types/03-object-methods/9-string-new-property/solution.md similarity index 100% rename from 1-js/3-object-basics/4-primitives-methods/1-string-new-property/solution.md rename to 1-js/4-data-types/03-object-methods/9-string-new-property/solution.md diff --git a/1-js/3-object-basics/4-primitives-methods/1-string-new-property/task.md b/1-js/4-data-types/03-object-methods/9-string-new-property/task.md similarity index 100% rename from 1-js/3-object-basics/4-primitives-methods/1-string-new-property/task.md rename to 1-js/4-data-types/03-object-methods/9-string-new-property/task.md diff --git a/1-js/3-object-basics/3-object-methods/article.md b/1-js/4-data-types/03-object-methods/article.md similarity index 50% rename from 1-js/3-object-basics/3-object-methods/article.md rename to 1-js/4-data-types/03-object-methods/article.md index ff049d75..2b27bacb 100644 --- a/1-js/3-object-basics/3-object-methods/article.md +++ b/1-js/4-data-types/03-object-methods/article.md @@ -15,6 +15,8 @@ Let's implement the same in Javascript using functions in properties. [cut] +## Method examples + For the start, let's teach the `user` to say hello: ```js run @@ -46,7 +48,7 @@ When we write our code using objects to represent entities, that's called an [ob OOP is a big thing, an interesting science of its own. How to choose the right entities? How to organize the interaction between them? That's architecture. We will make use of OOP further when we get enough familarity with the language. ``` -Of course, we could use a Function Declaration for the same purpose: +Of course, we could use a Function Declaration to add a method: ```js run let user = { @@ -54,10 +56,12 @@ let user = { }; *!* +// first, declare function sayHi() { alert("Hello!"); }; +// then add the method user.sayHi = sayHi; */!* @@ -66,7 +70,7 @@ user.sayHi(); // Hello! That would also work, but is longer. Also we get an "extra" function `sayHi` outside of the `user` object. Usually we don't want that. -## Method shorthand +### Method shorthand There exists a shorter syntax for methods in an object literal: @@ -159,21 +163,21 @@ admin.sayHi(); // wops! inside sayHi(), the old name is used! error! If we used `this.name` instead of `user.name` inside the `alert`, then the code would work. -## "this" is free +## "this" is not bound -In Javascript, "this" keyword behaves unlike most other programming languages. +In Javascript, "this" keyword behaves unlike most other programming languages. First, it can be used in any function. -The "this" keyword can be used in any function. There's no syntax error in the code like that: +There's no syntax error in the code like that: ```js function sayHi() { - alert( this.name ); + alert( *!*this*/!*.name ); } ``` -It is fully syntactically free. The value of `this` will be evaluated during the run-time. +The value of `this` is evaluated during the run-time. And it can be anything. -For instance, the function may have different "this" when called in contexts of different objects: +For instance, the same function may have different "this" when called from different objects: ```js run let user = { name: "John" }; @@ -183,16 +187,18 @@ function sayHi() { alert( this.name ); } +*!* // use the same functions in two objects user.f = sayHi; -admin.g = sayHi; +admin.f = sayHi; +*/!* // these calls have different this // "this" inside the function is the object "before the dot" user.f(); // John (this == user) -admin.g(); // Admin (this == admin) +admin.f(); // Admin (this == admin) -admin['g'](); // Admin (dot or square brackets access the method – doesn't matter) +admin['f'](); // Admin (dot or square brackets access the method – doesn't matter) ``` Actually, we can call the function without an object at all: @@ -205,13 +211,14 @@ function sayHi() { sayHi(); ``` -In this case `this` is `undefined` in strict mode. If we try to access `this.name`, there will be an error. +In this case `this` is `undefined` in strict mode. If we try to access `this.name`, there will be an error. -Please note that usually a call like this is not normal, but rather a programming mistake. If a function has `this`, then it is usually to be called in the context of an object. +In non-strict mode (if you forgot `use strict`) the value of `this` in such case will be the *global object* (`"window"` for browser, we'll study it later). This is just a historical thing that `"use strict"` fixes. -In a non-strict mode, if you forget `use strict` (let's hope you don't), then the value of `this` for a function without an object will be the *global object* (`"window"` for browser). We'll return to it later, but in a completely different chapter, because here it's just an odd thing of the previous standard that `"use strict"` fixes. -## Reference Type +Please note that usually a call of a function using `this` without an object is not normal, but rather a programming mistake. If a function has `this`, then it is usually meant to be called in the context of an object. + +## Internals: Reference Type An intricate method call can loose `this`, for instance: @@ -230,14 +237,17 @@ user.hi(); // John (the simple call works) */!* ``` -On the last line the method `user.hi` is retrieved during the execution of the ternary `?`, and immediately called with brackets `()`. But that doesn't work right. You can see that the call results in an error, cause the value of `"this"` inside the call becomes `undefined`. +On the last line there is an intricate code that evaluates an expression to get the method. In this case the result is `user.hi`. + +The method is immediately called with brackets `()`. But that doesn't work right. You can see that the call results in an error, cause the value of `"this"` inside the call becomes `undefined`. Actually, anything more complex than a simple `obj.method()` (or square brackets here) looses `this`. -If we want to understand why it happens -- the reason is in the details of how `obj.method()` call works. +If we want to understand why it happens -- let's get under the hood of how `obj.method()` call works. -The method call is not a single thing. It has two successive operations in it: -- the dot `'.'` retrieves the property +Looking closely, we may notice two operations in `obj.method()` statement: + +- the dot `'.'` retrieves the property `obj.method`. - brackets `()` execute it (assuming that's a function). So, you might have already asked yourself, why does it work? That is, if we put these operations on separate lines, then `this` will be lost for sure: @@ -257,17 +267,17 @@ hi(); // Error, because this is undefined That's because a function is a value of its own. It does not carry the object. So `hi = user.hi` saves it into the variable, and then on the last line it is completely standalone. -To make `user.hi()` calls work, Javascript uses a trick -- the dot `'.'` returns not a function, but a value of the special [Reference Type](https://tc39.github.io/ecma262/#sec-reference-specification-type). +**To make `user.hi()` calls work, Javascript uses a trick -- the dot `'.'` returns not a function, but a value of the special [Reference Type](https://tc39.github.io/ecma262/#sec-reference-specification-type).** -The Reference Type is a "specification type". We can't explicitly access it, but it is used internally by the language. +The Reference Type is a "specification type". We can't explicitly use it, but it is used internally by the language. -The value of the Reference Type is a combination `(base, name, strict)`, where: +The value of Reference Type is a three-value combination `(base, name, strict)`, where: - `base` is the object. - `name` is the property. - `strict` is true if `use strict` is in effect. -The result of a property access `'.'` is a value of the Reference Type. For `user.hi` in strict mode it is: +The result of a property access `'.'` is a value of Reference Type. For `user.hi` in strict mode it is: ```js // Reference Type value @@ -280,8 +290,78 @@ Any other operation like assignment `hi = user.hi` discards the reference type a So, as the result, the value of `this` is only passed the right way if the function is called directly using a dot `obj.method()` or square brackets `obj[method]()` syntax (they do the same here). +## Methods on primitives [todo: remove] + +In JavaScript primitives (strings, numbers etc) also have methods, as if they were objects. Still, primitives are not objects, and this section explains the interesting design solution of Javascript that makes it possible. + +Let's formulate the definitive distinction between primitives and objects. + +A primitive +: Is a value of one of 6 primitive types: `string`, `number`, `boolean`, `symbol`, `null` and `undefined`. + +An object +: Can be created with `{}`, for instance: `{name: "John", age: 30}`, is capable of storing multiple values as properties. There are other kinds of objects in JavaScript, e.g. functions are objects, there are objects that work with dates, errors and so on. They have different properties and methods. + +But features come at a price! + +Objects are "heavier" than primitives. They require additional resources to support the internal machinery. But properties and methods are useful in programming, Javascript engines try to optimize them, so the price is usually fair. + +So here's the paradox faced by the creator of JavaScript: + +- There are many things one would want to do with a primitive like a string or a number. Could be great to access them as methods. +- Primitives must be as fast and lightweight as possible. + +The solution looks a little bit awkward, but here it is. + +1. Primitives are still primitive. A single lightweight value, as described. +2. The language allows to access methods and properties of strings, numbers, booleans and symbols. +3. When it happens, a special "object wrapper" is created, it provides the functionality, and then is destroyed. + +The "object wrappers" are different for each primitive type and are named specifically: `String`, `Number`, `Boolean` and `Symbol`. Thus they provide different sets of methods. + +For instance, there exists a method [str.toUpperCase()](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase) that returns the capitalized string. + +Here's how it works: + +```js run +let str = "Hello"; + +alert( str.toUpperCase() ); // HELLO +``` + +Simple, right? And here's what actually happens in `str.toUpperCase()`: + +1. The string `str` is a primitive. So in the moment of accessing its property a special object is created that both knows the value of the string and has useful methods, like `toUpperCase()`. +2. That method runs and returns a new string (shown by `alert`). +3. The special object is destroyed, leaving the primitive `str` alone. + +So, primitives can provide methods, but they still remain lightweight. + +Of course, a JavaScript engine highly optimizes that process. Internally it may skip creation of the extra object at all. But it must adhere to the specification and behave as if it creates one. + +A number has methods of it's own, for instance, [toFixed(n)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed) rounds the number to the given precision: + +```js run +let n = 1.23456; + +alert( n.toFixed(2) ); // 1.23 +``` + +We'll learn more specific methods in next chapters. + +````warn header="null/undefined have no methods" +Special primitives `null` and `undefined` are exceptions. They have no corresponding "wrapper objects" and provide no methods. In a sense, they are "the most primitive". + +An attempt to access a property of such value would give an error: + +```js run +alert(null.test); // error +```` ## Summary -[todo] \ No newline at end of file +[todo] + +- Primitives except `null` and `undefined` provide many helpful methods. We plan to study those in the next chapters. +- Formally, these methods work via temporary objects, but JavaScript engines are very well tuned to optimize that internally, so they are not expensive to call. diff --git a/1-js/4-data-types/04-constructor-new/1-two-functions-one-object/solution.md b/1-js/4-data-types/04-constructor-new/1-two-functions-one-object/solution.md new file mode 100644 index 00000000..f875fca0 --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/1-two-functions-one-object/solution.md @@ -0,0 +1,18 @@ +Да, возможны. + +Они должны возвращать одинаковый объект. При этом если функция возвращает объект, то `this` не используется. + +Например, они могут вернуть один и тот же объект `obj`, определённый снаружи: + +```js run no-beautify +var obj = {}; + +function A() { return obj; } +function B() { return obj; } + +var a = new A; +var b = new B; + +alert( a == b ); // true +``` + diff --git a/1-js/4-data-types/04-constructor-new/1-two-functions-one-object/task.md b/1-js/4-data-types/04-constructor-new/1-two-functions-one-object/task.md new file mode 100644 index 00000000..287bfc1f --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/1-two-functions-one-object/task.md @@ -0,0 +1,19 @@ +importance: 2 + +--- + +# Две функции один объект + +Возможны ли такие функции `A` и `B` в примере ниже, что соответствующие объекты `a,b` равны (см. код ниже)? + +```js no-beautify +function A() { ... } +function B() { ... } + +var a = new A; +var b = new B; + +alert( a == b ); // true +``` + +Если да -- приведите пример кода с такими функциями. \ No newline at end of file diff --git a/1-js/4-data-types/04-constructor-new/2-calculator-constructor/_js.view/solution.js b/1-js/4-data-types/04-constructor-new/2-calculator-constructor/_js.view/solution.js new file mode 100644 index 00000000..3b51b2e6 --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/2-calculator-constructor/_js.view/solution.js @@ -0,0 +1,15 @@ +function Calculator() { + + this.read = function() { + this.a = +prompt('a?', 0); + this.b = +prompt('b?', 0); + }; + + this.sum = function() { + return this.a + this.b; + }; + + this.mul = function() { + return this.a * this.b; + }; +} \ No newline at end of file diff --git a/1-js/4-data-types/04-constructor-new/2-calculator-constructor/_js.view/test.js b/1-js/4-data-types/04-constructor-new/2-calculator-constructor/_js.view/test.js new file mode 100644 index 00000000..ef881c45 --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/2-calculator-constructor/_js.view/test.js @@ -0,0 +1,25 @@ +sinon.stub(window, "prompt") + +prompt.onCall(0).returns("2"); +prompt.onCall(1).returns("3"); + +describe("calculator", function() { + var calculator; + before(function() { + calculator = new Calculator(); + calculator.read(); + }); + + it("при вводе 2 и 3 сумма равна 5", function() { + assert.equal(calculator.sum(), 5); + }); + + it("при вводе 2 и 3 произведение равно 6", function() { + assert.equal(calculator.mul(), 6); + }); + +}); + +after(function() { + prompt.restore(); +}); \ No newline at end of file diff --git a/1-js/4-data-types/04-constructor-new/2-calculator-constructor/solution.md b/1-js/4-data-types/04-constructor-new/2-calculator-constructor/solution.md new file mode 100644 index 00000000..bbff1040 --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/2-calculator-constructor/solution.md @@ -0,0 +1,26 @@ + + +```js run demo +function Calculator() { + + this.read = function() { + this.a = +prompt('a?', 0); + this.b = +prompt('b?', 0); + }; + + this.sum = function() { + return this.a + this.b; + }; + + this.mul = function() { + return this.a * this.b; + }; +} + +var calculator = new Calculator(); +calculator.read(); + +alert( "Сумма=" + calculator.sum() ); +alert( "Произведение=" + calculator.mul() ); +``` + diff --git a/1-js/4-data-types/04-constructor-new/2-calculator-constructor/task.md b/1-js/4-data-types/04-constructor-new/2-calculator-constructor/task.md new file mode 100644 index 00000000..54f844c9 --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/2-calculator-constructor/task.md @@ -0,0 +1,24 @@ +importance: 5 + +--- + +# Создать Calculator при помощи конструктора + +Напишите *функцию-конструктор* `Calculator`, которая создает объект с тремя методами: + +- Метод `read()` запрашивает два значения при помощи `prompt` и запоминает их в свойствах объекта. +- Метод `sum()` возвращает сумму запомненных свойств. +- Метод `mul()` возвращает произведение запомненных свойств. + +Пример использования: + +```js +var calculator = new Calculator(); +calculator.read(); + +alert( "Сумма=" + calculator.sum() ); +alert( "Произведение=" + calculator.mul() ); +``` + +[demo] + diff --git a/1-js/4-data-types/04-constructor-new/3-accumulator/_js.view/solution.js b/1-js/4-data-types/04-constructor-new/3-accumulator/_js.view/solution.js new file mode 100644 index 00000000..bd744597 --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/3-accumulator/_js.view/solution.js @@ -0,0 +1,8 @@ +function Accumulator(startingValue) { + this.value = startingValue; + + this.read = function() { + this.value += +prompt('Сколько добавлять будем?', 0); + }; + +} \ No newline at end of file diff --git a/1-js/4-data-types/04-constructor-new/3-accumulator/_js.view/test.js b/1-js/4-data-types/04-constructor-new/3-accumulator/_js.view/test.js new file mode 100644 index 00000000..aa651b11 --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/3-accumulator/_js.view/test.js @@ -0,0 +1,37 @@ +describe("Accumulator(1)", function() { + var accumulator; + before(function() { + accumulator = new Accumulator(1); + }); + + beforeEach(function() { + sinon.stub(window, "prompt") + }); + + afterEach(function() { + prompt.restore(); + }); + + it("начальное значение 1", function() { + assert.equal(accumulator.value, 1); + }); + + it("после ввода 0 значение 1", function() { + prompt.returns("0"); + accumulator.read(); + assert.equal(accumulator.value, 1); + }); + + it("после ввода 1 значение 2", function() { + prompt.returns("1"); + accumulator.read(); + assert.equal(accumulator.value, 2); + }); + + it("после ввода 2 значение 4", function() { + prompt.returns("2"); + accumulator.read(); + assert.equal(accumulator.value, 4); + }); + +}); \ No newline at end of file diff --git a/1-js/4-data-types/04-constructor-new/3-accumulator/solution.md b/1-js/4-data-types/04-constructor-new/3-accumulator/solution.md new file mode 100644 index 00000000..f348cdc2 --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/3-accumulator/solution.md @@ -0,0 +1,18 @@ + + +```js run demo +function Accumulator(startingValue) { + this.value = startingValue; + + this.read = function() { + this.value += +prompt('Сколько добавлять будем?', 0); + }; + +} + +var accumulator = new Accumulator(1); +accumulator.read(); +accumulator.read(); +alert( accumulator.value ); +``` + diff --git a/1-js/4-data-types/04-constructor-new/3-accumulator/task.md b/1-js/4-data-types/04-constructor-new/3-accumulator/task.md new file mode 100644 index 00000000..3bd5b5a0 --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/3-accumulator/task.md @@ -0,0 +1,27 @@ +importance: 5 + +--- + +# Создать Accumulator при помощи конструктора + +Напишите *функцию-конструктор* `Accumulator(startingValue)`. +Объекты, которые она создает, должны хранить текущую сумму и прибавлять к ней то, что вводит посетитель. + +Более формально, объект должен: + +- Хранить текущее значение в своём свойстве `value`. Начальное значение свойства `value` ставится конструктором равным `startingValue`. +- Метод `read()` вызывает `prompt`, принимает число и прибавляет его к свойству `value`. + +Таким образом, свойство `value` является текущей суммой всего, что ввел посетитель при вызовах метода `read()`, с учетом начального значения `startingValue`. + +Ниже вы можете посмотреть работу кода: + +```js +var accumulator = new Accumulator(1); // начальное значение 1 +accumulator.read(); // прибавит ввод prompt к текущему значению +accumulator.read(); // прибавит ввод prompt к текущему значению +alert( accumulator.value ); // выведет текущее значение +``` + +[demo] + diff --git a/1-js/4-data-types/04-constructor-new/4-calculator-extendable/_js.view/solution.js b/1-js/4-data-types/04-constructor-new/4-calculator-extendable/_js.view/solution.js new file mode 100644 index 00000000..e2942e02 --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/4-calculator-extendable/_js.view/solution.js @@ -0,0 +1,29 @@ +function Calculator() { + + var methods = { + "-": function(a, b) { + return a - b; + }, + "+": function(a, b) { + return a + b; + } + }; + + this.calculate = function(str) { + + var split = str.split(' '), + a = +split[0], + op = split[1], + b = +split[2] + + if (!methods[op] || isNaN(a) || isNaN(b)) { + return NaN; + } + + return methods[op](a, b); + } + + this.addMethod = function(name, func) { + methods[name] = func; + }; +} diff --git a/1-js/4-data-types/04-constructor-new/4-calculator-extendable/_js.view/test.js b/1-js/4-data-types/04-constructor-new/4-calculator-extendable/_js.view/test.js new file mode 100644 index 00000000..2c6891a9 --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/4-calculator-extendable/_js.view/test.js @@ -0,0 +1,26 @@ +var calculator; +before(function() { + calculator = new Calculator; +}); + +it("calculate(12 + 34) = 46", function() { + assert.equal(calculator.calculate("12 + 34"), 46); +}); + +it("calculate(34 - 12) = 22", function() { + assert.equal(calculator.calculate("34 - 12"), 22); +}); + +it("добавили умножение: calculate(2 * 3) = 6", function() { + calculator.addMethod("*", function(a, b) { + return a * b; + }); + assert.equal(calculator.calculate("2 * 3"), 6); +}); + +it("добавили возведение в степень: calculate(2 ** 3) = 8", function() { + calculator.addMethod("**", function(a, b) { + return Math.pow(a, b); + }); + assert.equal(calculator.calculate("2 ** 3"), 8); +}); \ No newline at end of file diff --git a/1-js/4-data-types/04-constructor-new/4-calculator-extendable/solution.md b/1-js/4-data-types/04-constructor-new/4-calculator-extendable/solution.md new file mode 100644 index 00000000..3c24691c --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/4-calculator-extendable/solution.md @@ -0,0 +1,52 @@ + + +```js run +function Calculator() { + + var methods = { + "-": function(a, b) { + return a - b; + }, + "+": function(a, b) { + return a + b; + } + }; + + this.calculate = function(str) { + + var split = str.split(' '), + a = +split[0], + op = split[1], + b = +split[2] + + if (!methods[op] || isNaN(a) || isNaN(b)) { + return NaN; + } + + return methods[op](+a, +b); + } + + this.addMethod = function(name, func) { + methods[name] = func; + }; +} + +var calc = new Calculator; + +calc.addMethod("*", function(a, b) { + return a * b; +}); +calc.addMethod("/", function(a, b) { + return a / b; +}); +calc.addMethod("**", function(a, b) { + return Math.pow(a, b); +}); + +var result = calc.calculate("2 ** 3"); +alert( result ); // 8 +``` + +- Обратите внимание на хранение методов. Они просто добавляются к внутреннему объекту. +- Все проверки и преобразование к числу производятся в методе `calculate`. В дальнейшем он может быть расширен для поддержки более сложных выражений. + diff --git a/1-js/4-data-types/04-constructor-new/4-calculator-extendable/task.md b/1-js/4-data-types/04-constructor-new/4-calculator-extendable/task.md new file mode 100644 index 00000000..01be7349 --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/4-calculator-extendable/task.md @@ -0,0 +1,42 @@ +importance: 5 + +--- + +# Создайте калькулятор + +Напишите конструктор `Calculator`, который создаёт расширяемые объекты-калькуляторы. + +Эта задача состоит из двух частей, которые можно решать одна за другой. + +1. Первый шаг задачи: вызов `calculate(str)` принимает строку, например "1 + 2", с жёстко заданным форматом "ЧИСЛО операция ЧИСЛО" (по одному пробелу вокруг операции), и возвращает результат. Понимает плюс `+` и минус `-`. + + Пример использования: + + ```js + var calc = new Calculator; + + alert( calc.calculate("3 + 7") ); // 10 + ``` +2. Второй шаг -- добавить калькулятору метод `addMethod(name, func)`, который учит калькулятор новой операции. Он получает имя операции `name` и функцию от двух аргументов `func(a,b)`, которая должна её реализовывать. + + Например, добавим операции умножить `*`, поделить `/` и возвести в степень `**`: + + ```js + var powerCalc = new Calculator; + powerCalc.addMethod("*", function(a, b) { + return a * b; + }); + powerCalc.addMethod("/", function(a, b) { + return a / b; + }); + powerCalc.addMethod("**", function(a, b) { + return Math.pow(a, b); + }); + + var result = powerCalc.calculate("2 ** 3"); + alert( result ); // 8 + ``` + +- Поддержка скобок и сложных математических выражений в этой задаче не требуется. +- Числа и операции могут состоять из нескольких символов. Между ними ровно один пробел. +- Предусмотрите обработку ошибок. Какая она должна быть - решите сами. diff --git a/1-js/4-data-types/04-constructor-new/article.md b/1-js/4-data-types/04-constructor-new/article.md new file mode 100644 index 00000000..81e11db0 --- /dev/null +++ b/1-js/4-data-types/04-constructor-new/article.md @@ -0,0 +1,182 @@ +# Using "new" to create objects + +The regular `{...}` syntax allows to create one object. But often we need to create many similar objects. + +That can be done using constructor functions and the `"new"` operator. + +[cut] + +## Constructor function + +Constructor functions technically are regular functions. There are two agreements though: + +1. They are named with capital letter first. +2. They should be executed only with `"new"` operator. + +For instance: + +```js run +function User(name) { + this.name = name; + this.isAdmin = false; +} + +*!* +let user = new User("Jack"); +*/!* + +alert(user.name); // Jack +alert(user.isAdmin); // false +``` + +When a function is executed as `new User(...)`, it does the following steps: + +1. A new empty object is created and assigned to `this`. +2. The function executes. Usually it modifies `this`, adds new properties to it. +3. The value of `this` is returned. + +In other words, `new User(...)` does something like: + +```js +function User(name) { +*!* + // this = {}; (implicitly) +*/!* + + // we add properties to this + this.name = name; + this.isAdmin = false; + +*!* + // return this; (implicitly) +*/!* +} +``` + +So the result of `new User("Jack")` is the same object as: + +```js +let user = { + name: "Jack", + isAdmin: false +}; +``` + +Now if we want to create other users, we can call `new User("Ann")`, `new User("Alice")` and so on. Much shorter than using literals every time, and also reads well. + +That's the main purpose of constructors -- to implement reusable object creation code. + +Let's note once again -- technically, any function can be used as a constructor. That is: any function can be run with `new`, and it will execute the algorithm above. The "capital letter first" is a common agreement, to make it clear that a function is to be run with `new`. + +````smart header="new function() { ... }" +If we have many lines of code all about creation of a single complex object, we can wrap them in constructor function, like this: + +```js +let user = new function() { + this.name = "John"; + this.isAdmin = false; + + // ...other code for user creation + // maybe complex logic and statements + // local variables etc +}; +``` + +The constructor can't be called again, because it is not saved anywhere, just created and called. So this trick aims to encapsulate the code for a single complex object only. +```` + +## Return from constructors + +Usually, constructors do not have a `return` statement. Their task is to write all necessary stuff into `this`, that automatically becomes the result. + +But if there is a `return` statement, then the rule is simple: + +- If `return` is called with object, then it is returned instead of `this`. +- If `return` is called with a primitive, it's ignored. + +In other words, `return` with an object returns that object, with a non-object value -- returns `this` as usual. + +For instance, returning an object: + +```js run +function BigUser() { + + this.name = "John"; + + return { name: "Godzilla" }; // <-- returns an object +} + +alert( new BigUser().name ); // Godzilla, got that object +``` + +And here's an example with returning a string: + +```js run +function SmallUser() { + + this.name = "John"; + + return "Mouse"; // <-- returns a primitive +} + +alert( new SmallUser().name ); // John, got "this" (mouse disappeared) +``` + +Once again, most of time constructors return nothing. Here we mention this special aspect of constructors for completeness. + +````smart header="Omitting brackets" +By the way, we can omit brackets after `new` with zero arguments: + +```js +let user = new User; // <-- no brackets +// same as +let user = new User(); +``` + +Omitting brackets here is not considered a "good style", but the syntax is allowed by specification. +```` + +## Methods in constructor + +Using constuctor functions to create objects gives a great deal of flexibility. The constructor may have parameters that define how to construct the object, what to put in it. + +Let's add a method. + +For instance, `new User(name)` below creates an object with the given `name` and the method `sayHi`: + +```js run +function User(name) { + this.name = name; + + this.sayHi = function() { + alert( "My name is: " + this.name ); + }; +} + +*!* +let john = new User("John"); + +john.sayHi(); // My name is: John +*/!* + +/* +john = { + name: "John", + sayHi: function +} +*/ +``` + +## Summary + +In this chapter we studied the basics of object constructors. + +- Constructor functions are regular functions, but there's a common agreement to name them with capital letter first. +- Constructor functions should only be called using `new`. Such call implies a creation of empty `this` at the start and returning the populated one at the end. + +We can already use constructor functions to make multiple similar objects. But the topic is much wider than described here. So we'll return it later and cover more in-depth. + +Now it's important to understand what `new` is, because Javascript provides constructor functions for many built-in language objects: like `Date` for dates, `Set` for sets and others that we plan to study. + + + diff --git a/1-js/3-object-basics/5-symbol/article.md b/1-js/4-data-types/05-symbol/article.md similarity index 56% rename from 1-js/3-object-basics/5-symbol/article.md rename to 1-js/4-data-types/05-symbol/article.md index 8dc01365..bbfb96c9 100644 --- a/1-js/3-object-basics/5-symbol/article.md +++ b/1-js/4-data-types/05-symbol/article.md @@ -1,7 +1,15 @@ # Symbol type -A "symbol" represents an unique identifier with a given name. +By specification, object property keys may be either of string type, or of symbol type. Not numbers, not booleans, only strings or symbols, these two types. + +Till now we only saw strings. Now let's see the advantages that symbols can give us. + +[cut] + +## Symbols + +"Symbol" value represents an unique identifier with a given name. A value of this type can be created using `Symbol(name)`: @@ -10,7 +18,9 @@ A value of this type can be created using `Symbol(name)`: let id = Symbol("id"); ``` -Symbols in JavaScript are different from symbols in Ruby language (if you are familiar with it, please don't get trapped by the same word). Two symbols with the same name are not the same: +Symbols are guaranteed to be unique. Even if we create many symbols with the same name, they are different values. + +For instance, here are two symbols with the same name -- they are not equal: ```js run let id1 = Symbol("id"); @@ -21,7 +31,8 @@ alert(id1 == id2); // false */!* ``` -Symbols is a special primitive type used for identifiers, which are guaranteed to be unique. So, even if we create many symbols with the same name, they are still unique. +If you are familiar with Ruby or another language that uses the "symbol" concept -- please don't be misguided. Javascript symbols are pretty different. + ## "Private" properties @@ -37,11 +48,22 @@ user[id] = "ID Value"; alert( user[id] ); // we can access the data using the symbol as the key ``` -Now let's imagine that another script wants to have his own "id" property inside `user`, for his own purposes. That may be another javascript library, so the scripts are completely unaware for each other. +Now let's imagine that another script wants to have his own "id" property inside `user`, for his own purposes. That may be another Javascript library, so the scripts are completely unaware for each other. -No problem. It can create its own `Symbol("id")`. There will be no conflict, because symbols are always different, even if they have the same name. +No problem. It can create its own `Symbol("id")`. -Please note that if we used a string `"id"` instead of a symbol for the same purpose, then there would be a conflict: +Their script: + +```js +// ... +let id = Symbol("id"); + +user[id] = "Their id value"; +``` + +There will be no conflict, because symbols are always different, even if they have the same name. + +Please note that if we used a string `"id"` instead of a symbol for the same purpose, then there *would* be a conflict: ```js run let user = { name: "John" }; @@ -51,13 +73,13 @@ user.id = "ID Value"; // ...if later another script the uses "id" for its purposes... -user.id = "ID 2" +user.id = "Their id value" // boom! overwritten! it did not mean to harm the colleague, but did it! ``` -Two `Symbol("id")` are not equal, that's why they would allow to store values safely. +### Symbols in literal -**If we want to use a symbol in an object literal, we need square brackets.** +If we want to use a symbol in an object literal, we need square brackets. Like this: @@ -73,7 +95,9 @@ let user = { ``` That's because we use the value from the variable `id`, not the string "id". -**Symbolic properties do not participate in `for..in` loop.** +### Symbols are not in loop + +Symbolic properties do not participate in `for..in` loop. For instance: @@ -93,7 +117,7 @@ for(let key in user) alert(key); // name, age (no symbols) alert( "Direct: " + user[Symbol.for("id")] ); ``` -That's a part of the general "hiding" concept. So if another script or a library loops over our object, it won't unexpectedly access the symbol property. +That's a part of the general "hiding" concept. If another script or a library loops over our object, it won't unexpectedly access a symbolic property. In contrast, [Object.assign](mdn:js/Object/assign) copies both string and symbol properties: @@ -108,10 +132,10 @@ let clone = Object.assign({}, user); alert( clone[id] ); // 123 ``` -There's no paradox here. That's the expected behavior, because when we clone an object, we await symbol properties (like `id`) to be copied as well. +There's no paradox here. That's the expected behavior, because when we clone an object, we expect symbolic properties (like `id`) to be copied as well. -````smart header="Property identifier must be either a string or a symbol" +````smart header="Property keys of other types are coerced to strings" We can only use strings or symbols as keys in objects. Other types are coerced to strings. For instance: @@ -127,18 +151,21 @@ alert( obj[0] ); // test (same property) ``` ```` - ## Global symbols -There is a global symbols registry that allows, if necessary, to create common global symbols and access them by their name. +Normally, all symbols are different. But sometimes we want same-named symbols to be the same. -To read a global symbol, we need to call a built-in method `Symbol.for(name)`. If there is no such symbol, it is created. +For instance, different parts of our application want to use `Symbol("id")` meaning the exactly the same property. + +To achieve that, there's a *global symbol registry*. That's a place where we can create symbols and access them later, and it is guaranteed that repeating access by the same name returns the same symbol. + +To can create or read a symbol, use `Symbol.for(name)`. For instance: ```js run // read from the global registry -let name = Symbol.for("name"); +let name = Symbol.for("name"); // if the symbol did not exist, it is created // read it again let nameAgain = Symbol.for("name"); @@ -149,30 +176,40 @@ alert( name === nameAgain ); // true If we want an application-wide symbol, accessible everywhere in the code -- that's what the registry is for. -```smart -In some programming languages, like Ruby, the name identifies the symbol. In Javascript, as we can see, that's true for global symbols. +```smart header="That sounds like Ruby" +In some programming languages, like Ruby, there's a single symbol per name. + +In Javascript, as we can see, it's correct for global symbols. ``` -The `Symbol.for(name)` call, which returns a symbol by name, there exists the reverse call `Symbol.keyFor(sym)`. It returns the name by the global symbol. +### Symbol.keyFor + +For global symbols, not only `Symbol.for(name)` returns a symbol by name, but there's a reverse call: `Symbol.keyFor(sym)`, that returns a name for a global symbol. For instance: ```js run let sym = Symbol.for("name"); +let sym2 = Symbol.for("id"); +// get name from symbol alert( Symbol.keyFor(sym) ); // name +alert( Symbol.keyFor(sym2) ); // id ``` -````warn header="`Symbol.keyFor` returns `undefined` for non-global symbols" -The `Symbol.keyFor` method works only for global symbols. Otherwise it returns `undefined`, like here: +The `Symbol.keyFor` internally uses the global symbol registry, to look up the name for the symbol. + +So it doesn't work for non-global symbols. If the symbol is not global, it returns `undefined. + +For instance: ```js run alert( Symbol.keyFor(Symbol.for("name")) ); // name, global symbol + alert( Symbol.keyFor(Symbol("name2")) ); // undefined, non-global symbol ``` -In practice, that's fine, because the name of the symbol, if it's not global, is generally not used except for debugging purposes. -```` +For non-global symbols, the name is only used for debugging purposes. ## System symbols @@ -190,4 +227,4 @@ They are listed in the specification in the [Well-known symbols](https://tc39.gi Symbols don't appear in `for..in` loops. As we'll see further, there are other means to get object properties which also ignore symbols, so they remain hidden. -Technically though, there is still a way to discover all symbols of an object with a build-in method [Object.getOwnPropertySymbols](mdn:js/Object/getOwnPropertySymbols). So they are not completely hidden and private. But most scripts and built-in methods adhere to a common agreement that they are. And the one who explicitly calls a method with such a cumbersome name probably knows what he's doing. +Technically though, there is still a way to discover all symbols of an object with a build-in method [Object.getOwnPropertySymbols(obj)](mdn:js/Object/getOwnPropertySymbols). Also there is a method named [Reflect.ownKeys(obj)](mdn:js/Reflect/ownKeys) that returns all keys of an object. So they are not completely hidden and private. But most libraries, built-in methods and syntax constructs adhere to a common agreement that they are. And the one who explicitly calls the aforementioned methods is not doing that occasionally, but knows exactly what he's doing. \ No newline at end of file diff --git a/1-js/3-object-basics/6-object-toprimitive/article.md b/1-js/4-data-types/06-object-toprimitive/article.md similarity index 96% rename from 1-js/3-object-basics/6-object-toprimitive/article.md rename to 1-js/4-data-types/06-object-toprimitive/article.md index 77b51c7b..98bdcb84 100644 --- a/1-js/3-object-basics/6-object-toprimitive/article.md +++ b/1-js/4-data-types/06-object-toprimitive/article.md @@ -136,7 +136,7 @@ alert(+user); // 30 alert(user + 1); // 31 (default like number calls valueOf) ``` -If we want a single "catch-all" place for primitive conversions, or only want a nice debugging output of our object, then we can implement `toString` only. It the absence of `valueOf` it will be used for all conversions. +Quite often we want a single "catch-all" place for primitive conversions, or only a nice debugging output of our object. In this case we can implement `toString` only. It the absence of `valueOf` it will be used for all conversions. For instance: diff --git a/1-js/4-data-types/07-primitives-methods/1-string-new-property/solution.md b/1-js/4-data-types/07-primitives-methods/1-string-new-property/solution.md new file mode 100644 index 00000000..a169f776 --- /dev/null +++ b/1-js/4-data-types/07-primitives-methods/1-string-new-property/solution.md @@ -0,0 +1,31 @@ + +Try running it: + +```js run +let str = "Hello"; + +str.test = 5; // (*) + +alert(str.test); +``` + +There may be two kinds of result: +1. `undefined` +2. An error. + +Why? Let's replay what's happening at line `(*)`: + +1. When a property of `str` is accessed, a "wrapper object" is created. +2. The operation with the property is carried out on it. So, the object gets the `test` property. +3. The operation finishes and the "wrapper object" disappears. + +So, on the last line, `str` has no trace of the property. A new wrapper object for every object operation on a string. + +Some browsers though may decide to further limit the programmer and disallow to assign properties to primitives at all. That's why in practice we can also see errors at line `(*)`. It's a little bit farther from the specification though. + +**This example clearly shows that primitives are not objects.** + +They just can not store data. + +All property/method operations are performed with the help of temporary objects. + diff --git a/1-js/4-data-types/07-primitives-methods/1-string-new-property/task.md b/1-js/4-data-types/07-primitives-methods/1-string-new-property/task.md new file mode 100644 index 00000000..50c781ea --- /dev/null +++ b/1-js/4-data-types/07-primitives-methods/1-string-new-property/task.md @@ -0,0 +1,18 @@ +importance: 5 + +--- + +# Can I add a string property? + + +Consider the following code: + +```js +let str = "Hello"; + +str.test = 5; + +alert(str.test); +``` + +How do you think, will it work? What will be shown? diff --git a/1-js/3-object-basics/4-primitives-methods/article.md b/1-js/4-data-types/07-primitives-methods/article.md similarity index 100% rename from 1-js/3-object-basics/4-primitives-methods/article.md rename to 1-js/4-data-types/07-primitives-methods/article.md diff --git a/1-js/6-data-types/01-number/1-sum-interface/solution.md b/1-js/4-data-types/08-number/1-sum-interface/solution.md similarity index 100% rename from 1-js/6-data-types/01-number/1-sum-interface/solution.md rename to 1-js/4-data-types/08-number/1-sum-interface/solution.md diff --git a/1-js/6-data-types/01-number/1-sum-interface/task.md b/1-js/4-data-types/08-number/1-sum-interface/task.md similarity index 100% rename from 1-js/6-data-types/01-number/1-sum-interface/task.md rename to 1-js/4-data-types/08-number/1-sum-interface/task.md diff --git a/1-js/6-data-types/01-number/2-why-rounded-down/solution.md b/1-js/4-data-types/08-number/2-why-rounded-down/solution.md similarity index 100% rename from 1-js/6-data-types/01-number/2-why-rounded-down/solution.md rename to 1-js/4-data-types/08-number/2-why-rounded-down/solution.md diff --git a/1-js/6-data-types/01-number/2-why-rounded-down/task.md b/1-js/4-data-types/08-number/2-why-rounded-down/task.md similarity index 100% rename from 1-js/6-data-types/01-number/2-why-rounded-down/task.md rename to 1-js/4-data-types/08-number/2-why-rounded-down/task.md diff --git a/1-js/6-data-types/01-number/3-repeat-until-number/_js.view/solution.js b/1-js/4-data-types/08-number/3-repeat-until-number/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/01-number/3-repeat-until-number/_js.view/solution.js rename to 1-js/4-data-types/08-number/3-repeat-until-number/_js.view/solution.js diff --git a/1-js/6-data-types/01-number/3-repeat-until-number/_js.view/test.js b/1-js/4-data-types/08-number/3-repeat-until-number/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/01-number/3-repeat-until-number/_js.view/test.js rename to 1-js/4-data-types/08-number/3-repeat-until-number/_js.view/test.js diff --git a/1-js/6-data-types/01-number/3-repeat-until-number/solution.md b/1-js/4-data-types/08-number/3-repeat-until-number/solution.md similarity index 100% rename from 1-js/6-data-types/01-number/3-repeat-until-number/solution.md rename to 1-js/4-data-types/08-number/3-repeat-until-number/solution.md diff --git a/1-js/6-data-types/01-number/3-repeat-until-number/task.md b/1-js/4-data-types/08-number/3-repeat-until-number/task.md similarity index 100% rename from 1-js/6-data-types/01-number/3-repeat-until-number/task.md rename to 1-js/4-data-types/08-number/3-repeat-until-number/task.md diff --git a/1-js/6-data-types/01-number/4-endless-loop-error/solution.md b/1-js/4-data-types/08-number/4-endless-loop-error/solution.md similarity index 100% rename from 1-js/6-data-types/01-number/4-endless-loop-error/solution.md rename to 1-js/4-data-types/08-number/4-endless-loop-error/solution.md diff --git a/1-js/6-data-types/01-number/4-endless-loop-error/task.md b/1-js/4-data-types/08-number/4-endless-loop-error/task.md similarity index 100% rename from 1-js/6-data-types/01-number/4-endless-loop-error/task.md rename to 1-js/4-data-types/08-number/4-endless-loop-error/task.md diff --git a/1-js/6-data-types/01-number/8-random-min-max/solution.md b/1-js/4-data-types/08-number/8-random-min-max/solution.md similarity index 100% rename from 1-js/6-data-types/01-number/8-random-min-max/solution.md rename to 1-js/4-data-types/08-number/8-random-min-max/solution.md diff --git a/1-js/6-data-types/01-number/8-random-min-max/task.md b/1-js/4-data-types/08-number/8-random-min-max/task.md similarity index 100% rename from 1-js/6-data-types/01-number/8-random-min-max/task.md rename to 1-js/4-data-types/08-number/8-random-min-max/task.md diff --git a/1-js/6-data-types/01-number/9-random-int-min-max/solution.md b/1-js/4-data-types/08-number/9-random-int-min-max/solution.md similarity index 100% rename from 1-js/6-data-types/01-number/9-random-int-min-max/solution.md rename to 1-js/4-data-types/08-number/9-random-int-min-max/solution.md diff --git a/1-js/6-data-types/01-number/9-random-int-min-max/task.md b/1-js/4-data-types/08-number/9-random-int-min-max/task.md similarity index 100% rename from 1-js/6-data-types/01-number/9-random-int-min-max/task.md rename to 1-js/4-data-types/08-number/9-random-int-min-max/task.md diff --git a/1-js/6-data-types/01-number/article.md b/1-js/4-data-types/08-number/article.md similarity index 99% rename from 1-js/6-data-types/01-number/article.md rename to 1-js/4-data-types/08-number/article.md index 1cf1bf5b..af32d44c 100644 --- a/1-js/6-data-types/01-number/article.md +++ b/1-js/4-data-types/08-number/article.md @@ -1,4 +1,4 @@ -# Numbers +# Numbers in-depth All numbers in JavaScript are stored in 64-bit format [IEEE-754](http://en.wikipedia.org/wiki/IEEE_754-1985) also known as "double precision". diff --git a/1-js/6-data-types/02-string/1-ucfirst/_js.view/solution.js b/1-js/4-data-types/09-string/1-ucfirst/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/02-string/1-ucfirst/_js.view/solution.js rename to 1-js/4-data-types/09-string/1-ucfirst/_js.view/solution.js diff --git a/1-js/6-data-types/02-string/1-ucfirst/_js.view/test.js b/1-js/4-data-types/09-string/1-ucfirst/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/02-string/1-ucfirst/_js.view/test.js rename to 1-js/4-data-types/09-string/1-ucfirst/_js.view/test.js diff --git a/1-js/6-data-types/02-string/1-ucfirst/solution.md b/1-js/4-data-types/09-string/1-ucfirst/solution.md similarity index 100% rename from 1-js/6-data-types/02-string/1-ucfirst/solution.md rename to 1-js/4-data-types/09-string/1-ucfirst/solution.md diff --git a/1-js/6-data-types/02-string/1-ucfirst/task.md b/1-js/4-data-types/09-string/1-ucfirst/task.md similarity index 100% rename from 1-js/6-data-types/02-string/1-ucfirst/task.md rename to 1-js/4-data-types/09-string/1-ucfirst/task.md diff --git a/1-js/6-data-types/02-string/2-check-spam/_js.view/solution.js b/1-js/4-data-types/09-string/2-check-spam/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/02-string/2-check-spam/_js.view/solution.js rename to 1-js/4-data-types/09-string/2-check-spam/_js.view/solution.js diff --git a/1-js/6-data-types/02-string/2-check-spam/_js.view/test.js b/1-js/4-data-types/09-string/2-check-spam/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/02-string/2-check-spam/_js.view/test.js rename to 1-js/4-data-types/09-string/2-check-spam/_js.view/test.js diff --git a/1-js/6-data-types/02-string/2-check-spam/solution.md b/1-js/4-data-types/09-string/2-check-spam/solution.md similarity index 100% rename from 1-js/6-data-types/02-string/2-check-spam/solution.md rename to 1-js/4-data-types/09-string/2-check-spam/solution.md diff --git a/1-js/6-data-types/02-string/2-check-spam/task.md b/1-js/4-data-types/09-string/2-check-spam/task.md similarity index 100% rename from 1-js/6-data-types/02-string/2-check-spam/task.md rename to 1-js/4-data-types/09-string/2-check-spam/task.md diff --git a/1-js/6-data-types/02-string/3-truncate/_js.view/solution.js b/1-js/4-data-types/09-string/3-truncate/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/02-string/3-truncate/_js.view/solution.js rename to 1-js/4-data-types/09-string/3-truncate/_js.view/solution.js diff --git a/1-js/6-data-types/02-string/3-truncate/_js.view/test.js b/1-js/4-data-types/09-string/3-truncate/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/02-string/3-truncate/_js.view/test.js rename to 1-js/4-data-types/09-string/3-truncate/_js.view/test.js diff --git a/1-js/6-data-types/02-string/3-truncate/solution.md b/1-js/4-data-types/09-string/3-truncate/solution.md similarity index 100% rename from 1-js/6-data-types/02-string/3-truncate/solution.md rename to 1-js/4-data-types/09-string/3-truncate/solution.md diff --git a/1-js/6-data-types/02-string/3-truncate/task.md b/1-js/4-data-types/09-string/3-truncate/task.md similarity index 100% rename from 1-js/6-data-types/02-string/3-truncate/task.md rename to 1-js/4-data-types/09-string/3-truncate/task.md diff --git a/1-js/6-data-types/02-string/4-extract-currency/_js.view/solution.js b/1-js/4-data-types/09-string/4-extract-currency/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/02-string/4-extract-currency/_js.view/solution.js rename to 1-js/4-data-types/09-string/4-extract-currency/_js.view/solution.js diff --git a/1-js/6-data-types/02-string/4-extract-currency/_js.view/test.js b/1-js/4-data-types/09-string/4-extract-currency/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/02-string/4-extract-currency/_js.view/test.js rename to 1-js/4-data-types/09-string/4-extract-currency/_js.view/test.js diff --git a/1-js/6-data-types/02-string/4-extract-currency/solution.md b/1-js/4-data-types/09-string/4-extract-currency/solution.md similarity index 100% rename from 1-js/6-data-types/02-string/4-extract-currency/solution.md rename to 1-js/4-data-types/09-string/4-extract-currency/solution.md diff --git a/1-js/6-data-types/02-string/4-extract-currency/task.md b/1-js/4-data-types/09-string/4-extract-currency/task.md similarity index 100% rename from 1-js/6-data-types/02-string/4-extract-currency/task.md rename to 1-js/4-data-types/09-string/4-extract-currency/task.md diff --git a/1-js/6-data-types/02-string/article.md b/1-js/4-data-types/09-string/article.md similarity index 99% rename from 1-js/6-data-types/02-string/article.md rename to 1-js/4-data-types/09-string/article.md index d2040f16..afdd2587 100644 --- a/1-js/6-data-types/02-string/article.md +++ b/1-js/4-data-types/09-string/article.md @@ -1,4 +1,4 @@ -# Strings +# Strings in-depth In JavaScript, the textual data is stored as strings. There is no separate type for a single character. diff --git a/1-js/3-object-basics/7-array/1-item-value/solution.md b/1-js/4-data-types/11-array/1-item-value/solution.md similarity index 100% rename from 1-js/3-object-basics/7-array/1-item-value/solution.md rename to 1-js/4-data-types/11-array/1-item-value/solution.md diff --git a/1-js/3-object-basics/7-array/1-item-value/task.md b/1-js/4-data-types/11-array/1-item-value/task.md similarity index 100% rename from 1-js/3-object-basics/7-array/1-item-value/task.md rename to 1-js/4-data-types/11-array/1-item-value/task.md diff --git a/1-js/3-object-basics/7-array/10-maximal-subarray/_js.view/solution.js b/1-js/4-data-types/11-array/10-maximal-subarray/_js.view/solution.js similarity index 100% rename from 1-js/3-object-basics/7-array/10-maximal-subarray/_js.view/solution.js rename to 1-js/4-data-types/11-array/10-maximal-subarray/_js.view/solution.js diff --git a/1-js/3-object-basics/7-array/10-maximal-subarray/_js.view/test.js b/1-js/4-data-types/11-array/10-maximal-subarray/_js.view/test.js similarity index 100% rename from 1-js/3-object-basics/7-array/10-maximal-subarray/_js.view/test.js rename to 1-js/4-data-types/11-array/10-maximal-subarray/_js.view/test.js diff --git a/1-js/3-object-basics/7-array/10-maximal-subarray/solution.md b/1-js/4-data-types/11-array/10-maximal-subarray/solution.md similarity index 100% rename from 1-js/3-object-basics/7-array/10-maximal-subarray/solution.md rename to 1-js/4-data-types/11-array/10-maximal-subarray/solution.md diff --git a/1-js/3-object-basics/7-array/10-maximal-subarray/task.md b/1-js/4-data-types/11-array/10-maximal-subarray/task.md similarity index 100% rename from 1-js/3-object-basics/7-array/10-maximal-subarray/task.md rename to 1-js/4-data-types/11-array/10-maximal-subarray/task.md diff --git a/1-js/3-object-basics/7-array/2-create-array/solution.md b/1-js/4-data-types/11-array/2-create-array/solution.md similarity index 100% rename from 1-js/3-object-basics/7-array/2-create-array/solution.md rename to 1-js/4-data-types/11-array/2-create-array/solution.md diff --git a/1-js/3-object-basics/7-array/2-create-array/task.md b/1-js/4-data-types/11-array/2-create-array/task.md similarity index 100% rename from 1-js/3-object-basics/7-array/2-create-array/task.md rename to 1-js/4-data-types/11-array/2-create-array/task.md diff --git a/1-js/3-object-basics/7-array/3-call-array-this/solution.md b/1-js/4-data-types/11-array/3-call-array-this/solution.md similarity index 100% rename from 1-js/3-object-basics/7-array/3-call-array-this/solution.md rename to 1-js/4-data-types/11-array/3-call-array-this/solution.md diff --git a/1-js/3-object-basics/7-array/3-call-array-this/task.md b/1-js/4-data-types/11-array/3-call-array-this/task.md similarity index 100% rename from 1-js/3-object-basics/7-array/3-call-array-this/task.md rename to 1-js/4-data-types/11-array/3-call-array-this/task.md diff --git a/1-js/3-object-basics/7-array/5-array-input-sum/solution.md b/1-js/4-data-types/11-array/5-array-input-sum/solution.md similarity index 100% rename from 1-js/3-object-basics/7-array/5-array-input-sum/solution.md rename to 1-js/4-data-types/11-array/5-array-input-sum/solution.md diff --git a/1-js/3-object-basics/7-array/5-array-input-sum/task.md b/1-js/4-data-types/11-array/5-array-input-sum/task.md similarity index 100% rename from 1-js/3-object-basics/7-array/5-array-input-sum/task.md rename to 1-js/4-data-types/11-array/5-array-input-sum/task.md diff --git a/1-js/3-object-basics/7-array/array-pop.png b/1-js/4-data-types/11-array/array-pop.png similarity index 100% rename from 1-js/3-object-basics/7-array/array-pop.png rename to 1-js/4-data-types/11-array/array-pop.png diff --git a/1-js/3-object-basics/7-array/array-pop@2x.png b/1-js/4-data-types/11-array/array-pop@2x.png similarity index 100% rename from 1-js/3-object-basics/7-array/array-pop@2x.png rename to 1-js/4-data-types/11-array/array-pop@2x.png diff --git a/1-js/3-object-basics/7-array/array-shift.png b/1-js/4-data-types/11-array/array-shift.png similarity index 100% rename from 1-js/3-object-basics/7-array/array-shift.png rename to 1-js/4-data-types/11-array/array-shift.png diff --git a/1-js/3-object-basics/7-array/array-shift@2x.png b/1-js/4-data-types/11-array/array-shift@2x.png similarity index 100% rename from 1-js/3-object-basics/7-array/array-shift@2x.png rename to 1-js/4-data-types/11-array/array-shift@2x.png diff --git a/1-js/3-object-basics/7-array/array-speed.png b/1-js/4-data-types/11-array/array-speed.png similarity index 100% rename from 1-js/3-object-basics/7-array/array-speed.png rename to 1-js/4-data-types/11-array/array-speed.png diff --git a/1-js/3-object-basics/7-array/array-speed@2x.png b/1-js/4-data-types/11-array/array-speed@2x.png similarity index 100% rename from 1-js/3-object-basics/7-array/array-speed@2x.png rename to 1-js/4-data-types/11-array/array-speed@2x.png diff --git a/1-js/3-object-basics/7-array/article.md b/1-js/4-data-types/11-array/article.md similarity index 100% rename from 1-js/3-object-basics/7-array/article.md rename to 1-js/4-data-types/11-array/article.md diff --git a/1-js/3-object-basics/7-array/queue.png b/1-js/4-data-types/11-array/queue.png similarity index 100% rename from 1-js/3-object-basics/7-array/queue.png rename to 1-js/4-data-types/11-array/queue.png diff --git a/1-js/3-object-basics/7-array/queue@2x.png b/1-js/4-data-types/11-array/queue@2x.png similarity index 100% rename from 1-js/3-object-basics/7-array/queue@2x.png rename to 1-js/4-data-types/11-array/queue@2x.png diff --git a/1-js/3-object-basics/7-array/stack.png b/1-js/4-data-types/11-array/stack.png similarity index 100% rename from 1-js/3-object-basics/7-array/stack.png rename to 1-js/4-data-types/11-array/stack.png diff --git a/1-js/3-object-basics/7-array/stack@2x.png b/1-js/4-data-types/11-array/stack@2x.png similarity index 100% rename from 1-js/3-object-basics/7-array/stack@2x.png rename to 1-js/4-data-types/11-array/stack@2x.png diff --git a/1-js/6-data-types/07-array-methods/1-camelcase/_js.view/solution.js b/1-js/4-data-types/12-array-methods/1-camelcase/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/07-array-methods/1-camelcase/_js.view/solution.js rename to 1-js/4-data-types/12-array-methods/1-camelcase/_js.view/solution.js diff --git a/1-js/6-data-types/07-array-methods/1-camelcase/_js.view/test.js b/1-js/4-data-types/12-array-methods/1-camelcase/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/07-array-methods/1-camelcase/_js.view/test.js rename to 1-js/4-data-types/12-array-methods/1-camelcase/_js.view/test.js diff --git a/1-js/4-more-syntax/3-advanced-loops/5-sum-salaries/solution.md b/1-js/4-data-types/12-array-methods/1-camelcase/solution.md similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/5-sum-salaries/solution.md rename to 1-js/4-data-types/12-array-methods/1-camelcase/solution.md diff --git a/1-js/6-data-types/07-array-methods/1-camelcase/task.md b/1-js/4-data-types/12-array-methods/1-camelcase/task.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/1-camelcase/task.md rename to 1-js/4-data-types/12-array-methods/1-camelcase/task.md diff --git a/1-js/6-data-types/07-array-methods/11-array-unique/_js.view/solution.js b/1-js/4-data-types/12-array-methods/11-array-unique/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/07-array-methods/11-array-unique/_js.view/solution.js rename to 1-js/4-data-types/12-array-methods/11-array-unique/_js.view/solution.js diff --git a/1-js/6-data-types/07-array-methods/11-array-unique/_js.view/test.js b/1-js/4-data-types/12-array-methods/11-array-unique/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/07-array-methods/11-array-unique/_js.view/test.js rename to 1-js/4-data-types/12-array-methods/11-array-unique/_js.view/test.js diff --git a/1-js/6-data-types/07-array-methods/11-array-unique/solution.md b/1-js/4-data-types/12-array-methods/11-array-unique/solution.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/11-array-unique/solution.md rename to 1-js/4-data-types/12-array-methods/11-array-unique/solution.md diff --git a/1-js/6-data-types/07-array-methods/11-array-unique/task.md b/1-js/4-data-types/12-array-methods/11-array-unique/task.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/11-array-unique/task.md rename to 1-js/4-data-types/12-array-methods/11-array-unique/task.md diff --git a/1-js/6-data-types/07-array-methods/2-filter-range/_js.view/solution.js b/1-js/4-data-types/12-array-methods/2-filter-range/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/07-array-methods/2-filter-range/_js.view/solution.js rename to 1-js/4-data-types/12-array-methods/2-filter-range/_js.view/solution.js diff --git a/1-js/6-data-types/07-array-methods/2-filter-range/_js.view/test.js b/1-js/4-data-types/12-array-methods/2-filter-range/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/07-array-methods/2-filter-range/_js.view/test.js rename to 1-js/4-data-types/12-array-methods/2-filter-range/_js.view/test.js diff --git a/1-js/4-more-syntax/3-advanced-loops/6-max-salary/solution.md b/1-js/4-data-types/12-array-methods/2-filter-range/solution.md similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/6-max-salary/solution.md rename to 1-js/4-data-types/12-array-methods/2-filter-range/solution.md diff --git a/1-js/6-data-types/07-array-methods/2-filter-range/task.md b/1-js/4-data-types/12-array-methods/2-filter-range/task.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/2-filter-range/task.md rename to 1-js/4-data-types/12-array-methods/2-filter-range/task.md diff --git a/1-js/6-data-types/07-array-methods/3-filter-range-in-place/_js.view/solution.js b/1-js/4-data-types/12-array-methods/3-filter-range-in-place/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/07-array-methods/3-filter-range-in-place/_js.view/solution.js rename to 1-js/4-data-types/12-array-methods/3-filter-range-in-place/_js.view/solution.js diff --git a/1-js/6-data-types/07-array-methods/3-filter-range-in-place/_js.view/test.js b/1-js/4-data-types/12-array-methods/3-filter-range-in-place/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/07-array-methods/3-filter-range-in-place/_js.view/test.js rename to 1-js/4-data-types/12-array-methods/3-filter-range-in-place/_js.view/test.js diff --git a/1-js/4-more-syntax/3-advanced-loops/7-count-properties/solution.md b/1-js/4-data-types/12-array-methods/3-filter-range-in-place/solution.md similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/7-count-properties/solution.md rename to 1-js/4-data-types/12-array-methods/3-filter-range-in-place/solution.md diff --git a/1-js/6-data-types/07-array-methods/3-filter-range-in-place/task.md b/1-js/4-data-types/12-array-methods/3-filter-range-in-place/task.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/3-filter-range-in-place/task.md rename to 1-js/4-data-types/12-array-methods/3-filter-range-in-place/task.md diff --git a/1-js/6-data-types/07-array-methods/4-sort-back/solution.md b/1-js/4-data-types/12-array-methods/4-sort-back/solution.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/4-sort-back/solution.md rename to 1-js/4-data-types/12-array-methods/4-sort-back/solution.md diff --git a/1-js/6-data-types/07-array-methods/4-sort-back/task.md b/1-js/4-data-types/12-array-methods/4-sort-back/task.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/4-sort-back/task.md rename to 1-js/4-data-types/12-array-methods/4-sort-back/task.md diff --git a/1-js/6-data-types/07-array-methods/5-copy-sort-array/solution.md b/1-js/4-data-types/12-array-methods/5-copy-sort-array/solution.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/5-copy-sort-array/solution.md rename to 1-js/4-data-types/12-array-methods/5-copy-sort-array/solution.md diff --git a/1-js/6-data-types/07-array-methods/5-copy-sort-array/task.md b/1-js/4-data-types/12-array-methods/5-copy-sort-array/task.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/5-copy-sort-array/task.md rename to 1-js/4-data-types/12-array-methods/5-copy-sort-array/task.md diff --git a/1-js/6-data-types/07-array-methods/6-array-get-names/solution.md b/1-js/4-data-types/12-array-methods/6-array-get-names/solution.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/6-array-get-names/solution.md rename to 1-js/4-data-types/12-array-methods/6-array-get-names/solution.md diff --git a/1-js/6-data-types/07-array-methods/6-array-get-names/task.md b/1-js/4-data-types/12-array-methods/6-array-get-names/task.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/6-array-get-names/task.md rename to 1-js/4-data-types/12-array-methods/6-array-get-names/task.md diff --git a/1-js/6-data-types/07-array-methods/7-sort-objects/solution.md b/1-js/4-data-types/12-array-methods/7-sort-objects/solution.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/7-sort-objects/solution.md rename to 1-js/4-data-types/12-array-methods/7-sort-objects/solution.md diff --git a/1-js/6-data-types/07-array-methods/7-sort-objects/task.md b/1-js/4-data-types/12-array-methods/7-sort-objects/task.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/7-sort-objects/task.md rename to 1-js/4-data-types/12-array-methods/7-sort-objects/task.md diff --git a/1-js/6-data-types/07-array-methods/8-average-age/solution.md b/1-js/4-data-types/12-array-methods/8-average-age/solution.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/8-average-age/solution.md rename to 1-js/4-data-types/12-array-methods/8-average-age/solution.md diff --git a/1-js/6-data-types/07-array-methods/8-average-age/task.md b/1-js/4-data-types/12-array-methods/8-average-age/task.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/8-average-age/task.md rename to 1-js/4-data-types/12-array-methods/8-average-age/task.md diff --git a/1-js/6-data-types/07-array-methods/article.md b/1-js/4-data-types/12-array-methods/article.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/article.md rename to 1-js/4-data-types/12-array-methods/article.md diff --git a/1-js/6-data-types/07-array-methods/reduce.png b/1-js/4-data-types/12-array-methods/reduce.png similarity index 100% rename from 1-js/6-data-types/07-array-methods/reduce.png rename to 1-js/4-data-types/12-array-methods/reduce.png diff --git a/1-js/6-data-types/07-array-methods/reduce@2x.png b/1-js/4-data-types/12-array-methods/reduce@2x.png similarity index 100% rename from 1-js/6-data-types/07-array-methods/reduce@2x.png rename to 1-js/4-data-types/12-array-methods/reduce@2x.png diff --git a/1-js/3-object-basics/8-iterable/article.md b/1-js/4-data-types/14-iterable/article.md similarity index 100% rename from 1-js/3-object-basics/8-iterable/article.md rename to 1-js/4-data-types/14-iterable/article.md diff --git a/1-js/6-data-types/08-map-set-weakmap-weakset/1-filter-anagrams/_js.view/solution.js b/1-js/4-data-types/15-map-set-weakmap-weakset/1-filter-anagrams/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/08-map-set-weakmap-weakset/1-filter-anagrams/_js.view/solution.js rename to 1-js/4-data-types/15-map-set-weakmap-weakset/1-filter-anagrams/_js.view/solution.js diff --git a/1-js/6-data-types/08-map-set-weakmap-weakset/1-filter-anagrams/_js.view/test.js b/1-js/4-data-types/15-map-set-weakmap-weakset/1-filter-anagrams/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/08-map-set-weakmap-weakset/1-filter-anagrams/_js.view/test.js rename to 1-js/4-data-types/15-map-set-weakmap-weakset/1-filter-anagrams/_js.view/test.js diff --git a/1-js/6-data-types/08-map-set-weakmap-weakset/1-filter-anagrams/solution.md b/1-js/4-data-types/15-map-set-weakmap-weakset/1-filter-anagrams/solution.md similarity index 100% rename from 1-js/6-data-types/08-map-set-weakmap-weakset/1-filter-anagrams/solution.md rename to 1-js/4-data-types/15-map-set-weakmap-weakset/1-filter-anagrams/solution.md diff --git a/1-js/6-data-types/08-map-set-weakmap-weakset/1-filter-anagrams/task.md b/1-js/4-data-types/15-map-set-weakmap-weakset/1-filter-anagrams/task.md similarity index 100% rename from 1-js/6-data-types/08-map-set-weakmap-weakset/1-filter-anagrams/task.md rename to 1-js/4-data-types/15-map-set-weakmap-weakset/1-filter-anagrams/task.md diff --git a/1-js/6-data-types/08-map-set-weakmap-weakset/2-recipients-set/solution.md b/1-js/4-data-types/15-map-set-weakmap-weakset/2-recipients-set/solution.md similarity index 100% rename from 1-js/6-data-types/08-map-set-weakmap-weakset/2-recipients-set/solution.md rename to 1-js/4-data-types/15-map-set-weakmap-weakset/2-recipients-set/solution.md diff --git a/1-js/6-data-types/08-map-set-weakmap-weakset/2-recipients-set/task.md b/1-js/4-data-types/15-map-set-weakmap-weakset/2-recipients-set/task.md similarity index 100% rename from 1-js/6-data-types/08-map-set-weakmap-weakset/2-recipients-set/task.md rename to 1-js/4-data-types/15-map-set-weakmap-weakset/2-recipients-set/task.md diff --git a/1-js/6-data-types/08-map-set-weakmap-weakset/article.md b/1-js/4-data-types/15-map-set-weakmap-weakset/article.md similarity index 94% rename from 1-js/6-data-types/08-map-set-weakmap-weakset/article.md rename to 1-js/4-data-types/15-map-set-weakmap-weakset/article.md index 7560f2a9..0bdca1f0 100644 --- a/1-js/6-data-types/08-map-set-weakmap-weakset/article.md +++ b/1-js/4-data-types/15-map-set-weakmap-weakset/article.md @@ -81,18 +81,6 @@ To test values for equivalence, `Map` uses the algorithm [SameValueZero](https:/ This algorithm can't be changed or customized. ``` -````smart header="`Map` allows *any* strings as keys, `Object` does not" -In objects, there is a built-in property named `__proto__`. We'll see the details about it later. Here the important thing is that it should not be overwritten. If it is set to a primitive then the write operation is ignored, so we can say that JavaScript protects it to a certain extent. - -But if key/value pairs come from the user (like a user naming himself `__proto__`), then we can meet unexpected problems with it. That's actually an endless source of bugs in many well-known JavaScript libraries. `Map`, from the other hand, is totally safe: - -```js run -let map = new Map(); -map.set('__proto__', 123); -alert( map.get('__proto__') ); // 123 -``` - -```` ````smart header="Chaining" diff --git a/1-js/6-data-types/09-date/1-new-date/solution.md b/1-js/4-data-types/17-date/1-new-date/solution.md similarity index 100% rename from 1-js/6-data-types/09-date/1-new-date/solution.md rename to 1-js/4-data-types/17-date/1-new-date/solution.md diff --git a/1-js/6-data-types/09-date/1-new-date/task.md b/1-js/4-data-types/17-date/1-new-date/task.md similarity index 100% rename from 1-js/6-data-types/09-date/1-new-date/task.md rename to 1-js/4-data-types/17-date/1-new-date/task.md diff --git a/1-js/6-data-types/09-date/2-get-week-day/_js.view/solution.js b/1-js/4-data-types/17-date/2-get-week-day/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/09-date/2-get-week-day/_js.view/solution.js rename to 1-js/4-data-types/17-date/2-get-week-day/_js.view/solution.js diff --git a/1-js/6-data-types/09-date/2-get-week-day/_js.view/test.js b/1-js/4-data-types/17-date/2-get-week-day/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/09-date/2-get-week-day/_js.view/test.js rename to 1-js/4-data-types/17-date/2-get-week-day/_js.view/test.js diff --git a/1-js/6-data-types/09-date/2-get-week-day/solution.md b/1-js/4-data-types/17-date/2-get-week-day/solution.md similarity index 100% rename from 1-js/6-data-types/09-date/2-get-week-day/solution.md rename to 1-js/4-data-types/17-date/2-get-week-day/solution.md diff --git a/1-js/6-data-types/09-date/2-get-week-day/task.md b/1-js/4-data-types/17-date/2-get-week-day/task.md similarity index 100% rename from 1-js/6-data-types/09-date/2-get-week-day/task.md rename to 1-js/4-data-types/17-date/2-get-week-day/task.md diff --git a/1-js/6-data-types/09-date/3-weekday/_js.view/solution.js b/1-js/4-data-types/17-date/3-weekday/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/09-date/3-weekday/_js.view/solution.js rename to 1-js/4-data-types/17-date/3-weekday/_js.view/solution.js diff --git a/1-js/6-data-types/09-date/3-weekday/_js.view/test.js b/1-js/4-data-types/17-date/3-weekday/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/09-date/3-weekday/_js.view/test.js rename to 1-js/4-data-types/17-date/3-weekday/_js.view/test.js diff --git a/1-js/6-data-types/09-date/3-weekday/solution.md b/1-js/4-data-types/17-date/3-weekday/solution.md similarity index 100% rename from 1-js/6-data-types/09-date/3-weekday/solution.md rename to 1-js/4-data-types/17-date/3-weekday/solution.md diff --git a/1-js/6-data-types/09-date/3-weekday/task.md b/1-js/4-data-types/17-date/3-weekday/task.md similarity index 100% rename from 1-js/6-data-types/09-date/3-weekday/task.md rename to 1-js/4-data-types/17-date/3-weekday/task.md diff --git a/1-js/6-data-types/09-date/4-get-date-ago/_js.view/solution.js b/1-js/4-data-types/17-date/4-get-date-ago/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/09-date/4-get-date-ago/_js.view/solution.js rename to 1-js/4-data-types/17-date/4-get-date-ago/_js.view/solution.js diff --git a/1-js/6-data-types/09-date/4-get-date-ago/_js.view/test.js b/1-js/4-data-types/17-date/4-get-date-ago/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/09-date/4-get-date-ago/_js.view/test.js rename to 1-js/4-data-types/17-date/4-get-date-ago/_js.view/test.js diff --git a/1-js/6-data-types/09-date/4-get-date-ago/solution.md b/1-js/4-data-types/17-date/4-get-date-ago/solution.md similarity index 100% rename from 1-js/6-data-types/09-date/4-get-date-ago/solution.md rename to 1-js/4-data-types/17-date/4-get-date-ago/solution.md diff --git a/1-js/6-data-types/09-date/4-get-date-ago/task.md b/1-js/4-data-types/17-date/4-get-date-ago/task.md similarity index 100% rename from 1-js/6-data-types/09-date/4-get-date-ago/task.md rename to 1-js/4-data-types/17-date/4-get-date-ago/task.md diff --git a/1-js/6-data-types/09-date/5-last-day-of-month/_js.view/solution.js b/1-js/4-data-types/17-date/5-last-day-of-month/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/09-date/5-last-day-of-month/_js.view/solution.js rename to 1-js/4-data-types/17-date/5-last-day-of-month/_js.view/solution.js diff --git a/1-js/6-data-types/09-date/5-last-day-of-month/_js.view/test.js b/1-js/4-data-types/17-date/5-last-day-of-month/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/09-date/5-last-day-of-month/_js.view/test.js rename to 1-js/4-data-types/17-date/5-last-day-of-month/_js.view/test.js diff --git a/1-js/6-data-types/09-date/5-last-day-of-month/solution.md b/1-js/4-data-types/17-date/5-last-day-of-month/solution.md similarity index 100% rename from 1-js/6-data-types/09-date/5-last-day-of-month/solution.md rename to 1-js/4-data-types/17-date/5-last-day-of-month/solution.md diff --git a/1-js/6-data-types/09-date/5-last-day-of-month/task.md b/1-js/4-data-types/17-date/5-last-day-of-month/task.md similarity index 100% rename from 1-js/6-data-types/09-date/5-last-day-of-month/task.md rename to 1-js/4-data-types/17-date/5-last-day-of-month/task.md diff --git a/1-js/6-data-types/09-date/6-get-seconds-today/solution.md b/1-js/4-data-types/17-date/6-get-seconds-today/solution.md similarity index 100% rename from 1-js/6-data-types/09-date/6-get-seconds-today/solution.md rename to 1-js/4-data-types/17-date/6-get-seconds-today/solution.md diff --git a/1-js/6-data-types/09-date/6-get-seconds-today/task.md b/1-js/4-data-types/17-date/6-get-seconds-today/task.md similarity index 100% rename from 1-js/6-data-types/09-date/6-get-seconds-today/task.md rename to 1-js/4-data-types/17-date/6-get-seconds-today/task.md diff --git a/1-js/6-data-types/09-date/7-get-seconds-to-tomorrow/solution.md b/1-js/4-data-types/17-date/7-get-seconds-to-tomorrow/solution.md similarity index 100% rename from 1-js/6-data-types/09-date/7-get-seconds-to-tomorrow/solution.md rename to 1-js/4-data-types/17-date/7-get-seconds-to-tomorrow/solution.md diff --git a/1-js/6-data-types/09-date/7-get-seconds-to-tomorrow/task.md b/1-js/4-data-types/17-date/7-get-seconds-to-tomorrow/task.md similarity index 100% rename from 1-js/6-data-types/09-date/7-get-seconds-to-tomorrow/task.md rename to 1-js/4-data-types/17-date/7-get-seconds-to-tomorrow/task.md diff --git a/1-js/6-data-types/09-date/8-format-date-ddmmyy/_js.view/solution.js b/1-js/4-data-types/17-date/8-format-date-ddmmyy/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/09-date/8-format-date-ddmmyy/_js.view/solution.js rename to 1-js/4-data-types/17-date/8-format-date-ddmmyy/_js.view/solution.js diff --git a/1-js/6-data-types/09-date/8-format-date-ddmmyy/_js.view/test.js b/1-js/4-data-types/17-date/8-format-date-ddmmyy/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/09-date/8-format-date-ddmmyy/_js.view/test.js rename to 1-js/4-data-types/17-date/8-format-date-ddmmyy/_js.view/test.js diff --git a/1-js/6-data-types/09-date/8-format-date-ddmmyy/solution.md b/1-js/4-data-types/17-date/8-format-date-ddmmyy/solution.md similarity index 100% rename from 1-js/6-data-types/09-date/8-format-date-ddmmyy/solution.md rename to 1-js/4-data-types/17-date/8-format-date-ddmmyy/solution.md diff --git a/1-js/6-data-types/09-date/8-format-date-ddmmyy/task.md b/1-js/4-data-types/17-date/8-format-date-ddmmyy/task.md similarity index 100% rename from 1-js/6-data-types/09-date/8-format-date-ddmmyy/task.md rename to 1-js/4-data-types/17-date/8-format-date-ddmmyy/task.md diff --git a/1-js/6-data-types/09-date/9-format-date-relative/_js.view/solution.js b/1-js/4-data-types/17-date/9-format-date-relative/_js.view/solution.js similarity index 100% rename from 1-js/6-data-types/09-date/9-format-date-relative/_js.view/solution.js rename to 1-js/4-data-types/17-date/9-format-date-relative/_js.view/solution.js diff --git a/1-js/6-data-types/09-date/9-format-date-relative/_js.view/test.js b/1-js/4-data-types/17-date/9-format-date-relative/_js.view/test.js similarity index 100% rename from 1-js/6-data-types/09-date/9-format-date-relative/_js.view/test.js rename to 1-js/4-data-types/17-date/9-format-date-relative/_js.view/test.js diff --git a/1-js/6-data-types/09-date/9-format-date-relative/solution.md b/1-js/4-data-types/17-date/9-format-date-relative/solution.md similarity index 100% rename from 1-js/6-data-types/09-date/9-format-date-relative/solution.md rename to 1-js/4-data-types/17-date/9-format-date-relative/solution.md diff --git a/1-js/6-data-types/09-date/9-format-date-relative/task.md b/1-js/4-data-types/17-date/9-format-date-relative/task.md similarity index 100% rename from 1-js/6-data-types/09-date/9-format-date-relative/task.md rename to 1-js/4-data-types/17-date/9-format-date-relative/task.md diff --git a/1-js/6-data-types/09-date/article.md b/1-js/4-data-types/17-date/article.md similarity index 98% rename from 1-js/6-data-types/09-date/article.md rename to 1-js/4-data-types/17-date/article.md index c5519678..50a992f0 100644 --- a/1-js/6-data-types/09-date/article.md +++ b/1-js/4-data-types/17-date/article.md @@ -1,4 +1,4 @@ -# Date and time +# Date and time [todo: performance.now for future] JavaScript has a built-in object [Date](mdn:js/Date) for date/time management. @@ -224,11 +224,9 @@ let end = new Date(); // done alert( `The loop took ${end - start} ms` ); ``` -### Benchmarking +## Benchmarking, performance.now -Let's say we have several ways to solve a task, each one described as a function. - -How to see which one is faster. That's called a "benchmarking". +If we want a reliable benchmark of CPU-hungry function, we should be more careful. For instance, let's consider two functions to walk the array: diff --git a/1-js/3-object-basics/9-json/1-serialize-object/solution.md b/1-js/4-data-types/19-json/1-serialize-object/solution.md similarity index 100% rename from 1-js/3-object-basics/9-json/1-serialize-object/solution.md rename to 1-js/4-data-types/19-json/1-serialize-object/solution.md diff --git a/1-js/3-object-basics/9-json/1-serialize-object/task.md b/1-js/4-data-types/19-json/1-serialize-object/task.md similarity index 100% rename from 1-js/3-object-basics/9-json/1-serialize-object/task.md rename to 1-js/4-data-types/19-json/1-serialize-object/task.md diff --git a/1-js/3-object-basics/9-json/2-serialize-object-circular/solution.md b/1-js/4-data-types/19-json/2-serialize-object-circular/solution.md similarity index 100% rename from 1-js/3-object-basics/9-json/2-serialize-object-circular/solution.md rename to 1-js/4-data-types/19-json/2-serialize-object-circular/solution.md diff --git a/1-js/3-object-basics/9-json/2-serialize-object-circular/task.md b/1-js/4-data-types/19-json/2-serialize-object-circular/task.md similarity index 100% rename from 1-js/3-object-basics/9-json/2-serialize-object-circular/task.md rename to 1-js/4-data-types/19-json/2-serialize-object-circular/task.md diff --git a/1-js/3-object-basics/9-json/article.md b/1-js/4-data-types/19-json/article.md similarity index 100% rename from 1-js/3-object-basics/9-json/article.md rename to 1-js/4-data-types/19-json/article.md diff --git a/1-js/6-data-types/index.md b/1-js/4-data-types/index.md similarity index 100% rename from 1-js/6-data-types/index.md rename to 1-js/4-data-types/index.md diff --git a/1-js/4-more-syntax/1-function-arguments-rest-spread/article.md b/1-js/5-more-syntax/1-function-arguments-rest-spread/article.md similarity index 100% rename from 1-js/4-more-syntax/1-function-arguments-rest-spread/article.md rename to 1-js/5-more-syntax/1-function-arguments-rest-spread/article.md diff --git a/1-js/4-more-syntax/2-destructuring-assignment/1-destructuring-assignment/solution.md b/1-js/5-more-syntax/2-destructuring-assignment/1-destructuring-assignment/solution.md similarity index 100% rename from 1-js/4-more-syntax/2-destructuring-assignment/1-destructuring-assignment/solution.md rename to 1-js/5-more-syntax/2-destructuring-assignment/1-destructuring-assignment/solution.md diff --git a/1-js/4-more-syntax/2-destructuring-assignment/1-destructuring-assignment/task.md b/1-js/5-more-syntax/2-destructuring-assignment/1-destructuring-assignment/task.md similarity index 100% rename from 1-js/4-more-syntax/2-destructuring-assignment/1-destructuring-assignment/task.md rename to 1-js/5-more-syntax/2-destructuring-assignment/1-destructuring-assignment/task.md diff --git a/1-js/4-more-syntax/2-destructuring-assignment/article.md b/1-js/5-more-syntax/2-destructuring-assignment/article.md similarity index 100% rename from 1-js/4-more-syntax/2-destructuring-assignment/article.md rename to 1-js/5-more-syntax/2-destructuring-assignment/article.md diff --git a/1-js/4-more-syntax/2-destructuring-assignment/destructuring-complex.png b/1-js/5-more-syntax/2-destructuring-assignment/destructuring-complex.png similarity index 100% rename from 1-js/4-more-syntax/2-destructuring-assignment/destructuring-complex.png rename to 1-js/5-more-syntax/2-destructuring-assignment/destructuring-complex.png diff --git a/1-js/4-more-syntax/2-destructuring-assignment/destructuring-complex@2x.png b/1-js/5-more-syntax/2-destructuring-assignment/destructuring-complex@2x.png similarity index 100% rename from 1-js/4-more-syntax/2-destructuring-assignment/destructuring-complex@2x.png rename to 1-js/5-more-syntax/2-destructuring-assignment/destructuring-complex@2x.png diff --git a/1-js/4-more-syntax/3-advanced-loops/1-iterable-keys/solution.md b/1-js/5-more-syntax/3-advanced-loops/1-iterable-keys/solution.md similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/1-iterable-keys/solution.md rename to 1-js/5-more-syntax/3-advanced-loops/1-iterable-keys/solution.md diff --git a/1-js/4-more-syntax/3-advanced-loops/1-iterable-keys/task.md b/1-js/5-more-syntax/3-advanced-loops/1-iterable-keys/task.md similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/1-iterable-keys/task.md rename to 1-js/5-more-syntax/3-advanced-loops/1-iterable-keys/task.md diff --git a/1-js/4-more-syntax/3-advanced-loops/5-sum-salaries/_js.view/solution.js b/1-js/5-more-syntax/3-advanced-loops/5-sum-salaries/_js.view/solution.js similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/5-sum-salaries/_js.view/solution.js rename to 1-js/5-more-syntax/3-advanced-loops/5-sum-salaries/_js.view/solution.js diff --git a/1-js/4-more-syntax/3-advanced-loops/5-sum-salaries/_js.view/test.js b/1-js/5-more-syntax/3-advanced-loops/5-sum-salaries/_js.view/test.js similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/5-sum-salaries/_js.view/test.js rename to 1-js/5-more-syntax/3-advanced-loops/5-sum-salaries/_js.view/test.js diff --git a/1-js/6-data-types/07-array-methods/1-camelcase/solution.md b/1-js/5-more-syntax/3-advanced-loops/5-sum-salaries/solution.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/1-camelcase/solution.md rename to 1-js/5-more-syntax/3-advanced-loops/5-sum-salaries/solution.md diff --git a/1-js/4-more-syntax/3-advanced-loops/5-sum-salaries/task.md b/1-js/5-more-syntax/3-advanced-loops/5-sum-salaries/task.md similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/5-sum-salaries/task.md rename to 1-js/5-more-syntax/3-advanced-loops/5-sum-salaries/task.md diff --git a/1-js/4-more-syntax/3-advanced-loops/6-max-salary/_js.view/solution.js b/1-js/5-more-syntax/3-advanced-loops/6-max-salary/_js.view/solution.js similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/6-max-salary/_js.view/solution.js rename to 1-js/5-more-syntax/3-advanced-loops/6-max-salary/_js.view/solution.js diff --git a/1-js/4-more-syntax/3-advanced-loops/6-max-salary/_js.view/test.js b/1-js/5-more-syntax/3-advanced-loops/6-max-salary/_js.view/test.js similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/6-max-salary/_js.view/test.js rename to 1-js/5-more-syntax/3-advanced-loops/6-max-salary/_js.view/test.js diff --git a/1-js/6-data-types/07-array-methods/2-filter-range/solution.md b/1-js/5-more-syntax/3-advanced-loops/6-max-salary/solution.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/2-filter-range/solution.md rename to 1-js/5-more-syntax/3-advanced-loops/6-max-salary/solution.md diff --git a/1-js/4-more-syntax/3-advanced-loops/6-max-salary/task.md b/1-js/5-more-syntax/3-advanced-loops/6-max-salary/task.md similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/6-max-salary/task.md rename to 1-js/5-more-syntax/3-advanced-loops/6-max-salary/task.md diff --git a/1-js/4-more-syntax/3-advanced-loops/7-count-properties/_js.view/solution.js b/1-js/5-more-syntax/3-advanced-loops/7-count-properties/_js.view/solution.js similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/7-count-properties/_js.view/solution.js rename to 1-js/5-more-syntax/3-advanced-loops/7-count-properties/_js.view/solution.js diff --git a/1-js/4-more-syntax/3-advanced-loops/7-count-properties/_js.view/test.js b/1-js/5-more-syntax/3-advanced-loops/7-count-properties/_js.view/test.js similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/7-count-properties/_js.view/test.js rename to 1-js/5-more-syntax/3-advanced-loops/7-count-properties/_js.view/test.js diff --git a/1-js/6-data-types/07-array-methods/3-filter-range-in-place/solution.md b/1-js/5-more-syntax/3-advanced-loops/7-count-properties/solution.md similarity index 100% rename from 1-js/6-data-types/07-array-methods/3-filter-range-in-place/solution.md rename to 1-js/5-more-syntax/3-advanced-loops/7-count-properties/solution.md diff --git a/1-js/4-more-syntax/3-advanced-loops/7-count-properties/task.md b/1-js/5-more-syntax/3-advanced-loops/7-count-properties/task.md similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/7-count-properties/task.md rename to 1-js/5-more-syntax/3-advanced-loops/7-count-properties/task.md diff --git a/1-js/4-more-syntax/3-advanced-loops/article.md b/1-js/5-more-syntax/3-advanced-loops/article.md similarity index 100% rename from 1-js/4-more-syntax/3-advanced-loops/article.md rename to 1-js/5-more-syntax/3-advanced-loops/article.md diff --git a/1-js/4-more-syntax/index.md b/1-js/5-more-syntax/index.md similarity index 100% rename from 1-js/4-more-syntax/index.md rename to 1-js/5-more-syntax/index.md diff --git a/1-js/6-data-types/03-object2/article.md b/1-js/6-data-types2/03-object2/article.md similarity index 100% rename from 1-js/6-data-types/03-object2/article.md rename to 1-js/6-data-types2/03-object2/article.md diff --git a/1-js/6-data-types2/index.md b/1-js/6-data-types2/index.md new file mode 100644 index 00000000..246e2bc9 --- /dev/null +++ b/1-js/6-data-types2/index.md @@ -0,0 +1,3 @@ +# Data types + +More data structures and more in-depth study of the types. diff --git a/1-js/plan3.txt b/1-js/plan3.txt index 194abba0..f0a12a0b 100644 --- a/1-js/plan3.txt +++ b/1-js/plan3.txt @@ -18,36 +18,31 @@ first-steps function-basics (decl, shadowing, naming, default params) function-expressions-arrows (function expr, arrow, todo: move new Function out of this?) javascript-specials (TODO, remove it? migrate all function* to separate chapter?) -object-basics - object(props, for-in, refs, assign) - garbage-collection - object-methods (this, method syntax, no call/apply) - primitives-methods (on-the-fly objects) - symbol - object-toprimitive - array - iterable - <<< json -more-syntax - function-arguments-rest-spread - destructuring-assignment (also func params destructuring) - advanced-loops (iterators over objects, arrays) code-quality debugging-chrome (TODO) coding-style (TODO) write-unmaintainable-code (TODO) test-driven-development (TODO) polyfills (TODO) -data-types - number (rounding, precision, isFinite, isNaN, parse*, Math.*) - string (quotes, search, substring, tagged template notice) - - - <<< property-descriptors - +object-basics + object(props, for-in, refs, assign) + garbage-collection + object-methods (this, method syntax, no call/apply) + constructor-new + symbol + object-toprimitive + << number (rounding, precision, isFinite, isNaN, parse*, Math.*) + << string (quotes, search, substring, tagged template notice) + array array-methods (TODO: translate tasks) + iterable map-set-weakmap-weakset date (TODO: tasks) + <<< json? +more-syntax + function-arguments-rest-spread + destructuring-assignment (also func params destructuring) + advanced-loops (iterators over objects, arrays) deeper recursion running execution context = where + lexical environment = envrec + outer @@ -85,9 +80,15 @@ instanceof descriptors +proxy? + +error-handling + try..catch + object-oriented error handling (inheritance, rethrow etc) more-features try..catch + try..catch in decorators! setTimeout JSON