From e6b05ee25dcbc3b9ef7037928731cff4df6e2b55 Mon Sep 17 00:00:00 2001 From: freeCodeCamp's Camper Bot Date: Fri, 26 Apr 2024 10:56:37 +0530 Subject: [PATCH] chore(i18n,learn): processed translations (#54537) Co-authored-by: Naomi --- .../index.md | 1 - .../meta.json | 3 +- .../confirm-the-ending.md | 2 +- .../repeat-a-string-repeat-a-string.md | 2 +- .../add-items-using-splice.md | 6 +- ...d-key-value-pairs-to-javascript-objects.md | 4 +- .../check-if-an-object-has-a-property.md | 2 +- .../copy-an-array-with-the-spread-operator.md | 2 +- .../copy-array-items-using-slice.md | 2 +- ...-of-an-object-with-a-for...in-statement.md | 2 +- ...odify-an-object-nested-within-an-object.md | 2 +- .../remove-items-using-splice.md | 6 +- ...ete-keyword-to-remove-object-properties.md | 6 +- .../access-array-data-with-indexes.md | 2 +- ...s-multi-dimensional-arrays-with-indexes.md | 2 +- .../accessing-nested-arrays.md | 2 +- ...object-properties-with-bracket-notation.md | 2 +- ...ing-object-properties-with-dot-notation.md | 2 +- ...essing-object-properties-with-variables.md | 6 +- ...d-new-properties-to-a-javascript-object.md | 2 +- .../add-two-numbers-with-javascript.md | 2 +- ...g-a-default-option-in-switch-statements.md | 4 +- .../appending-variables-to-strings.md | 2 +- ...ng-the-value-of-one-variable-to-another.md | 4 +- .../assignment-with-a-returned-value.md | 2 +- .../chaining-if-else-statements.md | 6 +- .../comment-your-javascript-code.md | 1 - .../comparison-with-the-equality-operator.md | 2 +- ...mparison-with-the-greater-than-operator.md | 2 +- ...h-the-greater-than-or-equal-to-operator.md | 2 +- ...comparison-with-the-inequality-operator.md | 2 +- .../comparison-with-the-less-than-operator.md | 2 +- ...with-the-less-than-or-equal-to-operator.md | 2 +- ...rison-with-the-strict-equality-operator.md | 2 +- ...son-with-the-strict-inequality-operator.md | 2 +- ...mparisons-with-the-logical-and-operator.md | 4 +- ...omparisons-with-the-logical-or-operator.md | 4 +- ...ound-assignment-with-augmented-addition.md | 8 +- ...ound-assignment-with-augmented-division.md | 8 +- ...ssignment-with-augmented-multiplication.md | 8 +- ...d-assignment-with-augmented-subtraction.md | 4 +- ...oncatenating-strings-with-plus-operator.md | 6 +- ...g-strings-with-the-plus-equals-operator.md | 2 +- .../constructing-strings-with-variables.md | 2 +- .../count-backwards-with-a-for-loop.md | 4 +- .../declare-javascript-variables.md | 2 +- .../decrement-a-number-with-javascript.md | 8 +- ...ete-properties-from-a-javascript-object.md | 2 +- ...-one-decimal-by-another-with-javascript.md | 4 +- ...e-one-number-by-another-with-javascript.md | 2 +- .../escaping-literal-quotes-in-strings.md | 2 +- .../find-the-length-of-a-string.md | 6 +- .../finding-a-remainder-in-javascript.md | 4 +- ...nerate-random-fractions-with-javascript.md | 2 +- ...te-random-whole-numbers-with-javascript.md | 8 +- ...ate-random-whole-numbers-within-a-range.md | 8 +- .../global-scope-and-functions.md | 2 +- .../global-vs.-local-scope-in-functions.md | 2 +- .../increment-a-number-with-javascript.md | 6 +- ...-variables-with-the-assignment-operator.md | 2 +- .../introducing-else-if-statements.md | 6 +- .../introducing-else-statements.md | 6 +- .../iterate-odd-numbers-with-a-for-loop.md | 2 +- ...terate-through-an-array-with-a-for-loop.md | 6 +- ...terate-with-javascript-do...while-loops.md | 2 +- .../iterate-with-javascript-for-loops.md | 2 +- .../iterate-with-javascript-while-loops.md | 2 +- .../local-scope-and-functions.md | 2 +- .../manipulate-arrays-with-pop.md | 2 +- .../modify-array-data-with-indexes.md | 2 +- ...-identical-options-in-switch-statements.md | 4 +- .../multiply-two-decimals-with-javascript.md | 2 +- .../multiply-two-numbers-with-javascript.md | 2 +- ...sing-values-to-functions-with-arguments.md | 2 +- .../practice-comparing-different-values.md | 2 +- .../quoting-strings-with-single-quotes.md | 4 +- .../replace-loops-using-recursion.md | 2 +- .../replacing-if-else-chains-with-switch.md | 6 +- ...returning-boolean-values-from-functions.md | 2 +- ...rom-many-options-with-switch-statements.md | 4 +- ...ing-values-with-the-assignment-operator.md | 2 +- ...one-number-from-another-with-javascript.md | 2 +- .../understand-string-immutability.md | 2 +- ...rstanding-case-sensitivity-in-variables.md | 6 +- .../understanding-uninitialized-variables.md | 6 +- .../updating-object-properties.md | 2 +- ...to-find-the-first-character-in-a-string.md | 2 +- ...-to-find-the-last-character-in-a-string.md | 2 +- ...n-to-find-the-nth-character-in-a-string.md | 2 +- ...d-the-nth-to-last-character-in-a-string.md | 2 +- ...-multiple-conditional-ternary-operators.md | 2 +- .../use-recursion-to-create-a-countdown.md | 2 +- ...-recursion-to-create-a-range-of-numbers.md | 2 +- .../use-the-conditional-ternary-operator.md | 2 +- .../use-the-parseint-function-with-a-radix.md | 2 +- .../use-the-parseint-function.md | 2 +- .../using-objects-for-lookups.md | 4 +- .../basic-javascript/word-blanks.md | 2 +- ...rite-reusable-javascript-with-functions.md | 2 +- ...the-wrong-order-when-calling-a-function.md | 2 +- ...osing-parenthesis-after-a-function-call.md | 2 +- ...-misspelled-variable-and-function-names.md | 8 +- ...mixed-usage-of-single-and-double-quotes.md | 4 +- ...h-off-by-one-errors-when-using-indexing.md | 8 +- ...-parentheses-brackets-braces-and-quotes.md | 2 +- ...t-operator-instead-of-equality-operator.md | 2 +- ...e-loops-with-a-valid-terminal-condition.md | 4 +- ...en-the-freecodecamp-and-browser-console.md | 6 +- ...onsole-to-check-the-value-of-a-variable.md | 2 +- ...-typeof-to-check-the-type-of-a-variable.md | 6 +- ...pare-scopes-of-the-var-and-let-keywords.md | 4 +- ...plete-a-promise-with-resolve-and-reject.md | 4 +- .../es6/create-a-javascript-promise.md | 2 +- .../es6/create-a-module-script.md | 6 +- ...-an-export-fallback-with-export-default.md | 2 +- .../create-strings-using-template-literals.md | 2 +- .../handle-a-fulfilled-promise-with-then.md | 6 +- .../handle-a-rejected-promise-with-catch.md | 6 +- .../es6/import-a-default-export.md | 2 +- .../mutate-an-array-declared-with-const.md | 6 +- .../es6/prevent-object-mutation.md | 6 +- .../es6/reuse-javascript-code-using-import.md | 4 +- ...t-default-parameters-for-your-functions.md | 2 +- .../use--to-import-everything-from-a-file.md | 2 +- ...syntax-to-define-a-constructor-function.md | 2 +- ...ignment-to-assign-variables-from-arrays.md | 2 +- ...to-assign-variables-from-nested-objects.md | 8 +- ...gnment-to-assign-variables-from-objects.md | 8 +- ...signment-to-extract-values-from-objects.md | 6 +- ...ass-an-object-as-a-functions-parameters.md | 4 +- ...st-parameter-to-reassign-array-elements.md | 2 +- .../es6/use-export-to-share-a-code-block.md | 4 +- ...rest-parameter-with-function-parameters.md | 2 +- ...ad-operator-to-evaluate-arrays-in-place.md | 2 +- .../write-arrow-functions-with-parameters.md | 2 +- ...-concise-declarative-functions-with-es6.md | 4 +- ...rations-using-object-property-shorthand.md | 2 +- ...f-an-array-using-concat-instead-of-push.md | 4 +- ...ramming-to-convert-strings-to-url-slugs.md | 2 +- ...ray-into-a-string-using-the-join-method.md | 4 +- ...bine-two-arrays-using-the-concat-method.md | 2 +- .../implement-map-on-a-prototype.md | 2 +- ...lement-the-filter-method-on-a-prototype.md | 2 +- ...ion-to-currying-and-partial-application.md | 2 +- ...-an-array-using-slice-instead-of-splice.md | 4 +- ...part-of-an-array-using-the-slice-method.md | 2 +- ...ay-alphabetically-using-the-sort-method.md | 2 +- ...ng-into-an-array-using-the-split-method.md | 2 +- ...er-or-reduce-to-solve-a-complex-problem.md | 4 +- ...ry-element-in-an-array-meets-a-criteria.md | 2 +- ...er-method-to-extract-data-from-an-array.md | 4 +- ...ap-method-to-extract-data-from-an-array.md | 4 +- .../use-the-reduce-method-to-analyze-data.md | 4 +- ...ny-elements-in-an-array-meet-a-criteria.md | 2 +- .../steamroller.md | 2 +- .../change-the-prototype-to-a-new-object.md | 2 +- .../inherit-behaviors-from-a-supertype.md | 4 +- .../iterate-over-all-properties.md | 2 +- ...ode-more-reusable-with-the-this-keyword.md | 2 +- .../understand-own-properties.md | 4 +- .../understand-the-constructor-property.md | 2 +- ...iately-invoked-function-expression-iife.md | 4 +- .../understand-the-prototype-chain.md | 2 +- ...d-where-an-objects-prototype-comes-from.md | 2 +- .../use-a-constructor-to-create-objects.md | 2 +- ...n-object-from-being-modified-externally.md | 4 +- ...n-to-access-the-properties-of-an-object.md | 4 +- ...-an-objects-constructor-with-instanceof.md | 2 +- .../check-for-mixed-grouping-of-characters.md | 2 +- .../regular-expressions/extract-matches.md | 2 +- .../match-anything-with-wildcard-period.md | 2 +- .../match-literal-strings.md | 2 +- .../remove-whitespace-from-start-and-end.md | 4 +- ...se-capture-groups-to-search-and-replace.md | 4 +- .../using-the-test-method.md | 2 +- .../65687da2e60409c45595bbe1.md | 9 +- .../probability-calculator.md | 63 ++++++-- .../learn-how-a-stack-works.md | 4 +- .../5f356ed60a5decd94ab66986.md | 1 - .../60a3e3396c7b40068ad6998c.md | 4 +- .../645763874fd6d901c273db29.md | 2 +- .../641130423e5f512d8972dae1.md | 6 +- .../64113124efd2852edafaf25f.md | 2 +- .../6449842c6f6c84261075e4c9.md | 2 + .../660f374d532dc41189cc9cc2.md | 8 +- .../660f3ce51f70571e1c5227c8.md | 1 - .../660f3dd626be3a1ffe27e5d1.md | 1 - .../660f4f79e2a82a4e92290f44.md | 1 - .../660f53ad3d39175c5d4335ac.md | 1 - .../662693f82c91a66be46c881b.md | 74 +++++++++ .../6626a060c4006f793e10cb33.md | 104 +++++++++++++ .../6626b4c58c027d86478ff5eb.md | 88 +++++++++++ .../6626b8dcf5057f896f948440.md | 143 ++++++++++++++++++ .../confirm-the-ending.md | 2 +- .../repeat-a-string-repeat-a-string.md | 2 +- .../add-items-using-splice.md | 6 +- ...d-key-value-pairs-to-javascript-objects.md | 4 +- .../check-if-an-object-has-a-property.md | 2 +- .../copy-an-array-with-the-spread-operator.md | 2 +- .../copy-array-items-using-slice.md | 2 +- ...-of-an-object-with-a-for...in-statement.md | 2 +- ...odify-an-object-nested-within-an-object.md | 2 +- .../remove-items-using-splice.md | 6 +- ...ete-keyword-to-remove-object-properties.md | 6 +- .../access-array-data-with-indexes.md | 2 +- ...s-multi-dimensional-arrays-with-indexes.md | 2 +- .../accessing-nested-arrays.md | 2 +- ...object-properties-with-bracket-notation.md | 2 +- ...ing-object-properties-with-dot-notation.md | 2 +- ...essing-object-properties-with-variables.md | 6 +- ...d-new-properties-to-a-javascript-object.md | 2 +- .../add-two-numbers-with-javascript.md | 2 +- ...g-a-default-option-in-switch-statements.md | 4 +- .../appending-variables-to-strings.md | 2 +- ...ng-the-value-of-one-variable-to-another.md | 4 +- .../assignment-with-a-returned-value.md | 2 +- .../chaining-if-else-statements.md | 6 +- .../comment-your-javascript-code.md | 1 - .../comparison-with-the-equality-operator.md | 2 +- ...mparison-with-the-greater-than-operator.md | 2 +- ...h-the-greater-than-or-equal-to-operator.md | 2 +- ...comparison-with-the-inequality-operator.md | 2 +- .../comparison-with-the-less-than-operator.md | 2 +- ...with-the-less-than-or-equal-to-operator.md | 2 +- ...rison-with-the-strict-equality-operator.md | 2 +- ...son-with-the-strict-inequality-operator.md | 2 +- ...mparisons-with-the-logical-and-operator.md | 4 +- ...omparisons-with-the-logical-or-operator.md | 4 +- ...ound-assignment-with-augmented-addition.md | 8 +- ...ound-assignment-with-augmented-division.md | 8 +- ...ssignment-with-augmented-multiplication.md | 8 +- ...d-assignment-with-augmented-subtraction.md | 4 +- ...oncatenating-strings-with-plus-operator.md | 6 +- ...g-strings-with-the-plus-equals-operator.md | 2 +- .../constructing-strings-with-variables.md | 2 +- .../count-backwards-with-a-for-loop.md | 4 +- .../declare-javascript-variables.md | 2 +- .../decrement-a-number-with-javascript.md | 8 +- ...ete-properties-from-a-javascript-object.md | 2 +- ...-one-decimal-by-another-with-javascript.md | 4 +- ...e-one-number-by-another-with-javascript.md | 2 +- .../escaping-literal-quotes-in-strings.md | 2 +- .../find-the-length-of-a-string.md | 6 +- .../finding-a-remainder-in-javascript.md | 4 +- ...nerate-random-fractions-with-javascript.md | 2 +- ...te-random-whole-numbers-with-javascript.md | 8 +- ...ate-random-whole-numbers-within-a-range.md | 8 +- .../global-scope-and-functions.md | 2 +- .../global-vs.-local-scope-in-functions.md | 2 +- .../increment-a-number-with-javascript.md | 6 +- ...-variables-with-the-assignment-operator.md | 2 +- .../introducing-else-if-statements.md | 6 +- .../introducing-else-statements.md | 6 +- .../iterate-odd-numbers-with-a-for-loop.md | 2 +- ...terate-through-an-array-with-a-for-loop.md | 6 +- ...terate-with-javascript-do...while-loops.md | 2 +- .../iterate-with-javascript-for-loops.md | 2 +- .../iterate-with-javascript-while-loops.md | 2 +- .../local-scope-and-functions.md | 2 +- .../manipulate-arrays-with-pop.md | 2 +- .../modify-array-data-with-indexes.md | 2 +- ...-identical-options-in-switch-statements.md | 4 +- .../multiply-two-decimals-with-javascript.md | 2 +- .../multiply-two-numbers-with-javascript.md | 2 +- ...sing-values-to-functions-with-arguments.md | 2 +- .../practice-comparing-different-values.md | 2 +- .../quoting-strings-with-single-quotes.md | 4 +- .../replace-loops-using-recursion.md | 2 +- .../replacing-if-else-chains-with-switch.md | 6 +- ...returning-boolean-values-from-functions.md | 2 +- ...rom-many-options-with-switch-statements.md | 4 +- ...ing-values-with-the-assignment-operator.md | 2 +- ...one-number-from-another-with-javascript.md | 2 +- .../understand-string-immutability.md | 2 +- ...rstanding-case-sensitivity-in-variables.md | 6 +- .../understanding-uninitialized-variables.md | 6 +- .../updating-object-properties.md | 2 +- ...to-find-the-first-character-in-a-string.md | 2 +- ...-to-find-the-last-character-in-a-string.md | 2 +- ...n-to-find-the-nth-character-in-a-string.md | 2 +- ...d-the-nth-to-last-character-in-a-string.md | 2 +- ...-multiple-conditional-ternary-operators.md | 2 +- .../use-recursion-to-create-a-countdown.md | 2 +- ...-recursion-to-create-a-range-of-numbers.md | 2 +- .../use-the-conditional-ternary-operator.md | 2 +- .../use-the-parseint-function-with-a-radix.md | 2 +- .../use-the-parseint-function.md | 2 +- .../using-objects-for-lookups.md | 4 +- .../basic-javascript/word-blanks.md | 2 +- ...rite-reusable-javascript-with-functions.md | 2 +- ...the-wrong-order-when-calling-a-function.md | 2 +- ...osing-parenthesis-after-a-function-call.md | 2 +- ...-misspelled-variable-and-function-names.md | 8 +- ...mixed-usage-of-single-and-double-quotes.md | 4 +- ...h-off-by-one-errors-when-using-indexing.md | 8 +- ...-parentheses-brackets-braces-and-quotes.md | 2 +- ...t-operator-instead-of-equality-operator.md | 2 +- ...e-loops-with-a-valid-terminal-condition.md | 4 +- ...en-the-freecodecamp-and-browser-console.md | 6 +- ...onsole-to-check-the-value-of-a-variable.md | 2 +- ...-typeof-to-check-the-type-of-a-variable.md | 6 +- ...pare-scopes-of-the-var-and-let-keywords.md | 4 +- ...plete-a-promise-with-resolve-and-reject.md | 4 +- .../es6/create-a-javascript-promise.md | 2 +- .../es6/create-a-module-script.md | 6 +- ...-an-export-fallback-with-export-default.md | 2 +- .../create-strings-using-template-literals.md | 2 +- .../handle-a-fulfilled-promise-with-then.md | 6 +- .../handle-a-rejected-promise-with-catch.md | 6 +- .../es6/import-a-default-export.md | 2 +- .../mutate-an-array-declared-with-const.md | 6 +- .../es6/prevent-object-mutation.md | 6 +- .../es6/reuse-javascript-code-using-import.md | 4 +- ...t-default-parameters-for-your-functions.md | 2 +- .../use--to-import-everything-from-a-file.md | 2 +- ...syntax-to-define-a-constructor-function.md | 2 +- ...ignment-to-assign-variables-from-arrays.md | 2 +- ...to-assign-variables-from-nested-objects.md | 8 +- ...gnment-to-assign-variables-from-objects.md | 8 +- ...signment-to-extract-values-from-objects.md | 6 +- ...ass-an-object-as-a-functions-parameters.md | 4 +- ...st-parameter-to-reassign-array-elements.md | 2 +- .../es6/use-export-to-share-a-code-block.md | 4 +- ...rest-parameter-with-function-parameters.md | 2 +- ...ad-operator-to-evaluate-arrays-in-place.md | 2 +- .../write-arrow-functions-with-parameters.md | 2 +- ...-concise-declarative-functions-with-es6.md | 4 +- ...rations-using-object-property-shorthand.md | 2 +- ...f-an-array-using-concat-instead-of-push.md | 4 +- ...ramming-to-convert-strings-to-url-slugs.md | 2 +- ...ray-into-a-string-using-the-join-method.md | 4 +- ...bine-two-arrays-using-the-concat-method.md | 2 +- .../implement-map-on-a-prototype.md | 2 +- ...lement-the-filter-method-on-a-prototype.md | 2 +- ...ion-to-currying-and-partial-application.md | 2 +- ...-an-array-using-slice-instead-of-splice.md | 4 +- ...part-of-an-array-using-the-slice-method.md | 2 +- ...ay-alphabetically-using-the-sort-method.md | 2 +- ...ng-into-an-array-using-the-split-method.md | 2 +- ...er-or-reduce-to-solve-a-complex-problem.md | 4 +- ...ry-element-in-an-array-meets-a-criteria.md | 2 +- ...er-method-to-extract-data-from-an-array.md | 4 +- ...ap-method-to-extract-data-from-an-array.md | 4 +- .../use-the-reduce-method-to-analyze-data.md | 4 +- ...ny-elements-in-an-array-meet-a-criteria.md | 2 +- .../steamroller.md | 2 +- .../change-the-prototype-to-a-new-object.md | 2 +- .../inherit-behaviors-from-a-supertype.md | 4 +- .../iterate-over-all-properties.md | 2 +- ...ode-more-reusable-with-the-this-keyword.md | 2 +- .../understand-own-properties.md | 4 +- .../understand-the-constructor-property.md | 2 +- ...iately-invoked-function-expression-iife.md | 4 +- .../understand-the-prototype-chain.md | 2 +- ...d-where-an-objects-prototype-comes-from.md | 2 +- .../use-a-constructor-to-create-objects.md | 2 +- ...n-object-from-being-modified-externally.md | 4 +- ...n-to-access-the-properties-of-an-object.md | 4 +- ...-an-objects-constructor-with-instanceof.md | 2 +- .../check-for-mixed-grouping-of-characters.md | 2 +- .../regular-expressions/extract-matches.md | 2 +- .../match-anything-with-wildcard-period.md | 2 +- .../match-literal-strings.md | 2 +- .../remove-whitespace-from-start-and-end.md | 4 +- ...se-capture-groups-to-search-and-replace.md | 4 +- .../using-the-test-method.md | 2 +- .../65687da2e60409c45595bbe1.md | 9 +- .../probability-calculator.md | 63 ++++++-- .../learn-how-a-stack-works.md | 4 +- .../5f356ed60a5decd94ab66986.md | 1 - .../60a3e3396c7b40068ad6998c.md | 4 +- .../645763874fd6d901c273db29.md | 2 +- .../641130423e5f512d8972dae1.md | 6 +- .../64113124efd2852edafaf25f.md | 2 +- .../6449842c6f6c84261075e4c9.md | 2 + .../660f374d532dc41189cc9cc2.md | 8 +- .../660f3ce51f70571e1c5227c8.md | 1 - .../660f3dd626be3a1ffe27e5d1.md | 1 - .../660f4f79e2a82a4e92290f44.md | 1 - .../660f53ad3d39175c5d4335ac.md | 1 - .../662693f82c91a66be46c881b.md | 74 +++++++++ .../6626a060c4006f793e10cb33.md | 104 +++++++++++++ .../6626b4c58c027d86478ff5eb.md | 88 +++++++++++ .../6626b8dcf5057f896f948440.md | 143 ++++++++++++++++++ .../confirm-the-ending.md | 2 +- .../repeat-a-string-repeat-a-string.md | 2 +- .../add-items-using-splice.md | 6 +- ...d-key-value-pairs-to-javascript-objects.md | 4 +- .../check-if-an-object-has-a-property.md | 2 +- .../copy-an-array-with-the-spread-operator.md | 2 +- .../copy-array-items-using-slice.md | 2 +- ...-of-an-object-with-a-for...in-statement.md | 2 +- ...odify-an-object-nested-within-an-object.md | 2 +- .../remove-items-using-splice.md | 6 +- ...ete-keyword-to-remove-object-properties.md | 6 +- .../access-array-data-with-indexes.md | 2 +- ...s-multi-dimensional-arrays-with-indexes.md | 2 +- .../accessing-nested-arrays.md | 2 +- ...object-properties-with-bracket-notation.md | 2 +- ...ing-object-properties-with-dot-notation.md | 2 +- ...essing-object-properties-with-variables.md | 6 +- ...d-new-properties-to-a-javascript-object.md | 2 +- .../add-two-numbers-with-javascript.md | 2 +- ...g-a-default-option-in-switch-statements.md | 4 +- .../appending-variables-to-strings.md | 2 +- ...ng-the-value-of-one-variable-to-another.md | 4 +- .../assignment-with-a-returned-value.md | 2 +- .../chaining-if-else-statements.md | 6 +- .../comment-your-javascript-code.md | 1 - .../comparison-with-the-equality-operator.md | 2 +- ...mparison-with-the-greater-than-operator.md | 2 +- ...h-the-greater-than-or-equal-to-operator.md | 2 +- ...comparison-with-the-inequality-operator.md | 2 +- .../comparison-with-the-less-than-operator.md | 2 +- ...with-the-less-than-or-equal-to-operator.md | 2 +- ...rison-with-the-strict-equality-operator.md | 2 +- ...son-with-the-strict-inequality-operator.md | 2 +- ...mparisons-with-the-logical-and-operator.md | 4 +- ...omparisons-with-the-logical-or-operator.md | 4 +- ...ound-assignment-with-augmented-addition.md | 8 +- ...ound-assignment-with-augmented-division.md | 8 +- ...ssignment-with-augmented-multiplication.md | 8 +- ...d-assignment-with-augmented-subtraction.md | 4 +- ...oncatenating-strings-with-plus-operator.md | 6 +- ...g-strings-with-the-plus-equals-operator.md | 2 +- .../constructing-strings-with-variables.md | 2 +- .../count-backwards-with-a-for-loop.md | 4 +- .../declare-javascript-variables.md | 2 +- .../decrement-a-number-with-javascript.md | 8 +- ...ete-properties-from-a-javascript-object.md | 2 +- ...-one-decimal-by-another-with-javascript.md | 4 +- ...e-one-number-by-another-with-javascript.md | 2 +- .../escaping-literal-quotes-in-strings.md | 2 +- .../find-the-length-of-a-string.md | 6 +- .../finding-a-remainder-in-javascript.md | 4 +- ...nerate-random-fractions-with-javascript.md | 2 +- ...te-random-whole-numbers-with-javascript.md | 8 +- ...ate-random-whole-numbers-within-a-range.md | 8 +- .../global-scope-and-functions.md | 2 +- .../global-vs.-local-scope-in-functions.md | 2 +- .../increment-a-number-with-javascript.md | 6 +- ...-variables-with-the-assignment-operator.md | 2 +- .../introducing-else-if-statements.md | 6 +- .../introducing-else-statements.md | 6 +- .../iterate-odd-numbers-with-a-for-loop.md | 2 +- ...terate-through-an-array-with-a-for-loop.md | 6 +- ...terate-with-javascript-do...while-loops.md | 2 +- .../iterate-with-javascript-for-loops.md | 2 +- .../iterate-with-javascript-while-loops.md | 2 +- .../local-scope-and-functions.md | 2 +- .../manipulate-arrays-with-pop.md | 2 +- .../modify-array-data-with-indexes.md | 2 +- ...-identical-options-in-switch-statements.md | 4 +- .../multiply-two-decimals-with-javascript.md | 2 +- .../multiply-two-numbers-with-javascript.md | 2 +- ...sing-values-to-functions-with-arguments.md | 2 +- .../practice-comparing-different-values.md | 2 +- .../quoting-strings-with-single-quotes.md | 4 +- .../replace-loops-using-recursion.md | 2 +- .../replacing-if-else-chains-with-switch.md | 6 +- ...returning-boolean-values-from-functions.md | 2 +- ...rom-many-options-with-switch-statements.md | 4 +- ...ing-values-with-the-assignment-operator.md | 2 +- ...one-number-from-another-with-javascript.md | 2 +- .../understand-string-immutability.md | 2 +- ...rstanding-case-sensitivity-in-variables.md | 6 +- .../understanding-uninitialized-variables.md | 6 +- .../updating-object-properties.md | 2 +- ...to-find-the-first-character-in-a-string.md | 2 +- ...-to-find-the-last-character-in-a-string.md | 2 +- ...n-to-find-the-nth-character-in-a-string.md | 2 +- ...d-the-nth-to-last-character-in-a-string.md | 2 +- ...-multiple-conditional-ternary-operators.md | 2 +- .../use-recursion-to-create-a-countdown.md | 2 +- ...-recursion-to-create-a-range-of-numbers.md | 2 +- .../use-the-conditional-ternary-operator.md | 2 +- .../use-the-parseint-function-with-a-radix.md | 2 +- .../use-the-parseint-function.md | 2 +- .../using-objects-for-lookups.md | 4 +- .../basic-javascript/word-blanks.md | 2 +- ...rite-reusable-javascript-with-functions.md | 2 +- ...the-wrong-order-when-calling-a-function.md | 2 +- ...osing-parenthesis-after-a-function-call.md | 2 +- ...-misspelled-variable-and-function-names.md | 8 +- ...mixed-usage-of-single-and-double-quotes.md | 4 +- ...h-off-by-one-errors-when-using-indexing.md | 8 +- ...-parentheses-brackets-braces-and-quotes.md | 2 +- ...t-operator-instead-of-equality-operator.md | 2 +- ...e-loops-with-a-valid-terminal-condition.md | 4 +- ...en-the-freecodecamp-and-browser-console.md | 6 +- ...onsole-to-check-the-value-of-a-variable.md | 2 +- ...-typeof-to-check-the-type-of-a-variable.md | 6 +- ...pare-scopes-of-the-var-and-let-keywords.md | 4 +- ...plete-a-promise-with-resolve-and-reject.md | 4 +- .../es6/create-a-javascript-promise.md | 2 +- .../es6/create-a-module-script.md | 6 +- ...-an-export-fallback-with-export-default.md | 2 +- .../create-strings-using-template-literals.md | 2 +- .../handle-a-fulfilled-promise-with-then.md | 6 +- .../handle-a-rejected-promise-with-catch.md | 6 +- .../es6/import-a-default-export.md | 2 +- .../mutate-an-array-declared-with-const.md | 6 +- .../es6/prevent-object-mutation.md | 6 +- .../es6/reuse-javascript-code-using-import.md | 4 +- ...t-default-parameters-for-your-functions.md | 2 +- .../use--to-import-everything-from-a-file.md | 2 +- ...syntax-to-define-a-constructor-function.md | 2 +- ...ignment-to-assign-variables-from-arrays.md | 2 +- ...to-assign-variables-from-nested-objects.md | 8 +- ...gnment-to-assign-variables-from-objects.md | 8 +- ...signment-to-extract-values-from-objects.md | 6 +- ...ass-an-object-as-a-functions-parameters.md | 4 +- ...st-parameter-to-reassign-array-elements.md | 2 +- .../es6/use-export-to-share-a-code-block.md | 4 +- ...rest-parameter-with-function-parameters.md | 2 +- ...ad-operator-to-evaluate-arrays-in-place.md | 2 +- .../write-arrow-functions-with-parameters.md | 2 +- ...-concise-declarative-functions-with-es6.md | 4 +- ...rations-using-object-property-shorthand.md | 2 +- ...f-an-array-using-concat-instead-of-push.md | 4 +- ...ramming-to-convert-strings-to-url-slugs.md | 2 +- ...ray-into-a-string-using-the-join-method.md | 4 +- ...bine-two-arrays-using-the-concat-method.md | 2 +- .../implement-map-on-a-prototype.md | 2 +- ...lement-the-filter-method-on-a-prototype.md | 2 +- ...ion-to-currying-and-partial-application.md | 2 +- ...-an-array-using-slice-instead-of-splice.md | 4 +- ...part-of-an-array-using-the-slice-method.md | 2 +- ...ay-alphabetically-using-the-sort-method.md | 2 +- ...ng-into-an-array-using-the-split-method.md | 2 +- ...er-or-reduce-to-solve-a-complex-problem.md | 4 +- ...ry-element-in-an-array-meets-a-criteria.md | 2 +- ...er-method-to-extract-data-from-an-array.md | 4 +- ...ap-method-to-extract-data-from-an-array.md | 4 +- .../use-the-reduce-method-to-analyze-data.md | 4 +- ...ny-elements-in-an-array-meet-a-criteria.md | 2 +- .../steamroller.md | 2 +- .../change-the-prototype-to-a-new-object.md | 2 +- .../inherit-behaviors-from-a-supertype.md | 4 +- .../iterate-over-all-properties.md | 2 +- ...ode-more-reusable-with-the-this-keyword.md | 2 +- .../understand-own-properties.md | 4 +- .../understand-the-constructor-property.md | 2 +- ...iately-invoked-function-expression-iife.md | 4 +- .../understand-the-prototype-chain.md | 2 +- ...d-where-an-objects-prototype-comes-from.md | 2 +- .../use-a-constructor-to-create-objects.md | 2 +- ...n-object-from-being-modified-externally.md | 4 +- ...n-to-access-the-properties-of-an-object.md | 4 +- ...-an-objects-constructor-with-instanceof.md | 2 +- .../check-for-mixed-grouping-of-characters.md | 2 +- .../regular-expressions/extract-matches.md | 2 +- .../match-anything-with-wildcard-period.md | 2 +- .../match-literal-strings.md | 2 +- .../remove-whitespace-from-start-and-end.md | 4 +- ...se-capture-groups-to-search-and-replace.md | 4 +- .../using-the-test-method.md | 2 +- .../65687da2e60409c45595bbe1.md | 9 +- .../probability-calculator.md | 63 ++++++-- .../learn-how-a-stack-works.md | 4 +- .../5f356ed60a5decd94ab66986.md | 1 - .../60a3e3396c7b40068ad6998c.md | 4 +- .../645763874fd6d901c273db29.md | 2 +- .../641130423e5f512d8972dae1.md | 6 +- .../64113124efd2852edafaf25f.md | 2 +- .../6449842c6f6c84261075e4c9.md | 2 + .../660f374d532dc41189cc9cc2.md | 8 +- .../660f3ce51f70571e1c5227c8.md | 1 - .../660f3dd626be3a1ffe27e5d1.md | 1 - .../660f4f79e2a82a4e92290f44.md | 1 - .../660f53ad3d39175c5d4335ac.md | 1 - .../662693f82c91a66be46c881b.md | 74 +++++++++ .../6626a060c4006f793e10cb33.md | 104 +++++++++++++ .../6626b4c58c027d86478ff5eb.md | 88 +++++++++++ .../6626b8dcf5057f896f948440.md | 143 ++++++++++++++++++ .../660f3ce51f70571e1c5227c8.md | 1 - .../660f3dd626be3a1ffe27e5d1.md | 1 - .../660f4f79e2a82a4e92290f44.md | 1 - .../660f53ad3d39175c5d4335ac.md | 1 - .../confirm-the-ending.md | 2 +- .../repeat-a-string-repeat-a-string.md | 2 +- .../add-items-using-splice.md | 6 +- ...d-key-value-pairs-to-javascript-objects.md | 4 +- .../check-if-an-object-has-a-property.md | 2 +- .../copy-an-array-with-the-spread-operator.md | 2 +- .../copy-array-items-using-slice.md | 2 +- ...-of-an-object-with-a-for...in-statement.md | 2 +- ...odify-an-object-nested-within-an-object.md | 2 +- .../remove-items-using-splice.md | 6 +- ...ete-keyword-to-remove-object-properties.md | 6 +- .../access-array-data-with-indexes.md | 2 +- ...s-multi-dimensional-arrays-with-indexes.md | 2 +- .../accessing-nested-arrays.md | 2 +- ...object-properties-with-bracket-notation.md | 2 +- ...ing-object-properties-with-dot-notation.md | 2 +- ...essing-object-properties-with-variables.md | 6 +- ...d-new-properties-to-a-javascript-object.md | 2 +- .../add-two-numbers-with-javascript.md | 2 +- ...g-a-default-option-in-switch-statements.md | 4 +- .../appending-variables-to-strings.md | 2 +- ...ng-the-value-of-one-variable-to-another.md | 4 +- .../assignment-with-a-returned-value.md | 2 +- .../chaining-if-else-statements.md | 6 +- .../comment-your-javascript-code.md | 1 - .../comparison-with-the-equality-operator.md | 2 +- ...mparison-with-the-greater-than-operator.md | 2 +- ...h-the-greater-than-or-equal-to-operator.md | 2 +- ...comparison-with-the-inequality-operator.md | 2 +- .../comparison-with-the-less-than-operator.md | 2 +- ...with-the-less-than-or-equal-to-operator.md | 2 +- ...rison-with-the-strict-equality-operator.md | 2 +- ...son-with-the-strict-inequality-operator.md | 2 +- ...mparisons-with-the-logical-and-operator.md | 4 +- ...omparisons-with-the-logical-or-operator.md | 4 +- ...ound-assignment-with-augmented-addition.md | 8 +- ...ound-assignment-with-augmented-division.md | 8 +- ...ssignment-with-augmented-multiplication.md | 8 +- ...d-assignment-with-augmented-subtraction.md | 4 +- ...oncatenating-strings-with-plus-operator.md | 6 +- ...g-strings-with-the-plus-equals-operator.md | 2 +- .../constructing-strings-with-variables.md | 2 +- .../count-backwards-with-a-for-loop.md | 4 +- .../declare-javascript-variables.md | 2 +- .../decrement-a-number-with-javascript.md | 8 +- ...ete-properties-from-a-javascript-object.md | 2 +- ...-one-decimal-by-another-with-javascript.md | 4 +- ...e-one-number-by-another-with-javascript.md | 2 +- .../escaping-literal-quotes-in-strings.md | 2 +- .../find-the-length-of-a-string.md | 6 +- .../finding-a-remainder-in-javascript.md | 4 +- ...nerate-random-fractions-with-javascript.md | 2 +- ...te-random-whole-numbers-with-javascript.md | 8 +- ...ate-random-whole-numbers-within-a-range.md | 8 +- .../global-scope-and-functions.md | 2 +- .../global-vs.-local-scope-in-functions.md | 2 +- .../increment-a-number-with-javascript.md | 6 +- ...-variables-with-the-assignment-operator.md | 2 +- .../introducing-else-if-statements.md | 6 +- .../introducing-else-statements.md | 6 +- .../iterate-odd-numbers-with-a-for-loop.md | 2 +- ...terate-through-an-array-with-a-for-loop.md | 6 +- ...terate-with-javascript-do...while-loops.md | 2 +- .../iterate-with-javascript-for-loops.md | 2 +- .../iterate-with-javascript-while-loops.md | 2 +- .../local-scope-and-functions.md | 2 +- .../manipulate-arrays-with-pop.md | 2 +- .../modify-array-data-with-indexes.md | 2 +- ...-identical-options-in-switch-statements.md | 4 +- .../multiply-two-decimals-with-javascript.md | 2 +- .../multiply-two-numbers-with-javascript.md | 2 +- ...sing-values-to-functions-with-arguments.md | 2 +- .../practice-comparing-different-values.md | 2 +- .../quoting-strings-with-single-quotes.md | 4 +- .../replace-loops-using-recursion.md | 2 +- .../replacing-if-else-chains-with-switch.md | 6 +- ...returning-boolean-values-from-functions.md | 2 +- ...rom-many-options-with-switch-statements.md | 4 +- ...ing-values-with-the-assignment-operator.md | 2 +- ...one-number-from-another-with-javascript.md | 2 +- .../understand-string-immutability.md | 2 +- ...rstanding-case-sensitivity-in-variables.md | 6 +- .../understanding-uninitialized-variables.md | 6 +- .../updating-object-properties.md | 2 +- ...to-find-the-first-character-in-a-string.md | 2 +- ...-to-find-the-last-character-in-a-string.md | 2 +- ...n-to-find-the-nth-character-in-a-string.md | 2 +- ...d-the-nth-to-last-character-in-a-string.md | 2 +- ...-multiple-conditional-ternary-operators.md | 2 +- .../use-recursion-to-create-a-countdown.md | 2 +- ...-recursion-to-create-a-range-of-numbers.md | 2 +- .../use-the-conditional-ternary-operator.md | 2 +- .../use-the-parseint-function-with-a-radix.md | 2 +- .../use-the-parseint-function.md | 2 +- .../using-objects-for-lookups.md | 4 +- .../basic-javascript/word-blanks.md | 2 +- ...rite-reusable-javascript-with-functions.md | 2 +- ...the-wrong-order-when-calling-a-function.md | 2 +- ...osing-parenthesis-after-a-function-call.md | 2 +- ...-misspelled-variable-and-function-names.md | 8 +- ...mixed-usage-of-single-and-double-quotes.md | 4 +- ...h-off-by-one-errors-when-using-indexing.md | 8 +- ...-parentheses-brackets-braces-and-quotes.md | 2 +- ...t-operator-instead-of-equality-operator.md | 2 +- ...e-loops-with-a-valid-terminal-condition.md | 4 +- ...en-the-freecodecamp-and-browser-console.md | 6 +- ...onsole-to-check-the-value-of-a-variable.md | 2 +- ...-typeof-to-check-the-type-of-a-variable.md | 6 +- ...pare-scopes-of-the-var-and-let-keywords.md | 4 +- ...plete-a-promise-with-resolve-and-reject.md | 4 +- .../es6/create-a-javascript-promise.md | 2 +- .../es6/create-a-module-script.md | 6 +- ...-an-export-fallback-with-export-default.md | 2 +- .../create-strings-using-template-literals.md | 2 +- .../handle-a-fulfilled-promise-with-then.md | 6 +- .../handle-a-rejected-promise-with-catch.md | 6 +- .../es6/import-a-default-export.md | 2 +- .../mutate-an-array-declared-with-const.md | 6 +- .../es6/prevent-object-mutation.md | 6 +- .../es6/reuse-javascript-code-using-import.md | 4 +- ...t-default-parameters-for-your-functions.md | 2 +- .../use--to-import-everything-from-a-file.md | 2 +- ...syntax-to-define-a-constructor-function.md | 2 +- ...ignment-to-assign-variables-from-arrays.md | 2 +- ...to-assign-variables-from-nested-objects.md | 8 +- ...gnment-to-assign-variables-from-objects.md | 8 +- ...signment-to-extract-values-from-objects.md | 6 +- ...ass-an-object-as-a-functions-parameters.md | 4 +- ...st-parameter-to-reassign-array-elements.md | 2 +- .../es6/use-export-to-share-a-code-block.md | 4 +- ...rest-parameter-with-function-parameters.md | 2 +- ...ad-operator-to-evaluate-arrays-in-place.md | 2 +- .../write-arrow-functions-with-parameters.md | 2 +- ...-concise-declarative-functions-with-es6.md | 4 +- ...rations-using-object-property-shorthand.md | 2 +- ...f-an-array-using-concat-instead-of-push.md | 4 +- ...ramming-to-convert-strings-to-url-slugs.md | 2 +- ...ray-into-a-string-using-the-join-method.md | 4 +- ...bine-two-arrays-using-the-concat-method.md | 2 +- .../implement-map-on-a-prototype.md | 2 +- ...lement-the-filter-method-on-a-prototype.md | 2 +- ...ion-to-currying-and-partial-application.md | 2 +- ...-an-array-using-slice-instead-of-splice.md | 4 +- ...part-of-an-array-using-the-slice-method.md | 2 +- ...ay-alphabetically-using-the-sort-method.md | 2 +- ...ng-into-an-array-using-the-split-method.md | 2 +- ...er-or-reduce-to-solve-a-complex-problem.md | 4 +- ...ry-element-in-an-array-meets-a-criteria.md | 2 +- ...er-method-to-extract-data-from-an-array.md | 4 +- ...ap-method-to-extract-data-from-an-array.md | 4 +- .../use-the-reduce-method-to-analyze-data.md | 4 +- ...ny-elements-in-an-array-meet-a-criteria.md | 2 +- .../steamroller.md | 2 +- .../change-the-prototype-to-a-new-object.md | 2 +- .../inherit-behaviors-from-a-supertype.md | 4 +- .../iterate-over-all-properties.md | 2 +- ...ode-more-reusable-with-the-this-keyword.md | 2 +- .../understand-own-properties.md | 4 +- .../understand-the-constructor-property.md | 2 +- ...iately-invoked-function-expression-iife.md | 4 +- .../understand-the-prototype-chain.md | 2 +- ...d-where-an-objects-prototype-comes-from.md | 2 +- .../use-a-constructor-to-create-objects.md | 2 +- ...n-object-from-being-modified-externally.md | 4 +- ...n-to-access-the-properties-of-an-object.md | 4 +- ...-an-objects-constructor-with-instanceof.md | 2 +- .../check-for-mixed-grouping-of-characters.md | 2 +- .../regular-expressions/extract-matches.md | 2 +- .../match-anything-with-wildcard-period.md | 2 +- .../match-literal-strings.md | 2 +- .../remove-whitespace-from-start-and-end.md | 4 +- ...se-capture-groups-to-search-and-replace.md | 4 +- .../using-the-test-method.md | 2 +- .../65687da2e60409c45595bbe1.md | 9 +- .../probability-calculator.md | 63 ++++++-- .../learn-how-a-stack-works.md | 4 +- .../5f356ed60a5decd94ab66986.md | 1 - .../60a3e3396c7b40068ad6998c.md | 4 +- .../645763874fd6d901c273db29.md | 2 +- .../641130423e5f512d8972dae1.md | 6 +- .../64113124efd2852edafaf25f.md | 2 +- .../6449842c6f6c84261075e4c9.md | 2 + .../660f374d532dc41189cc9cc2.md | 8 +- .../660f3ce51f70571e1c5227c8.md | 1 - .../660f3dd626be3a1ffe27e5d1.md | 1 - .../660f4f79e2a82a4e92290f44.md | 1 - .../660f53ad3d39175c5d4335ac.md | 1 - .../662693f82c91a66be46c881b.md | 74 +++++++++ .../6626a060c4006f793e10cb33.md | 104 +++++++++++++ .../6626b4c58c027d86478ff5eb.md | 88 +++++++++++ .../6626b8dcf5057f896f948440.md | 143 ++++++++++++++++++ .../confirm-the-ending.md | 2 +- .../repeat-a-string-repeat-a-string.md | 2 +- .../add-items-using-splice.md | 6 +- ...d-key-value-pairs-to-javascript-objects.md | 4 +- .../check-if-an-object-has-a-property.md | 2 +- .../copy-an-array-with-the-spread-operator.md | 2 +- .../copy-array-items-using-slice.md | 2 +- ...-of-an-object-with-a-for...in-statement.md | 2 +- ...odify-an-object-nested-within-an-object.md | 2 +- .../remove-items-using-splice.md | 6 +- ...ete-keyword-to-remove-object-properties.md | 6 +- .../access-array-data-with-indexes.md | 2 +- ...s-multi-dimensional-arrays-with-indexes.md | 2 +- .../accessing-nested-arrays.md | 2 +- ...object-properties-with-bracket-notation.md | 2 +- ...ing-object-properties-with-dot-notation.md | 2 +- ...essing-object-properties-with-variables.md | 6 +- ...d-new-properties-to-a-javascript-object.md | 2 +- .../add-two-numbers-with-javascript.md | 2 +- ...g-a-default-option-in-switch-statements.md | 4 +- .../appending-variables-to-strings.md | 2 +- ...ng-the-value-of-one-variable-to-another.md | 4 +- .../assignment-with-a-returned-value.md | 2 +- .../chaining-if-else-statements.md | 6 +- .../comment-your-javascript-code.md | 1 - .../comparison-with-the-equality-operator.md | 2 +- ...mparison-with-the-greater-than-operator.md | 2 +- ...h-the-greater-than-or-equal-to-operator.md | 2 +- ...comparison-with-the-inequality-operator.md | 2 +- .../comparison-with-the-less-than-operator.md | 2 +- ...with-the-less-than-or-equal-to-operator.md | 2 +- ...rison-with-the-strict-equality-operator.md | 2 +- ...son-with-the-strict-inequality-operator.md | 2 +- ...mparisons-with-the-logical-and-operator.md | 4 +- ...omparisons-with-the-logical-or-operator.md | 4 +- ...ound-assignment-with-augmented-addition.md | 8 +- ...ound-assignment-with-augmented-division.md | 8 +- ...ssignment-with-augmented-multiplication.md | 8 +- ...d-assignment-with-augmented-subtraction.md | 4 +- ...oncatenating-strings-with-plus-operator.md | 6 +- ...g-strings-with-the-plus-equals-operator.md | 2 +- .../constructing-strings-with-variables.md | 2 +- .../count-backwards-with-a-for-loop.md | 4 +- .../declare-javascript-variables.md | 2 +- .../decrement-a-number-with-javascript.md | 8 +- ...ete-properties-from-a-javascript-object.md | 2 +- ...-one-decimal-by-another-with-javascript.md | 4 +- ...e-one-number-by-another-with-javascript.md | 2 +- .../escaping-literal-quotes-in-strings.md | 2 +- .../find-the-length-of-a-string.md | 6 +- .../finding-a-remainder-in-javascript.md | 4 +- ...nerate-random-fractions-with-javascript.md | 2 +- ...te-random-whole-numbers-with-javascript.md | 8 +- ...ate-random-whole-numbers-within-a-range.md | 8 +- .../global-scope-and-functions.md | 2 +- .../global-vs.-local-scope-in-functions.md | 2 +- .../increment-a-number-with-javascript.md | 6 +- ...-variables-with-the-assignment-operator.md | 2 +- .../introducing-else-if-statements.md | 6 +- .../introducing-else-statements.md | 6 +- .../iterate-odd-numbers-with-a-for-loop.md | 2 +- ...terate-through-an-array-with-a-for-loop.md | 6 +- ...terate-with-javascript-do...while-loops.md | 2 +- .../iterate-with-javascript-for-loops.md | 2 +- .../iterate-with-javascript-while-loops.md | 2 +- .../local-scope-and-functions.md | 2 +- .../manipulate-arrays-with-pop.md | 2 +- .../modify-array-data-with-indexes.md | 2 +- ...-identical-options-in-switch-statements.md | 4 +- .../multiply-two-decimals-with-javascript.md | 2 +- .../multiply-two-numbers-with-javascript.md | 2 +- ...sing-values-to-functions-with-arguments.md | 2 +- .../practice-comparing-different-values.md | 2 +- .../quoting-strings-with-single-quotes.md | 4 +- .../replace-loops-using-recursion.md | 2 +- .../replacing-if-else-chains-with-switch.md | 6 +- ...returning-boolean-values-from-functions.md | 2 +- ...rom-many-options-with-switch-statements.md | 4 +- ...ing-values-with-the-assignment-operator.md | 2 +- ...one-number-from-another-with-javascript.md | 2 +- .../understand-string-immutability.md | 2 +- ...rstanding-case-sensitivity-in-variables.md | 6 +- .../understanding-uninitialized-variables.md | 6 +- .../updating-object-properties.md | 2 +- ...to-find-the-first-character-in-a-string.md | 2 +- ...-to-find-the-last-character-in-a-string.md | 2 +- ...n-to-find-the-nth-character-in-a-string.md | 2 +- ...d-the-nth-to-last-character-in-a-string.md | 2 +- ...-multiple-conditional-ternary-operators.md | 2 +- .../use-recursion-to-create-a-countdown.md | 2 +- ...-recursion-to-create-a-range-of-numbers.md | 2 +- .../use-the-conditional-ternary-operator.md | 2 +- .../use-the-parseint-function-with-a-radix.md | 2 +- .../use-the-parseint-function.md | 2 +- .../using-objects-for-lookups.md | 4 +- .../basic-javascript/word-blanks.md | 2 +- ...rite-reusable-javascript-with-functions.md | 2 +- ...the-wrong-order-when-calling-a-function.md | 2 +- ...osing-parenthesis-after-a-function-call.md | 2 +- ...-misspelled-variable-and-function-names.md | 8 +- ...mixed-usage-of-single-and-double-quotes.md | 4 +- ...h-off-by-one-errors-when-using-indexing.md | 8 +- ...-parentheses-brackets-braces-and-quotes.md | 2 +- ...t-operator-instead-of-equality-operator.md | 2 +- ...e-loops-with-a-valid-terminal-condition.md | 4 +- ...en-the-freecodecamp-and-browser-console.md | 6 +- ...onsole-to-check-the-value-of-a-variable.md | 2 +- ...-typeof-to-check-the-type-of-a-variable.md | 6 +- ...pare-scopes-of-the-var-and-let-keywords.md | 4 +- ...plete-a-promise-with-resolve-and-reject.md | 4 +- .../es6/create-a-javascript-promise.md | 2 +- .../es6/create-a-module-script.md | 6 +- ...-an-export-fallback-with-export-default.md | 2 +- .../create-strings-using-template-literals.md | 2 +- .../handle-a-fulfilled-promise-with-then.md | 6 +- .../handle-a-rejected-promise-with-catch.md | 6 +- .../es6/import-a-default-export.md | 2 +- .../mutate-an-array-declared-with-const.md | 6 +- .../es6/prevent-object-mutation.md | 6 +- .../es6/reuse-javascript-code-using-import.md | 4 +- ...t-default-parameters-for-your-functions.md | 2 +- .../use--to-import-everything-from-a-file.md | 2 +- ...syntax-to-define-a-constructor-function.md | 2 +- ...ignment-to-assign-variables-from-arrays.md | 2 +- ...to-assign-variables-from-nested-objects.md | 8 +- ...gnment-to-assign-variables-from-objects.md | 8 +- ...signment-to-extract-values-from-objects.md | 6 +- ...ass-an-object-as-a-functions-parameters.md | 4 +- ...st-parameter-to-reassign-array-elements.md | 2 +- .../es6/use-export-to-share-a-code-block.md | 4 +- ...rest-parameter-with-function-parameters.md | 2 +- ...ad-operator-to-evaluate-arrays-in-place.md | 2 +- .../write-arrow-functions-with-parameters.md | 2 +- ...-concise-declarative-functions-with-es6.md | 4 +- ...rations-using-object-property-shorthand.md | 2 +- ...f-an-array-using-concat-instead-of-push.md | 4 +- ...ramming-to-convert-strings-to-url-slugs.md | 2 +- ...ray-into-a-string-using-the-join-method.md | 4 +- ...bine-two-arrays-using-the-concat-method.md | 2 +- .../implement-map-on-a-prototype.md | 2 +- ...lement-the-filter-method-on-a-prototype.md | 2 +- ...ion-to-currying-and-partial-application.md | 2 +- ...-an-array-using-slice-instead-of-splice.md | 4 +- ...part-of-an-array-using-the-slice-method.md | 2 +- ...ay-alphabetically-using-the-sort-method.md | 2 +- ...ng-into-an-array-using-the-split-method.md | 2 +- ...er-or-reduce-to-solve-a-complex-problem.md | 4 +- ...ry-element-in-an-array-meets-a-criteria.md | 2 +- ...er-method-to-extract-data-from-an-array.md | 4 +- ...ap-method-to-extract-data-from-an-array.md | 4 +- .../use-the-reduce-method-to-analyze-data.md | 4 +- ...ny-elements-in-an-array-meet-a-criteria.md | 2 +- .../steamroller.md | 2 +- .../change-the-prototype-to-a-new-object.md | 2 +- .../inherit-behaviors-from-a-supertype.md | 4 +- .../iterate-over-all-properties.md | 2 +- ...ode-more-reusable-with-the-this-keyword.md | 2 +- .../understand-own-properties.md | 4 +- .../understand-the-constructor-property.md | 2 +- ...iately-invoked-function-expression-iife.md | 4 +- .../understand-the-prototype-chain.md | 2 +- ...d-where-an-objects-prototype-comes-from.md | 2 +- .../use-a-constructor-to-create-objects.md | 2 +- ...n-object-from-being-modified-externally.md | 4 +- ...n-to-access-the-properties-of-an-object.md | 4 +- ...-an-objects-constructor-with-instanceof.md | 2 +- .../check-for-mixed-grouping-of-characters.md | 2 +- .../regular-expressions/extract-matches.md | 2 +- .../match-anything-with-wildcard-period.md | 2 +- .../match-literal-strings.md | 2 +- .../remove-whitespace-from-start-and-end.md | 4 +- ...se-capture-groups-to-search-and-replace.md | 4 +- .../using-the-test-method.md | 2 +- .../65687da2e60409c45595bbe1.md | 9 +- .../probability-calculator.md | 63 ++++++-- .../learn-how-a-stack-works.md | 4 +- .../5f356ed60a5decd94ab66986.md | 1 - .../60a3e3396c7b40068ad6998c.md | 4 +- .../645763874fd6d901c273db29.md | 2 +- .../641130423e5f512d8972dae1.md | 6 +- .../64113124efd2852edafaf25f.md | 2 +- .../6449842c6f6c84261075e4c9.md | 2 + .../660f374d532dc41189cc9cc2.md | 8 +- .../660f3ce51f70571e1c5227c8.md | 1 - .../660f3dd626be3a1ffe27e5d1.md | 1 - .../660f4f79e2a82a4e92290f44.md | 1 - .../660f53ad3d39175c5d4335ac.md | 1 - .../662693f82c91a66be46c881b.md | 74 +++++++++ .../6626a060c4006f793e10cb33.md | 104 +++++++++++++ .../6626b4c58c027d86478ff5eb.md | 88 +++++++++++ .../6626b8dcf5057f896f948440.md | 143 ++++++++++++++++++ .../confirm-the-ending.md | 2 +- .../repeat-a-string-repeat-a-string.md | 2 +- .../add-items-using-splice.md | 6 +- ...d-key-value-pairs-to-javascript-objects.md | 4 +- .../check-if-an-object-has-a-property.md | 2 +- .../copy-an-array-with-the-spread-operator.md | 2 +- .../copy-array-items-using-slice.md | 2 +- ...-of-an-object-with-a-for...in-statement.md | 2 +- ...odify-an-object-nested-within-an-object.md | 2 +- .../remove-items-using-splice.md | 6 +- ...ete-keyword-to-remove-object-properties.md | 6 +- .../access-array-data-with-indexes.md | 2 +- ...s-multi-dimensional-arrays-with-indexes.md | 2 +- .../accessing-nested-arrays.md | 2 +- ...object-properties-with-bracket-notation.md | 2 +- ...ing-object-properties-with-dot-notation.md | 2 +- ...essing-object-properties-with-variables.md | 6 +- ...d-new-properties-to-a-javascript-object.md | 2 +- .../add-two-numbers-with-javascript.md | 2 +- ...g-a-default-option-in-switch-statements.md | 4 +- .../appending-variables-to-strings.md | 2 +- ...ng-the-value-of-one-variable-to-another.md | 4 +- .../assignment-with-a-returned-value.md | 2 +- .../chaining-if-else-statements.md | 6 +- .../comment-your-javascript-code.md | 1 - .../comparison-with-the-equality-operator.md | 2 +- ...mparison-with-the-greater-than-operator.md | 2 +- ...h-the-greater-than-or-equal-to-operator.md | 2 +- ...comparison-with-the-inequality-operator.md | 2 +- .../comparison-with-the-less-than-operator.md | 2 +- ...with-the-less-than-or-equal-to-operator.md | 2 +- ...rison-with-the-strict-equality-operator.md | 2 +- ...son-with-the-strict-inequality-operator.md | 2 +- ...mparisons-with-the-logical-and-operator.md | 4 +- ...omparisons-with-the-logical-or-operator.md | 4 +- ...ound-assignment-with-augmented-addition.md | 8 +- ...ound-assignment-with-augmented-division.md | 8 +- ...ssignment-with-augmented-multiplication.md | 8 +- ...d-assignment-with-augmented-subtraction.md | 4 +- ...oncatenating-strings-with-plus-operator.md | 6 +- ...g-strings-with-the-plus-equals-operator.md | 2 +- .../constructing-strings-with-variables.md | 2 +- .../count-backwards-with-a-for-loop.md | 4 +- .../declare-javascript-variables.md | 2 +- .../decrement-a-number-with-javascript.md | 8 +- ...ete-properties-from-a-javascript-object.md | 2 +- ...-one-decimal-by-another-with-javascript.md | 4 +- ...e-one-number-by-another-with-javascript.md | 2 +- .../escaping-literal-quotes-in-strings.md | 2 +- .../find-the-length-of-a-string.md | 6 +- .../finding-a-remainder-in-javascript.md | 4 +- ...nerate-random-fractions-with-javascript.md | 2 +- ...te-random-whole-numbers-with-javascript.md | 8 +- ...ate-random-whole-numbers-within-a-range.md | 8 +- .../global-scope-and-functions.md | 2 +- .../global-vs.-local-scope-in-functions.md | 2 +- .../increment-a-number-with-javascript.md | 6 +- ...-variables-with-the-assignment-operator.md | 2 +- .../introducing-else-if-statements.md | 6 +- .../introducing-else-statements.md | 6 +- .../iterate-odd-numbers-with-a-for-loop.md | 2 +- ...terate-through-an-array-with-a-for-loop.md | 6 +- ...terate-with-javascript-do...while-loops.md | 2 +- .../iterate-with-javascript-for-loops.md | 2 +- .../iterate-with-javascript-while-loops.md | 2 +- .../local-scope-and-functions.md | 2 +- .../manipulate-arrays-with-pop.md | 2 +- .../modify-array-data-with-indexes.md | 2 +- ...-identical-options-in-switch-statements.md | 4 +- .../multiply-two-decimals-with-javascript.md | 2 +- .../multiply-two-numbers-with-javascript.md | 2 +- ...sing-values-to-functions-with-arguments.md | 2 +- .../practice-comparing-different-values.md | 2 +- .../quoting-strings-with-single-quotes.md | 4 +- .../replace-loops-using-recursion.md | 2 +- .../replacing-if-else-chains-with-switch.md | 6 +- ...returning-boolean-values-from-functions.md | 2 +- ...rom-many-options-with-switch-statements.md | 4 +- ...ing-values-with-the-assignment-operator.md | 2 +- ...one-number-from-another-with-javascript.md | 2 +- .../understand-string-immutability.md | 2 +- ...rstanding-case-sensitivity-in-variables.md | 6 +- .../understanding-uninitialized-variables.md | 6 +- .../updating-object-properties.md | 2 +- ...to-find-the-first-character-in-a-string.md | 2 +- ...-to-find-the-last-character-in-a-string.md | 2 +- ...n-to-find-the-nth-character-in-a-string.md | 2 +- ...d-the-nth-to-last-character-in-a-string.md | 2 +- ...-multiple-conditional-ternary-operators.md | 2 +- .../use-recursion-to-create-a-countdown.md | 2 +- ...-recursion-to-create-a-range-of-numbers.md | 2 +- .../use-the-conditional-ternary-operator.md | 2 +- .../use-the-parseint-function-with-a-radix.md | 2 +- .../use-the-parseint-function.md | 2 +- .../using-objects-for-lookups.md | 4 +- .../basic-javascript/word-blanks.md | 2 +- ...rite-reusable-javascript-with-functions.md | 2 +- ...the-wrong-order-when-calling-a-function.md | 2 +- ...osing-parenthesis-after-a-function-call.md | 2 +- ...-misspelled-variable-and-function-names.md | 8 +- ...mixed-usage-of-single-and-double-quotes.md | 4 +- ...h-off-by-one-errors-when-using-indexing.md | 8 +- ...-parentheses-brackets-braces-and-quotes.md | 2 +- ...t-operator-instead-of-equality-operator.md | 2 +- ...e-loops-with-a-valid-terminal-condition.md | 4 +- ...en-the-freecodecamp-and-browser-console.md | 6 +- ...onsole-to-check-the-value-of-a-variable.md | 2 +- ...-typeof-to-check-the-type-of-a-variable.md | 6 +- ...pare-scopes-of-the-var-and-let-keywords.md | 4 +- ...plete-a-promise-with-resolve-and-reject.md | 4 +- .../es6/create-a-javascript-promise.md | 2 +- .../es6/create-a-module-script.md | 6 +- ...-an-export-fallback-with-export-default.md | 2 +- .../create-strings-using-template-literals.md | 2 +- .../handle-a-fulfilled-promise-with-then.md | 6 +- .../handle-a-rejected-promise-with-catch.md | 6 +- .../es6/import-a-default-export.md | 2 +- .../mutate-an-array-declared-with-const.md | 6 +- .../es6/prevent-object-mutation.md | 6 +- .../es6/reuse-javascript-code-using-import.md | 4 +- ...t-default-parameters-for-your-functions.md | 2 +- .../use--to-import-everything-from-a-file.md | 2 +- ...syntax-to-define-a-constructor-function.md | 2 +- ...ignment-to-assign-variables-from-arrays.md | 2 +- ...to-assign-variables-from-nested-objects.md | 8 +- ...gnment-to-assign-variables-from-objects.md | 8 +- ...signment-to-extract-values-from-objects.md | 6 +- ...ass-an-object-as-a-functions-parameters.md | 4 +- ...st-parameter-to-reassign-array-elements.md | 2 +- .../es6/use-export-to-share-a-code-block.md | 4 +- ...rest-parameter-with-function-parameters.md | 2 +- ...ad-operator-to-evaluate-arrays-in-place.md | 2 +- .../write-arrow-functions-with-parameters.md | 2 +- ...-concise-declarative-functions-with-es6.md | 4 +- ...rations-using-object-property-shorthand.md | 2 +- ...f-an-array-using-concat-instead-of-push.md | 4 +- ...ramming-to-convert-strings-to-url-slugs.md | 2 +- ...ray-into-a-string-using-the-join-method.md | 4 +- ...bine-two-arrays-using-the-concat-method.md | 2 +- .../implement-map-on-a-prototype.md | 2 +- ...lement-the-filter-method-on-a-prototype.md | 2 +- ...ion-to-currying-and-partial-application.md | 2 +- ...-an-array-using-slice-instead-of-splice.md | 4 +- ...part-of-an-array-using-the-slice-method.md | 2 +- ...ay-alphabetically-using-the-sort-method.md | 2 +- ...ng-into-an-array-using-the-split-method.md | 2 +- ...er-or-reduce-to-solve-a-complex-problem.md | 4 +- ...ry-element-in-an-array-meets-a-criteria.md | 2 +- ...er-method-to-extract-data-from-an-array.md | 4 +- ...ap-method-to-extract-data-from-an-array.md | 4 +- .../use-the-reduce-method-to-analyze-data.md | 4 +- ...ny-elements-in-an-array-meet-a-criteria.md | 2 +- .../steamroller.md | 2 +- .../change-the-prototype-to-a-new-object.md | 2 +- .../inherit-behaviors-from-a-supertype.md | 4 +- .../iterate-over-all-properties.md | 2 +- ...ode-more-reusable-with-the-this-keyword.md | 2 +- .../understand-own-properties.md | 4 +- .../understand-the-constructor-property.md | 2 +- ...iately-invoked-function-expression-iife.md | 4 +- .../understand-the-prototype-chain.md | 2 +- ...d-where-an-objects-prototype-comes-from.md | 2 +- .../use-a-constructor-to-create-objects.md | 2 +- ...n-object-from-being-modified-externally.md | 4 +- ...n-to-access-the-properties-of-an-object.md | 4 +- ...-an-objects-constructor-with-instanceof.md | 2 +- .../check-for-mixed-grouping-of-characters.md | 2 +- .../regular-expressions/extract-matches.md | 2 +- .../match-anything-with-wildcard-period.md | 2 +- .../match-literal-strings.md | 2 +- .../remove-whitespace-from-start-and-end.md | 4 +- ...se-capture-groups-to-search-and-replace.md | 4 +- .../using-the-test-method.md | 2 +- .../65687da2e60409c45595bbe1.md | 9 +- .../probability-calculator.md | 63 ++++++-- .../learn-how-a-stack-works.md | 4 +- .../5f356ed60a5decd94ab66986.md | 1 - .../60a3e3396c7b40068ad6998c.md | 4 +- .../645763874fd6d901c273db29.md | 2 +- .../641130423e5f512d8972dae1.md | 6 +- .../64113124efd2852edafaf25f.md | 2 +- .../6449842c6f6c84261075e4c9.md | 2 + .../660f374d532dc41189cc9cc2.md | 8 +- .../660f3ce51f70571e1c5227c8.md | 1 - .../660f3dd626be3a1ffe27e5d1.md | 1 - .../660f4f79e2a82a4e92290f44.md | 1 - .../660f53ad3d39175c5d4335ac.md | 1 - .../662693f82c91a66be46c881b.md | 74 +++++++++ .../6626a060c4006f793e10cb33.md | 104 +++++++++++++ .../6626b4c58c027d86478ff5eb.md | 88 +++++++++++ .../6626b8dcf5057f896f948440.md | 143 ++++++++++++++++++ .../confirm-the-ending.md | 2 +- .../repeat-a-string-repeat-a-string.md | 2 +- .../add-items-using-splice.md | 6 +- ...d-key-value-pairs-to-javascript-objects.md | 4 +- .../check-if-an-object-has-a-property.md | 2 +- .../copy-an-array-with-the-spread-operator.md | 2 +- .../copy-array-items-using-slice.md | 2 +- ...-of-an-object-with-a-for...in-statement.md | 2 +- ...odify-an-object-nested-within-an-object.md | 2 +- .../remove-items-using-splice.md | 6 +- ...ete-keyword-to-remove-object-properties.md | 6 +- .../access-array-data-with-indexes.md | 2 +- ...s-multi-dimensional-arrays-with-indexes.md | 2 +- .../accessing-nested-arrays.md | 2 +- ...object-properties-with-bracket-notation.md | 2 +- ...ing-object-properties-with-dot-notation.md | 2 +- ...essing-object-properties-with-variables.md | 6 +- ...d-new-properties-to-a-javascript-object.md | 2 +- .../add-two-numbers-with-javascript.md | 2 +- ...g-a-default-option-in-switch-statements.md | 4 +- .../appending-variables-to-strings.md | 2 +- ...ng-the-value-of-one-variable-to-another.md | 4 +- .../assignment-with-a-returned-value.md | 2 +- .../chaining-if-else-statements.md | 6 +- .../comment-your-javascript-code.md | 1 - .../comparison-with-the-equality-operator.md | 2 +- ...mparison-with-the-greater-than-operator.md | 2 +- ...h-the-greater-than-or-equal-to-operator.md | 2 +- ...comparison-with-the-inequality-operator.md | 2 +- .../comparison-with-the-less-than-operator.md | 2 +- ...with-the-less-than-or-equal-to-operator.md | 2 +- ...rison-with-the-strict-equality-operator.md | 2 +- ...son-with-the-strict-inequality-operator.md | 2 +- ...mparisons-with-the-logical-and-operator.md | 4 +- ...omparisons-with-the-logical-or-operator.md | 4 +- ...ound-assignment-with-augmented-addition.md | 8 +- ...ound-assignment-with-augmented-division.md | 8 +- ...ssignment-with-augmented-multiplication.md | 8 +- ...d-assignment-with-augmented-subtraction.md | 4 +- ...oncatenating-strings-with-plus-operator.md | 6 +- ...g-strings-with-the-plus-equals-operator.md | 2 +- .../constructing-strings-with-variables.md | 2 +- .../count-backwards-with-a-for-loop.md | 4 +- .../declare-javascript-variables.md | 2 +- .../decrement-a-number-with-javascript.md | 8 +- ...ete-properties-from-a-javascript-object.md | 2 +- ...-one-decimal-by-another-with-javascript.md | 4 +- ...e-one-number-by-another-with-javascript.md | 2 +- .../escaping-literal-quotes-in-strings.md | 2 +- .../find-the-length-of-a-string.md | 6 +- .../finding-a-remainder-in-javascript.md | 4 +- ...nerate-random-fractions-with-javascript.md | 2 +- ...te-random-whole-numbers-with-javascript.md | 8 +- ...ate-random-whole-numbers-within-a-range.md | 8 +- .../global-scope-and-functions.md | 2 +- .../global-vs.-local-scope-in-functions.md | 2 +- .../increment-a-number-with-javascript.md | 6 +- ...-variables-with-the-assignment-operator.md | 2 +- .../introducing-else-if-statements.md | 6 +- .../introducing-else-statements.md | 6 +- .../iterate-odd-numbers-with-a-for-loop.md | 2 +- ...terate-through-an-array-with-a-for-loop.md | 6 +- ...terate-with-javascript-do...while-loops.md | 2 +- .../iterate-with-javascript-for-loops.md | 2 +- .../iterate-with-javascript-while-loops.md | 2 +- .../local-scope-and-functions.md | 2 +- .../manipulate-arrays-with-pop.md | 2 +- .../modify-array-data-with-indexes.md | 2 +- ...-identical-options-in-switch-statements.md | 4 +- .../multiply-two-decimals-with-javascript.md | 2 +- .../multiply-two-numbers-with-javascript.md | 2 +- ...sing-values-to-functions-with-arguments.md | 2 +- .../practice-comparing-different-values.md | 2 +- .../quoting-strings-with-single-quotes.md | 4 +- .../replace-loops-using-recursion.md | 2 +- .../replacing-if-else-chains-with-switch.md | 6 +- ...returning-boolean-values-from-functions.md | 2 +- ...rom-many-options-with-switch-statements.md | 4 +- ...ing-values-with-the-assignment-operator.md | 2 +- ...one-number-from-another-with-javascript.md | 2 +- .../understand-string-immutability.md | 2 +- ...rstanding-case-sensitivity-in-variables.md | 6 +- .../understanding-uninitialized-variables.md | 6 +- .../updating-object-properties.md | 2 +- ...to-find-the-first-character-in-a-string.md | 2 +- ...-to-find-the-last-character-in-a-string.md | 2 +- ...n-to-find-the-nth-character-in-a-string.md | 2 +- ...d-the-nth-to-last-character-in-a-string.md | 2 +- ...-multiple-conditional-ternary-operators.md | 2 +- .../use-recursion-to-create-a-countdown.md | 2 +- ...-recursion-to-create-a-range-of-numbers.md | 2 +- .../use-the-conditional-ternary-operator.md | 2 +- .../use-the-parseint-function-with-a-radix.md | 2 +- .../use-the-parseint-function.md | 2 +- .../using-objects-for-lookups.md | 4 +- .../basic-javascript/word-blanks.md | 2 +- ...rite-reusable-javascript-with-functions.md | 2 +- ...the-wrong-order-when-calling-a-function.md | 2 +- ...osing-parenthesis-after-a-function-call.md | 2 +- ...-misspelled-variable-and-function-names.md | 8 +- ...mixed-usage-of-single-and-double-quotes.md | 4 +- ...h-off-by-one-errors-when-using-indexing.md | 8 +- ...-parentheses-brackets-braces-and-quotes.md | 2 +- ...t-operator-instead-of-equality-operator.md | 2 +- ...e-loops-with-a-valid-terminal-condition.md | 4 +- ...en-the-freecodecamp-and-browser-console.md | 6 +- ...onsole-to-check-the-value-of-a-variable.md | 2 +- ...-typeof-to-check-the-type-of-a-variable.md | 6 +- ...pare-scopes-of-the-var-and-let-keywords.md | 4 +- ...plete-a-promise-with-resolve-and-reject.md | 4 +- .../es6/create-a-javascript-promise.md | 2 +- .../es6/create-a-module-script.md | 6 +- ...-an-export-fallback-with-export-default.md | 2 +- .../create-strings-using-template-literals.md | 2 +- .../handle-a-fulfilled-promise-with-then.md | 6 +- .../handle-a-rejected-promise-with-catch.md | 6 +- .../es6/import-a-default-export.md | 2 +- .../mutate-an-array-declared-with-const.md | 6 +- .../es6/prevent-object-mutation.md | 6 +- .../es6/reuse-javascript-code-using-import.md | 4 +- ...t-default-parameters-for-your-functions.md | 2 +- .../use--to-import-everything-from-a-file.md | 2 +- ...syntax-to-define-a-constructor-function.md | 2 +- ...ignment-to-assign-variables-from-arrays.md | 2 +- ...to-assign-variables-from-nested-objects.md | 8 +- ...gnment-to-assign-variables-from-objects.md | 8 +- ...signment-to-extract-values-from-objects.md | 6 +- ...ass-an-object-as-a-functions-parameters.md | 4 +- ...st-parameter-to-reassign-array-elements.md | 2 +- .../es6/use-export-to-share-a-code-block.md | 4 +- ...rest-parameter-with-function-parameters.md | 2 +- ...ad-operator-to-evaluate-arrays-in-place.md | 2 +- .../write-arrow-functions-with-parameters.md | 2 +- ...-concise-declarative-functions-with-es6.md | 4 +- ...rations-using-object-property-shorthand.md | 2 +- ...f-an-array-using-concat-instead-of-push.md | 4 +- ...ramming-to-convert-strings-to-url-slugs.md | 2 +- ...ray-into-a-string-using-the-join-method.md | 4 +- ...bine-two-arrays-using-the-concat-method.md | 2 +- .../implement-map-on-a-prototype.md | 2 +- ...lement-the-filter-method-on-a-prototype.md | 2 +- ...ion-to-currying-and-partial-application.md | 2 +- ...-an-array-using-slice-instead-of-splice.md | 4 +- ...part-of-an-array-using-the-slice-method.md | 2 +- ...ay-alphabetically-using-the-sort-method.md | 2 +- ...ng-into-an-array-using-the-split-method.md | 2 +- ...er-or-reduce-to-solve-a-complex-problem.md | 4 +- ...ry-element-in-an-array-meets-a-criteria.md | 2 +- ...er-method-to-extract-data-from-an-array.md | 4 +- ...ap-method-to-extract-data-from-an-array.md | 4 +- .../use-the-reduce-method-to-analyze-data.md | 4 +- ...ny-elements-in-an-array-meet-a-criteria.md | 2 +- .../steamroller.md | 2 +- .../change-the-prototype-to-a-new-object.md | 2 +- .../inherit-behaviors-from-a-supertype.md | 4 +- .../iterate-over-all-properties.md | 2 +- ...ode-more-reusable-with-the-this-keyword.md | 2 +- .../understand-own-properties.md | 4 +- .../understand-the-constructor-property.md | 2 +- ...iately-invoked-function-expression-iife.md | 4 +- .../understand-the-prototype-chain.md | 2 +- ...d-where-an-objects-prototype-comes-from.md | 2 +- .../use-a-constructor-to-create-objects.md | 2 +- ...n-object-from-being-modified-externally.md | 4 +- ...n-to-access-the-properties-of-an-object.md | 4 +- ...-an-objects-constructor-with-instanceof.md | 2 +- .../check-for-mixed-grouping-of-characters.md | 2 +- .../regular-expressions/extract-matches.md | 2 +- .../match-anything-with-wildcard-period.md | 2 +- .../match-literal-strings.md | 2 +- .../remove-whitespace-from-start-and-end.md | 4 +- ...se-capture-groups-to-search-and-replace.md | 4 +- .../using-the-test-method.md | 2 +- .../65687da2e60409c45595bbe1.md | 9 +- .../probability-calculator.md | 63 ++++++-- .../learn-how-a-stack-works.md | 4 +- .../5f356ed60a5decd94ab66986.md | 1 - .../60a3e3396c7b40068ad6998c.md | 4 +- .../645763874fd6d901c273db29.md | 2 +- .../641130423e5f512d8972dae1.md | 6 +- .../64113124efd2852edafaf25f.md | 2 +- .../6449842c6f6c84261075e4c9.md | 2 + .../660f374d532dc41189cc9cc2.md | 8 +- .../660f3ce51f70571e1c5227c8.md | 1 - .../660f3dd626be3a1ffe27e5d1.md | 1 - .../660f4f79e2a82a4e92290f44.md | 1 - .../660f53ad3d39175c5d4335ac.md | 1 - .../662693f82c91a66be46c881b.md | 74 +++++++++ .../6626a060c4006f793e10cb33.md | 104 +++++++++++++ .../6626b4c58c027d86478ff5eb.md | 88 +++++++++++ .../6626b8dcf5057f896f948440.md | 143 ++++++++++++++++++ .../confirm-the-ending.md | 2 +- .../repeat-a-string-repeat-a-string.md | 2 +- .../add-items-using-splice.md | 6 +- ...d-key-value-pairs-to-javascript-objects.md | 4 +- .../check-if-an-object-has-a-property.md | 2 +- .../copy-an-array-with-the-spread-operator.md | 2 +- .../copy-array-items-using-slice.md | 2 +- ...-of-an-object-with-a-for...in-statement.md | 2 +- ...odify-an-object-nested-within-an-object.md | 2 +- .../remove-items-using-splice.md | 6 +- ...ete-keyword-to-remove-object-properties.md | 6 +- .../access-array-data-with-indexes.md | 2 +- ...s-multi-dimensional-arrays-with-indexes.md | 2 +- .../accessing-nested-arrays.md | 2 +- ...object-properties-with-bracket-notation.md | 2 +- ...ing-object-properties-with-dot-notation.md | 2 +- ...essing-object-properties-with-variables.md | 6 +- ...d-new-properties-to-a-javascript-object.md | 2 +- .../add-two-numbers-with-javascript.md | 2 +- ...g-a-default-option-in-switch-statements.md | 4 +- .../appending-variables-to-strings.md | 2 +- ...ng-the-value-of-one-variable-to-another.md | 4 +- .../assignment-with-a-returned-value.md | 2 +- .../chaining-if-else-statements.md | 6 +- .../comment-your-javascript-code.md | 1 - .../comparison-with-the-equality-operator.md | 2 +- ...mparison-with-the-greater-than-operator.md | 2 +- ...h-the-greater-than-or-equal-to-operator.md | 2 +- ...comparison-with-the-inequality-operator.md | 2 +- .../comparison-with-the-less-than-operator.md | 2 +- ...with-the-less-than-or-equal-to-operator.md | 2 +- ...rison-with-the-strict-equality-operator.md | 2 +- ...son-with-the-strict-inequality-operator.md | 2 +- ...mparisons-with-the-logical-and-operator.md | 4 +- ...omparisons-with-the-logical-or-operator.md | 4 +- ...ound-assignment-with-augmented-addition.md | 8 +- ...ound-assignment-with-augmented-division.md | 8 +- ...ssignment-with-augmented-multiplication.md | 8 +- ...d-assignment-with-augmented-subtraction.md | 4 +- ...oncatenating-strings-with-plus-operator.md | 6 +- ...g-strings-with-the-plus-equals-operator.md | 2 +- .../constructing-strings-with-variables.md | 2 +- .../count-backwards-with-a-for-loop.md | 4 +- .../declare-javascript-variables.md | 2 +- .../decrement-a-number-with-javascript.md | 8 +- ...ete-properties-from-a-javascript-object.md | 2 +- ...-one-decimal-by-another-with-javascript.md | 4 +- ...e-one-number-by-another-with-javascript.md | 2 +- .../escaping-literal-quotes-in-strings.md | 2 +- .../find-the-length-of-a-string.md | 6 +- .../finding-a-remainder-in-javascript.md | 4 +- ...nerate-random-fractions-with-javascript.md | 2 +- ...te-random-whole-numbers-with-javascript.md | 8 +- ...ate-random-whole-numbers-within-a-range.md | 8 +- .../global-scope-and-functions.md | 2 +- .../global-vs.-local-scope-in-functions.md | 2 +- .../increment-a-number-with-javascript.md | 6 +- ...-variables-with-the-assignment-operator.md | 2 +- .../introducing-else-if-statements.md | 6 +- .../introducing-else-statements.md | 6 +- .../iterate-odd-numbers-with-a-for-loop.md | 2 +- ...terate-through-an-array-with-a-for-loop.md | 6 +- ...terate-with-javascript-do...while-loops.md | 2 +- .../iterate-with-javascript-for-loops.md | 2 +- .../iterate-with-javascript-while-loops.md | 2 +- .../local-scope-and-functions.md | 2 +- .../manipulate-arrays-with-pop.md | 2 +- .../modify-array-data-with-indexes.md | 2 +- ...-identical-options-in-switch-statements.md | 4 +- .../multiply-two-decimals-with-javascript.md | 2 +- .../multiply-two-numbers-with-javascript.md | 2 +- ...sing-values-to-functions-with-arguments.md | 2 +- .../practice-comparing-different-values.md | 2 +- .../quoting-strings-with-single-quotes.md | 4 +- .../replace-loops-using-recursion.md | 2 +- .../replacing-if-else-chains-with-switch.md | 6 +- ...returning-boolean-values-from-functions.md | 2 +- ...rom-many-options-with-switch-statements.md | 4 +- ...ing-values-with-the-assignment-operator.md | 2 +- ...one-number-from-another-with-javascript.md | 2 +- .../understand-string-immutability.md | 2 +- ...rstanding-case-sensitivity-in-variables.md | 6 +- .../understanding-uninitialized-variables.md | 6 +- .../updating-object-properties.md | 2 +- ...to-find-the-first-character-in-a-string.md | 2 +- ...-to-find-the-last-character-in-a-string.md | 2 +- ...n-to-find-the-nth-character-in-a-string.md | 2 +- ...d-the-nth-to-last-character-in-a-string.md | 2 +- ...-multiple-conditional-ternary-operators.md | 2 +- .../use-recursion-to-create-a-countdown.md | 2 +- ...-recursion-to-create-a-range-of-numbers.md | 2 +- .../use-the-conditional-ternary-operator.md | 2 +- .../use-the-parseint-function-with-a-radix.md | 2 +- .../use-the-parseint-function.md | 2 +- .../using-objects-for-lookups.md | 4 +- .../basic-javascript/word-blanks.md | 2 +- ...rite-reusable-javascript-with-functions.md | 2 +- ...the-wrong-order-when-calling-a-function.md | 2 +- ...osing-parenthesis-after-a-function-call.md | 2 +- ...-misspelled-variable-and-function-names.md | 8 +- ...mixed-usage-of-single-and-double-quotes.md | 4 +- ...h-off-by-one-errors-when-using-indexing.md | 8 +- ...-parentheses-brackets-braces-and-quotes.md | 2 +- ...t-operator-instead-of-equality-operator.md | 2 +- ...e-loops-with-a-valid-terminal-condition.md | 4 +- ...en-the-freecodecamp-and-browser-console.md | 6 +- ...onsole-to-check-the-value-of-a-variable.md | 2 +- ...-typeof-to-check-the-type-of-a-variable.md | 6 +- ...pare-scopes-of-the-var-and-let-keywords.md | 4 +- ...plete-a-promise-with-resolve-and-reject.md | 4 +- .../es6/create-a-javascript-promise.md | 2 +- .../es6/create-a-module-script.md | 6 +- ...-an-export-fallback-with-export-default.md | 2 +- .../create-strings-using-template-literals.md | 2 +- .../handle-a-fulfilled-promise-with-then.md | 6 +- .../handle-a-rejected-promise-with-catch.md | 6 +- .../es6/import-a-default-export.md | 2 +- .../mutate-an-array-declared-with-const.md | 6 +- .../es6/prevent-object-mutation.md | 6 +- .../es6/reuse-javascript-code-using-import.md | 4 +- ...t-default-parameters-for-your-functions.md | 2 +- .../use--to-import-everything-from-a-file.md | 2 +- ...syntax-to-define-a-constructor-function.md | 2 +- ...ignment-to-assign-variables-from-arrays.md | 2 +- ...to-assign-variables-from-nested-objects.md | 8 +- ...gnment-to-assign-variables-from-objects.md | 8 +- ...signment-to-extract-values-from-objects.md | 6 +- ...ass-an-object-as-a-functions-parameters.md | 4 +- ...st-parameter-to-reassign-array-elements.md | 2 +- .../es6/use-export-to-share-a-code-block.md | 4 +- ...rest-parameter-with-function-parameters.md | 2 +- ...ad-operator-to-evaluate-arrays-in-place.md | 2 +- .../write-arrow-functions-with-parameters.md | 2 +- ...-concise-declarative-functions-with-es6.md | 4 +- ...rations-using-object-property-shorthand.md | 2 +- ...f-an-array-using-concat-instead-of-push.md | 4 +- ...ramming-to-convert-strings-to-url-slugs.md | 2 +- ...ray-into-a-string-using-the-join-method.md | 4 +- ...bine-two-arrays-using-the-concat-method.md | 2 +- .../implement-map-on-a-prototype.md | 2 +- ...lement-the-filter-method-on-a-prototype.md | 2 +- ...ion-to-currying-and-partial-application.md | 2 +- ...-an-array-using-slice-instead-of-splice.md | 4 +- ...part-of-an-array-using-the-slice-method.md | 2 +- ...ay-alphabetically-using-the-sort-method.md | 2 +- ...ng-into-an-array-using-the-split-method.md | 2 +- ...er-or-reduce-to-solve-a-complex-problem.md | 4 +- ...ry-element-in-an-array-meets-a-criteria.md | 2 +- ...er-method-to-extract-data-from-an-array.md | 4 +- ...ap-method-to-extract-data-from-an-array.md | 4 +- .../use-the-reduce-method-to-analyze-data.md | 4 +- ...ny-elements-in-an-array-meet-a-criteria.md | 2 +- .../steamroller.md | 2 +- .../change-the-prototype-to-a-new-object.md | 2 +- .../inherit-behaviors-from-a-supertype.md | 4 +- .../iterate-over-all-properties.md | 2 +- ...ode-more-reusable-with-the-this-keyword.md | 2 +- .../understand-own-properties.md | 4 +- .../understand-the-constructor-property.md | 2 +- ...iately-invoked-function-expression-iife.md | 4 +- .../understand-the-prototype-chain.md | 2 +- ...d-where-an-objects-prototype-comes-from.md | 2 +- .../use-a-constructor-to-create-objects.md | 2 +- ...n-object-from-being-modified-externally.md | 4 +- ...n-to-access-the-properties-of-an-object.md | 4 +- ...-an-objects-constructor-with-instanceof.md | 2 +- .../check-for-mixed-grouping-of-characters.md | 2 +- .../regular-expressions/extract-matches.md | 2 +- .../match-anything-with-wildcard-period.md | 2 +- .../match-literal-strings.md | 2 +- .../remove-whitespace-from-start-and-end.md | 4 +- ...se-capture-groups-to-search-and-replace.md | 4 +- .../using-the-test-method.md | 2 +- .../65687da2e60409c45595bbe1.md | 9 +- .../probability-calculator.md | 63 ++++++-- .../learn-how-a-stack-works.md | 4 +- .../5f356ed60a5decd94ab66986.md | 1 - .../60a3e3396c7b40068ad6998c.md | 4 +- .../645763874fd6d901c273db29.md | 2 +- .../641130423e5f512d8972dae1.md | 6 +- .../64113124efd2852edafaf25f.md | 2 +- .../6449842c6f6c84261075e4c9.md | 2 + .../660f374d532dc41189cc9cc2.md | 8 +- .../660f3ce51f70571e1c5227c8.md | 1 - .../660f3dd626be3a1ffe27e5d1.md | 1 - .../660f4f79e2a82a4e92290f44.md | 1 - .../660f53ad3d39175c5d4335ac.md | 1 - .../662693f82c91a66be46c881b.md | 74 +++++++++ .../6626a060c4006f793e10cb33.md | 104 +++++++++++++ .../6626b4c58c027d86478ff5eb.md | 88 +++++++++++ .../6626b8dcf5057f896f948440.md | 143 ++++++++++++++++++ .../confirm-the-ending.md | 2 +- .../repeat-a-string-repeat-a-string.md | 2 +- .../add-items-using-splice.md | 6 +- ...d-key-value-pairs-to-javascript-objects.md | 4 +- .../check-if-an-object-has-a-property.md | 2 +- .../copy-an-array-with-the-spread-operator.md | 2 +- .../copy-array-items-using-slice.md | 2 +- ...-of-an-object-with-a-for...in-statement.md | 2 +- ...odify-an-object-nested-within-an-object.md | 2 +- .../remove-items-using-splice.md | 6 +- ...ete-keyword-to-remove-object-properties.md | 6 +- .../access-array-data-with-indexes.md | 2 +- ...s-multi-dimensional-arrays-with-indexes.md | 2 +- .../accessing-nested-arrays.md | 2 +- ...object-properties-with-bracket-notation.md | 2 +- ...ing-object-properties-with-dot-notation.md | 2 +- ...essing-object-properties-with-variables.md | 6 +- ...d-new-properties-to-a-javascript-object.md | 2 +- .../add-two-numbers-with-javascript.md | 2 +- ...g-a-default-option-in-switch-statements.md | 4 +- .../appending-variables-to-strings.md | 2 +- ...ng-the-value-of-one-variable-to-another.md | 4 +- .../assignment-with-a-returned-value.md | 2 +- .../chaining-if-else-statements.md | 6 +- .../comment-your-javascript-code.md | 1 - .../comparison-with-the-equality-operator.md | 2 +- ...mparison-with-the-greater-than-operator.md | 2 +- ...h-the-greater-than-or-equal-to-operator.md | 2 +- ...comparison-with-the-inequality-operator.md | 2 +- .../comparison-with-the-less-than-operator.md | 2 +- ...with-the-less-than-or-equal-to-operator.md | 2 +- ...rison-with-the-strict-equality-operator.md | 2 +- ...son-with-the-strict-inequality-operator.md | 2 +- ...mparisons-with-the-logical-and-operator.md | 4 +- ...omparisons-with-the-logical-or-operator.md | 4 +- ...ound-assignment-with-augmented-addition.md | 8 +- ...ound-assignment-with-augmented-division.md | 8 +- ...ssignment-with-augmented-multiplication.md | 8 +- ...d-assignment-with-augmented-subtraction.md | 4 +- ...oncatenating-strings-with-plus-operator.md | 6 +- ...g-strings-with-the-plus-equals-operator.md | 2 +- .../constructing-strings-with-variables.md | 2 +- .../count-backwards-with-a-for-loop.md | 4 +- .../declare-javascript-variables.md | 2 +- .../decrement-a-number-with-javascript.md | 8 +- ...ete-properties-from-a-javascript-object.md | 2 +- ...-one-decimal-by-another-with-javascript.md | 4 +- ...e-one-number-by-another-with-javascript.md | 2 +- .../escaping-literal-quotes-in-strings.md | 2 +- .../find-the-length-of-a-string.md | 6 +- .../finding-a-remainder-in-javascript.md | 4 +- ...nerate-random-fractions-with-javascript.md | 2 +- ...te-random-whole-numbers-with-javascript.md | 8 +- ...ate-random-whole-numbers-within-a-range.md | 8 +- .../global-scope-and-functions.md | 2 +- .../global-vs.-local-scope-in-functions.md | 2 +- .../increment-a-number-with-javascript.md | 6 +- ...-variables-with-the-assignment-operator.md | 2 +- .../introducing-else-if-statements.md | 6 +- .../introducing-else-statements.md | 6 +- .../iterate-odd-numbers-with-a-for-loop.md | 2 +- ...terate-through-an-array-with-a-for-loop.md | 6 +- ...terate-with-javascript-do...while-loops.md | 2 +- .../iterate-with-javascript-for-loops.md | 2 +- .../iterate-with-javascript-while-loops.md | 2 +- .../local-scope-and-functions.md | 2 +- .../manipulate-arrays-with-pop.md | 2 +- .../modify-array-data-with-indexes.md | 2 +- ...-identical-options-in-switch-statements.md | 4 +- .../multiply-two-decimals-with-javascript.md | 2 +- .../multiply-two-numbers-with-javascript.md | 2 +- ...sing-values-to-functions-with-arguments.md | 2 +- .../practice-comparing-different-values.md | 2 +- .../quoting-strings-with-single-quotes.md | 4 +- .../replace-loops-using-recursion.md | 2 +- .../replacing-if-else-chains-with-switch.md | 6 +- ...returning-boolean-values-from-functions.md | 2 +- ...rom-many-options-with-switch-statements.md | 4 +- ...ing-values-with-the-assignment-operator.md | 2 +- ...one-number-from-another-with-javascript.md | 2 +- .../understand-string-immutability.md | 2 +- ...rstanding-case-sensitivity-in-variables.md | 6 +- .../understanding-uninitialized-variables.md | 6 +- .../updating-object-properties.md | 2 +- ...to-find-the-first-character-in-a-string.md | 2 +- ...-to-find-the-last-character-in-a-string.md | 2 +- ...n-to-find-the-nth-character-in-a-string.md | 2 +- ...d-the-nth-to-last-character-in-a-string.md | 2 +- ...-multiple-conditional-ternary-operators.md | 2 +- .../use-recursion-to-create-a-countdown.md | 2 +- ...-recursion-to-create-a-range-of-numbers.md | 2 +- .../use-the-conditional-ternary-operator.md | 2 +- .../use-the-parseint-function-with-a-radix.md | 2 +- .../use-the-parseint-function.md | 2 +- .../using-objects-for-lookups.md | 4 +- .../basic-javascript/word-blanks.md | 2 +- ...rite-reusable-javascript-with-functions.md | 2 +- ...the-wrong-order-when-calling-a-function.md | 2 +- ...osing-parenthesis-after-a-function-call.md | 2 +- ...-misspelled-variable-and-function-names.md | 8 +- ...mixed-usage-of-single-and-double-quotes.md | 4 +- ...h-off-by-one-errors-when-using-indexing.md | 8 +- ...-parentheses-brackets-braces-and-quotes.md | 2 +- ...t-operator-instead-of-equality-operator.md | 2 +- ...e-loops-with-a-valid-terminal-condition.md | 4 +- ...en-the-freecodecamp-and-browser-console.md | 6 +- ...onsole-to-check-the-value-of-a-variable.md | 2 +- ...-typeof-to-check-the-type-of-a-variable.md | 6 +- ...pare-scopes-of-the-var-and-let-keywords.md | 4 +- ...plete-a-promise-with-resolve-and-reject.md | 4 +- .../es6/create-a-javascript-promise.md | 2 +- .../es6/create-a-module-script.md | 6 +- ...-an-export-fallback-with-export-default.md | 2 +- .../create-strings-using-template-literals.md | 2 +- .../handle-a-fulfilled-promise-with-then.md | 6 +- .../handle-a-rejected-promise-with-catch.md | 6 +- .../es6/import-a-default-export.md | 2 +- .../mutate-an-array-declared-with-const.md | 6 +- .../es6/prevent-object-mutation.md | 6 +- .../es6/reuse-javascript-code-using-import.md | 4 +- ...t-default-parameters-for-your-functions.md | 2 +- .../use--to-import-everything-from-a-file.md | 2 +- ...syntax-to-define-a-constructor-function.md | 2 +- ...ignment-to-assign-variables-from-arrays.md | 2 +- ...to-assign-variables-from-nested-objects.md | 8 +- ...gnment-to-assign-variables-from-objects.md | 8 +- ...signment-to-extract-values-from-objects.md | 6 +- ...ass-an-object-as-a-functions-parameters.md | 4 +- ...st-parameter-to-reassign-array-elements.md | 2 +- .../es6/use-export-to-share-a-code-block.md | 4 +- ...rest-parameter-with-function-parameters.md | 2 +- ...ad-operator-to-evaluate-arrays-in-place.md | 2 +- .../write-arrow-functions-with-parameters.md | 2 +- ...-concise-declarative-functions-with-es6.md | 4 +- ...rations-using-object-property-shorthand.md | 2 +- ...f-an-array-using-concat-instead-of-push.md | 4 +- ...ramming-to-convert-strings-to-url-slugs.md | 2 +- ...ray-into-a-string-using-the-join-method.md | 4 +- ...bine-two-arrays-using-the-concat-method.md | 2 +- .../implement-map-on-a-prototype.md | 2 +- ...lement-the-filter-method-on-a-prototype.md | 2 +- ...ion-to-currying-and-partial-application.md | 2 +- ...-an-array-using-slice-instead-of-splice.md | 4 +- ...part-of-an-array-using-the-slice-method.md | 2 +- ...ay-alphabetically-using-the-sort-method.md | 2 +- ...ng-into-an-array-using-the-split-method.md | 2 +- ...er-or-reduce-to-solve-a-complex-problem.md | 4 +- ...ry-element-in-an-array-meets-a-criteria.md | 2 +- ...er-method-to-extract-data-from-an-array.md | 4 +- ...ap-method-to-extract-data-from-an-array.md | 4 +- .../use-the-reduce-method-to-analyze-data.md | 4 +- ...ny-elements-in-an-array-meet-a-criteria.md | 2 +- .../steamroller.md | 2 +- .../change-the-prototype-to-a-new-object.md | 2 +- .../inherit-behaviors-from-a-supertype.md | 4 +- .../iterate-over-all-properties.md | 2 +- ...ode-more-reusable-with-the-this-keyword.md | 2 +- .../understand-own-properties.md | 4 +- .../understand-the-constructor-property.md | 2 +- ...iately-invoked-function-expression-iife.md | 4 +- .../understand-the-prototype-chain.md | 2 +- ...d-where-an-objects-prototype-comes-from.md | 2 +- .../use-a-constructor-to-create-objects.md | 2 +- ...n-object-from-being-modified-externally.md | 4 +- ...n-to-access-the-properties-of-an-object.md | 4 +- ...-an-objects-constructor-with-instanceof.md | 2 +- .../check-for-mixed-grouping-of-characters.md | 2 +- .../regular-expressions/extract-matches.md | 2 +- .../match-anything-with-wildcard-period.md | 2 +- .../match-literal-strings.md | 2 +- .../remove-whitespace-from-start-and-end.md | 4 +- ...se-capture-groups-to-search-and-replace.md | 4 +- .../using-the-test-method.md | 2 +- .../65687da2e60409c45595bbe1.md | 9 +- .../probability-calculator.md | 63 ++++++-- .../learn-how-a-stack-works.md | 4 +- .../5f356ed60a5decd94ab66986.md | 1 - .../60a3e3396c7b40068ad6998c.md | 4 +- .../645763874fd6d901c273db29.md | 2 +- .../641130423e5f512d8972dae1.md | 6 +- .../64113124efd2852edafaf25f.md | 2 +- .../6449842c6f6c84261075e4c9.md | 2 + .../660f374d532dc41189cc9cc2.md | 8 +- .../660f3ce51f70571e1c5227c8.md | 1 - .../660f3dd626be3a1ffe27e5d1.md | 1 - .../660f4f79e2a82a4e92290f44.md | 1 - .../660f53ad3d39175c5d4335ac.md | 1 - .../662693f82c91a66be46c881b.md | 74 +++++++++ .../6626a060c4006f793e10cb33.md | 104 +++++++++++++ .../6626b4c58c027d86478ff5eb.md | 88 +++++++++++ .../6626b8dcf5057f896f948440.md | 143 ++++++++++++++++++ .../confirm-the-ending.md | 2 +- .../repeat-a-string-repeat-a-string.md | 2 +- .../add-items-using-splice.md | 6 +- ...d-key-value-pairs-to-javascript-objects.md | 4 +- .../check-if-an-object-has-a-property.md | 2 +- .../copy-an-array-with-the-spread-operator.md | 2 +- .../copy-array-items-using-slice.md | 2 +- ...-of-an-object-with-a-for...in-statement.md | 2 +- ...odify-an-object-nested-within-an-object.md | 2 +- .../remove-items-using-splice.md | 6 +- ...ete-keyword-to-remove-object-properties.md | 6 +- .../access-array-data-with-indexes.md | 2 +- ...s-multi-dimensional-arrays-with-indexes.md | 2 +- .../accessing-nested-arrays.md | 2 +- ...object-properties-with-bracket-notation.md | 2 +- ...ing-object-properties-with-dot-notation.md | 2 +- ...essing-object-properties-with-variables.md | 6 +- ...d-new-properties-to-a-javascript-object.md | 2 +- .../add-two-numbers-with-javascript.md | 2 +- ...g-a-default-option-in-switch-statements.md | 4 +- .../appending-variables-to-strings.md | 2 +- ...ng-the-value-of-one-variable-to-another.md | 4 +- .../assignment-with-a-returned-value.md | 2 +- .../chaining-if-else-statements.md | 6 +- .../comment-your-javascript-code.md | 1 - .../comparison-with-the-equality-operator.md | 2 +- ...mparison-with-the-greater-than-operator.md | 2 +- ...h-the-greater-than-or-equal-to-operator.md | 2 +- ...comparison-with-the-inequality-operator.md | 2 +- .../comparison-with-the-less-than-operator.md | 2 +- ...with-the-less-than-or-equal-to-operator.md | 2 +- ...rison-with-the-strict-equality-operator.md | 2 +- ...son-with-the-strict-inequality-operator.md | 2 +- ...mparisons-with-the-logical-and-operator.md | 4 +- ...omparisons-with-the-logical-or-operator.md | 4 +- ...ound-assignment-with-augmented-addition.md | 8 +- ...ound-assignment-with-augmented-division.md | 8 +- ...ssignment-with-augmented-multiplication.md | 8 +- ...d-assignment-with-augmented-subtraction.md | 4 +- ...oncatenating-strings-with-plus-operator.md | 6 +- ...g-strings-with-the-plus-equals-operator.md | 2 +- .../constructing-strings-with-variables.md | 2 +- .../count-backwards-with-a-for-loop.md | 4 +- .../declare-javascript-variables.md | 2 +- .../decrement-a-number-with-javascript.md | 8 +- ...ete-properties-from-a-javascript-object.md | 2 +- ...-one-decimal-by-another-with-javascript.md | 4 +- ...e-one-number-by-another-with-javascript.md | 2 +- .../escaping-literal-quotes-in-strings.md | 2 +- .../find-the-length-of-a-string.md | 6 +- .../finding-a-remainder-in-javascript.md | 4 +- ...nerate-random-fractions-with-javascript.md | 2 +- ...te-random-whole-numbers-with-javascript.md | 8 +- ...ate-random-whole-numbers-within-a-range.md | 8 +- .../global-scope-and-functions.md | 2 +- .../global-vs.-local-scope-in-functions.md | 2 +- .../increment-a-number-with-javascript.md | 6 +- ...-variables-with-the-assignment-operator.md | 2 +- .../introducing-else-if-statements.md | 6 +- .../introducing-else-statements.md | 6 +- .../iterate-odd-numbers-with-a-for-loop.md | 2 +- ...terate-through-an-array-with-a-for-loop.md | 6 +- ...terate-with-javascript-do...while-loops.md | 2 +- .../iterate-with-javascript-for-loops.md | 2 +- .../iterate-with-javascript-while-loops.md | 2 +- .../local-scope-and-functions.md | 2 +- .../manipulate-arrays-with-pop.md | 2 +- .../modify-array-data-with-indexes.md | 2 +- ...-identical-options-in-switch-statements.md | 4 +- .../multiply-two-decimals-with-javascript.md | 2 +- .../multiply-two-numbers-with-javascript.md | 2 +- ...sing-values-to-functions-with-arguments.md | 2 +- .../practice-comparing-different-values.md | 2 +- .../quoting-strings-with-single-quotes.md | 4 +- .../replace-loops-using-recursion.md | 2 +- .../replacing-if-else-chains-with-switch.md | 6 +- ...returning-boolean-values-from-functions.md | 2 +- ...rom-many-options-with-switch-statements.md | 4 +- ...ing-values-with-the-assignment-operator.md | 2 +- ...one-number-from-another-with-javascript.md | 2 +- .../understand-string-immutability.md | 2 +- ...rstanding-case-sensitivity-in-variables.md | 6 +- .../understanding-uninitialized-variables.md | 6 +- .../updating-object-properties.md | 2 +- ...to-find-the-first-character-in-a-string.md | 2 +- ...-to-find-the-last-character-in-a-string.md | 2 +- ...n-to-find-the-nth-character-in-a-string.md | 2 +- ...d-the-nth-to-last-character-in-a-string.md | 2 +- ...-multiple-conditional-ternary-operators.md | 2 +- .../use-recursion-to-create-a-countdown.md | 2 +- ...-recursion-to-create-a-range-of-numbers.md | 2 +- .../use-the-conditional-ternary-operator.md | 2 +- .../use-the-parseint-function-with-a-radix.md | 2 +- .../use-the-parseint-function.md | 2 +- .../using-objects-for-lookups.md | 4 +- .../basic-javascript/word-blanks.md | 2 +- ...rite-reusable-javascript-with-functions.md | 2 +- ...the-wrong-order-when-calling-a-function.md | 2 +- ...osing-parenthesis-after-a-function-call.md | 2 +- ...-misspelled-variable-and-function-names.md | 8 +- ...mixed-usage-of-single-and-double-quotes.md | 4 +- ...h-off-by-one-errors-when-using-indexing.md | 8 +- ...-parentheses-brackets-braces-and-quotes.md | 2 +- ...t-operator-instead-of-equality-operator.md | 2 +- ...e-loops-with-a-valid-terminal-condition.md | 4 +- ...en-the-freecodecamp-and-browser-console.md | 6 +- ...onsole-to-check-the-value-of-a-variable.md | 2 +- ...-typeof-to-check-the-type-of-a-variable.md | 6 +- ...pare-scopes-of-the-var-and-let-keywords.md | 4 +- ...plete-a-promise-with-resolve-and-reject.md | 4 +- .../es6/create-a-javascript-promise.md | 2 +- .../es6/create-a-module-script.md | 6 +- ...-an-export-fallback-with-export-default.md | 2 +- .../create-strings-using-template-literals.md | 2 +- .../handle-a-fulfilled-promise-with-then.md | 6 +- .../handle-a-rejected-promise-with-catch.md | 6 +- .../es6/import-a-default-export.md | 2 +- .../mutate-an-array-declared-with-const.md | 6 +- .../es6/prevent-object-mutation.md | 6 +- .../es6/reuse-javascript-code-using-import.md | 4 +- ...t-default-parameters-for-your-functions.md | 2 +- .../use--to-import-everything-from-a-file.md | 2 +- ...syntax-to-define-a-constructor-function.md | 2 +- ...ignment-to-assign-variables-from-arrays.md | 2 +- ...to-assign-variables-from-nested-objects.md | 8 +- ...gnment-to-assign-variables-from-objects.md | 8 +- ...signment-to-extract-values-from-objects.md | 6 +- ...ass-an-object-as-a-functions-parameters.md | 4 +- ...st-parameter-to-reassign-array-elements.md | 2 +- .../es6/use-export-to-share-a-code-block.md | 4 +- ...rest-parameter-with-function-parameters.md | 2 +- ...ad-operator-to-evaluate-arrays-in-place.md | 2 +- .../write-arrow-functions-with-parameters.md | 2 +- ...-concise-declarative-functions-with-es6.md | 4 +- ...rations-using-object-property-shorthand.md | 2 +- ...f-an-array-using-concat-instead-of-push.md | 4 +- ...ramming-to-convert-strings-to-url-slugs.md | 2 +- ...ray-into-a-string-using-the-join-method.md | 4 +- ...bine-two-arrays-using-the-concat-method.md | 2 +- .../implement-map-on-a-prototype.md | 2 +- ...lement-the-filter-method-on-a-prototype.md | 2 +- ...ion-to-currying-and-partial-application.md | 2 +- ...-an-array-using-slice-instead-of-splice.md | 4 +- ...part-of-an-array-using-the-slice-method.md | 2 +- ...ay-alphabetically-using-the-sort-method.md | 2 +- ...ng-into-an-array-using-the-split-method.md | 2 +- ...er-or-reduce-to-solve-a-complex-problem.md | 4 +- ...ry-element-in-an-array-meets-a-criteria.md | 2 +- ...er-method-to-extract-data-from-an-array.md | 4 +- ...ap-method-to-extract-data-from-an-array.md | 4 +- .../use-the-reduce-method-to-analyze-data.md | 4 +- ...ny-elements-in-an-array-meet-a-criteria.md | 2 +- .../steamroller.md | 2 +- .../change-the-prototype-to-a-new-object.md | 2 +- .../inherit-behaviors-from-a-supertype.md | 4 +- .../iterate-over-all-properties.md | 2 +- ...ode-more-reusable-with-the-this-keyword.md | 2 +- .../understand-own-properties.md | 4 +- .../understand-the-constructor-property.md | 2 +- ...iately-invoked-function-expression-iife.md | 4 +- .../understand-the-prototype-chain.md | 2 +- ...d-where-an-objects-prototype-comes-from.md | 2 +- .../use-a-constructor-to-create-objects.md | 2 +- ...n-object-from-being-modified-externally.md | 4 +- ...n-to-access-the-properties-of-an-object.md | 4 +- ...-an-objects-constructor-with-instanceof.md | 2 +- .../check-for-mixed-grouping-of-characters.md | 2 +- .../regular-expressions/extract-matches.md | 2 +- .../match-anything-with-wildcard-period.md | 2 +- .../match-literal-strings.md | 2 +- .../remove-whitespace-from-start-and-end.md | 4 +- ...se-capture-groups-to-search-and-replace.md | 4 +- .../using-the-test-method.md | 2 +- .../65687da2e60409c45595bbe1.md | 9 +- .../probability-calculator.md | 63 ++++++-- .../learn-how-a-stack-works.md | 4 +- .../5f356ed60a5decd94ab66986.md | 1 - .../60a3e3396c7b40068ad6998c.md | 4 +- .../645763874fd6d901c273db29.md | 2 +- .../641130423e5f512d8972dae1.md | 6 +- .../64113124efd2852edafaf25f.md | 2 +- .../6449842c6f6c84261075e4c9.md | 2 + .../660f374d532dc41189cc9cc2.md | 8 +- .../660f3ce51f70571e1c5227c8.md | 1 - .../660f3dd626be3a1ffe27e5d1.md | 1 - .../660f4f79e2a82a4e92290f44.md | 1 - .../660f53ad3d39175c5d4335ac.md | 1 - .../662693f82c91a66be46c881b.md | 74 +++++++++ .../6626a060c4006f793e10cb33.md | 104 +++++++++++++ .../6626b4c58c027d86478ff5eb.md | 88 +++++++++++ .../6626b8dcf5057f896f948440.md | 143 ++++++++++++++++++ .../confirm-the-ending.md | 2 +- .../repeat-a-string-repeat-a-string.md | 2 +- .../add-items-using-splice.md | 6 +- ...d-key-value-pairs-to-javascript-objects.md | 4 +- .../check-if-an-object-has-a-property.md | 2 +- .../copy-an-array-with-the-spread-operator.md | 2 +- .../copy-array-items-using-slice.md | 2 +- ...-of-an-object-with-a-for...in-statement.md | 2 +- ...odify-an-object-nested-within-an-object.md | 2 +- .../remove-items-using-splice.md | 6 +- ...ete-keyword-to-remove-object-properties.md | 6 +- .../access-array-data-with-indexes.md | 2 +- ...s-multi-dimensional-arrays-with-indexes.md | 2 +- .../accessing-nested-arrays.md | 2 +- ...object-properties-with-bracket-notation.md | 2 +- ...ing-object-properties-with-dot-notation.md | 2 +- ...essing-object-properties-with-variables.md | 6 +- ...d-new-properties-to-a-javascript-object.md | 2 +- .../add-two-numbers-with-javascript.md | 2 +- ...g-a-default-option-in-switch-statements.md | 4 +- .../appending-variables-to-strings.md | 2 +- ...ng-the-value-of-one-variable-to-another.md | 4 +- .../assignment-with-a-returned-value.md | 2 +- .../chaining-if-else-statements.md | 6 +- .../comment-your-javascript-code.md | 1 - .../comparison-with-the-equality-operator.md | 2 +- ...mparison-with-the-greater-than-operator.md | 2 +- ...h-the-greater-than-or-equal-to-operator.md | 2 +- ...comparison-with-the-inequality-operator.md | 2 +- .../comparison-with-the-less-than-operator.md | 2 +- ...with-the-less-than-or-equal-to-operator.md | 2 +- ...rison-with-the-strict-equality-operator.md | 2 +- ...son-with-the-strict-inequality-operator.md | 2 +- ...mparisons-with-the-logical-and-operator.md | 4 +- ...omparisons-with-the-logical-or-operator.md | 4 +- ...ound-assignment-with-augmented-addition.md | 8 +- ...ound-assignment-with-augmented-division.md | 8 +- ...ssignment-with-augmented-multiplication.md | 8 +- ...d-assignment-with-augmented-subtraction.md | 4 +- ...oncatenating-strings-with-plus-operator.md | 6 +- ...g-strings-with-the-plus-equals-operator.md | 2 +- .../constructing-strings-with-variables.md | 2 +- .../count-backwards-with-a-for-loop.md | 4 +- .../declare-javascript-variables.md | 2 +- .../decrement-a-number-with-javascript.md | 8 +- ...ete-properties-from-a-javascript-object.md | 2 +- ...-one-decimal-by-another-with-javascript.md | 4 +- ...e-one-number-by-another-with-javascript.md | 2 +- .../escaping-literal-quotes-in-strings.md | 2 +- .../find-the-length-of-a-string.md | 6 +- .../finding-a-remainder-in-javascript.md | 4 +- ...nerate-random-fractions-with-javascript.md | 2 +- ...te-random-whole-numbers-with-javascript.md | 8 +- ...ate-random-whole-numbers-within-a-range.md | 8 +- .../global-scope-and-functions.md | 2 +- .../global-vs.-local-scope-in-functions.md | 2 +- .../increment-a-number-with-javascript.md | 6 +- ...-variables-with-the-assignment-operator.md | 2 +- .../introducing-else-if-statements.md | 6 +- .../introducing-else-statements.md | 6 +- .../iterate-odd-numbers-with-a-for-loop.md | 2 +- ...terate-through-an-array-with-a-for-loop.md | 6 +- ...terate-with-javascript-do...while-loops.md | 2 +- .../iterate-with-javascript-for-loops.md | 2 +- .../iterate-with-javascript-while-loops.md | 2 +- .../local-scope-and-functions.md | 2 +- .../manipulate-arrays-with-pop.md | 2 +- .../modify-array-data-with-indexes.md | 2 +- ...-identical-options-in-switch-statements.md | 4 +- .../multiply-two-decimals-with-javascript.md | 2 +- .../multiply-two-numbers-with-javascript.md | 2 +- ...sing-values-to-functions-with-arguments.md | 2 +- .../practice-comparing-different-values.md | 2 +- .../quoting-strings-with-single-quotes.md | 4 +- .../replace-loops-using-recursion.md | 2 +- .../replacing-if-else-chains-with-switch.md | 6 +- ...returning-boolean-values-from-functions.md | 2 +- ...rom-many-options-with-switch-statements.md | 4 +- ...ing-values-with-the-assignment-operator.md | 2 +- ...one-number-from-another-with-javascript.md | 2 +- .../understand-string-immutability.md | 2 +- ...rstanding-case-sensitivity-in-variables.md | 6 +- .../understanding-uninitialized-variables.md | 6 +- .../updating-object-properties.md | 2 +- ...to-find-the-first-character-in-a-string.md | 2 +- ...-to-find-the-last-character-in-a-string.md | 2 +- ...n-to-find-the-nth-character-in-a-string.md | 2 +- ...d-the-nth-to-last-character-in-a-string.md | 2 +- ...-multiple-conditional-ternary-operators.md | 2 +- .../use-recursion-to-create-a-countdown.md | 2 +- ...-recursion-to-create-a-range-of-numbers.md | 2 +- .../use-the-conditional-ternary-operator.md | 2 +- .../use-the-parseint-function-with-a-radix.md | 2 +- .../use-the-parseint-function.md | 2 +- .../using-objects-for-lookups.md | 4 +- .../basic-javascript/word-blanks.md | 2 +- ...rite-reusable-javascript-with-functions.md | 2 +- ...the-wrong-order-when-calling-a-function.md | 2 +- ...osing-parenthesis-after-a-function-call.md | 2 +- ...-misspelled-variable-and-function-names.md | 8 +- ...mixed-usage-of-single-and-double-quotes.md | 4 +- ...h-off-by-one-errors-when-using-indexing.md | 8 +- ...-parentheses-brackets-braces-and-quotes.md | 2 +- ...t-operator-instead-of-equality-operator.md | 2 +- ...e-loops-with-a-valid-terminal-condition.md | 4 +- ...en-the-freecodecamp-and-browser-console.md | 6 +- ...onsole-to-check-the-value-of-a-variable.md | 2 +- ...-typeof-to-check-the-type-of-a-variable.md | 6 +- ...pare-scopes-of-the-var-and-let-keywords.md | 4 +- ...plete-a-promise-with-resolve-and-reject.md | 4 +- .../es6/create-a-javascript-promise.md | 2 +- .../es6/create-a-module-script.md | 6 +- ...-an-export-fallback-with-export-default.md | 2 +- .../create-strings-using-template-literals.md | 2 +- .../handle-a-fulfilled-promise-with-then.md | 6 +- .../handle-a-rejected-promise-with-catch.md | 6 +- .../es6/import-a-default-export.md | 2 +- .../mutate-an-array-declared-with-const.md | 6 +- .../es6/prevent-object-mutation.md | 6 +- .../es6/reuse-javascript-code-using-import.md | 4 +- ...t-default-parameters-for-your-functions.md | 2 +- .../use--to-import-everything-from-a-file.md | 2 +- ...syntax-to-define-a-constructor-function.md | 2 +- ...ignment-to-assign-variables-from-arrays.md | 2 +- ...to-assign-variables-from-nested-objects.md | 8 +- ...gnment-to-assign-variables-from-objects.md | 8 +- ...signment-to-extract-values-from-objects.md | 6 +- ...ass-an-object-as-a-functions-parameters.md | 4 +- ...st-parameter-to-reassign-array-elements.md | 2 +- .../es6/use-export-to-share-a-code-block.md | 4 +- ...rest-parameter-with-function-parameters.md | 2 +- ...ad-operator-to-evaluate-arrays-in-place.md | 2 +- .../write-arrow-functions-with-parameters.md | 2 +- ...-concise-declarative-functions-with-es6.md | 4 +- ...rations-using-object-property-shorthand.md | 2 +- ...f-an-array-using-concat-instead-of-push.md | 4 +- ...ramming-to-convert-strings-to-url-slugs.md | 2 +- ...ray-into-a-string-using-the-join-method.md | 4 +- ...bine-two-arrays-using-the-concat-method.md | 2 +- .../implement-map-on-a-prototype.md | 2 +- ...lement-the-filter-method-on-a-prototype.md | 2 +- ...ion-to-currying-and-partial-application.md | 2 +- ...-an-array-using-slice-instead-of-splice.md | 4 +- ...part-of-an-array-using-the-slice-method.md | 2 +- ...ay-alphabetically-using-the-sort-method.md | 2 +- ...ng-into-an-array-using-the-split-method.md | 2 +- ...er-or-reduce-to-solve-a-complex-problem.md | 4 +- ...ry-element-in-an-array-meets-a-criteria.md | 2 +- ...er-method-to-extract-data-from-an-array.md | 4 +- ...ap-method-to-extract-data-from-an-array.md | 4 +- .../use-the-reduce-method-to-analyze-data.md | 4 +- ...ny-elements-in-an-array-meet-a-criteria.md | 2 +- .../steamroller.md | 2 +- .../change-the-prototype-to-a-new-object.md | 2 +- .../inherit-behaviors-from-a-supertype.md | 4 +- .../iterate-over-all-properties.md | 2 +- ...ode-more-reusable-with-the-this-keyword.md | 2 +- .../understand-own-properties.md | 4 +- .../understand-the-constructor-property.md | 2 +- ...iately-invoked-function-expression-iife.md | 4 +- .../understand-the-prototype-chain.md | 2 +- ...d-where-an-objects-prototype-comes-from.md | 2 +- .../use-a-constructor-to-create-objects.md | 2 +- ...n-object-from-being-modified-externally.md | 4 +- ...n-to-access-the-properties-of-an-object.md | 4 +- ...-an-objects-constructor-with-instanceof.md | 2 +- .../check-for-mixed-grouping-of-characters.md | 2 +- .../regular-expressions/extract-matches.md | 2 +- .../match-anything-with-wildcard-period.md | 2 +- .../match-literal-strings.md | 2 +- .../remove-whitespace-from-start-and-end.md | 4 +- ...se-capture-groups-to-search-and-replace.md | 4 +- .../using-the-test-method.md | 2 +- .../65687da2e60409c45595bbe1.md | 9 +- .../probability-calculator.md | 63 ++++++-- .../learn-how-a-stack-works.md | 4 +- .../5f356ed60a5decd94ab66986.md | 1 - .../60a3e3396c7b40068ad6998c.md | 4 +- .../645763874fd6d901c273db29.md | 2 +- .../641130423e5f512d8972dae1.md | 6 +- .../64113124efd2852edafaf25f.md | 2 +- .../6449842c6f6c84261075e4c9.md | 2 + .../660f374d532dc41189cc9cc2.md | 8 +- .../660f3ce51f70571e1c5227c8.md | 1 - .../660f3dd626be3a1ffe27e5d1.md | 1 - .../660f4f79e2a82a4e92290f44.md | 1 - .../660f53ad3d39175c5d4335ac.md | 1 - .../662693f82c91a66be46c881b.md | 74 +++++++++ .../6626a060c4006f793e10cb33.md | 104 +++++++++++++ .../6626b4c58c027d86478ff5eb.md | 88 +++++++++++ .../6626b8dcf5057f896f948440.md | 143 ++++++++++++++++++ 2107 files changed, 8339 insertions(+), 3516 deletions(-) create mode 100644 curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md create mode 100644 curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md create mode 100644 curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md create mode 100644 curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md create mode 100644 curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md create mode 100644 curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md create mode 100644 curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md create mode 100644 curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md create mode 100644 curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md create mode 100644 curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md create mode 100644 curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md create mode 100644 curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md create mode 100644 curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md create mode 100644 curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md create mode 100644 curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md create mode 100644 curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md create mode 100644 curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md create mode 100644 curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md create mode 100644 curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md create mode 100644 curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md create mode 100644 curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md create mode 100644 curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md create mode 100644 curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md create mode 100644 curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md create mode 100644 curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md create mode 100644 curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md create mode 100644 curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md create mode 100644 curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md create mode 100644 curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md create mode 100644 curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md create mode 100644 curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md create mode 100644 curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md create mode 100644 curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md create mode 100644 curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md create mode 100644 curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md create mode 100644 curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md create mode 100644 curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md create mode 100644 curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md create mode 100644 curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md create mode 100644 curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md create mode 100644 curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md create mode 100644 curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md create mode 100644 curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md create mode 100644 curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md diff --git a/client/src/pages/learn/javascript-algorithms-and-data-structures-v8/review-js-fundamentals-by-building-a-gradebook-app/index.md b/client/src/pages/learn/javascript-algorithms-and-data-structures-v8/review-js-fundamentals-by-building-a-gradebook-app/index.md index f1ea903e197..e3e5d0583a1 100644 --- a/client/src/pages/learn/javascript-algorithms-and-data-structures-v8/review-js-fundamentals-by-building-a-gradebook-app/index.md +++ b/client/src/pages/learn/javascript-algorithms-and-data-structures-v8/review-js-fundamentals-by-building-a-gradebook-app/index.md @@ -2,7 +2,6 @@ title: Introduction to the Review JavaScript Fundamentals by Building a Gradebook App block: review-js-fundamentals-by-building-a-gradebook-app superBlock: javascript-algorithms-and-data-structures-v8 -isBeta: true --- ## Introduction to the Review JavaScript Fundamentals by Building a Gradebook App diff --git a/curriculum/challenges/_meta/review-js-fundamentals-by-building-a-gradebook-app/meta.json b/curriculum/challenges/_meta/review-js-fundamentals-by-building-a-gradebook-app/meta.json index 932737bba0a..ff13b8f5be3 100644 --- a/curriculum/challenges/_meta/review-js-fundamentals-by-building-a-gradebook-app/meta.json +++ b/curriculum/challenges/_meta/review-js-fundamentals-by-building-a-gradebook-app/meta.json @@ -10,7 +10,6 @@ "required": [], "superBlock": "javascript-algorithms-and-data-structures-v8", "superOrder": 4, - "isBeta": true, "challengeOrder": [ { "id": "662693f82c91a66be46c881b", @@ -30,4 +29,4 @@ } ], "helpCategory": "JavaScript" -} \ No newline at end of file +} diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md index 4edfccbb7e3..4fa4598edb5 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md @@ -87,7 +87,7 @@ assert(confirmEnding('Abstraction', 'action') === true); برنامجك يجب ألا يستخدم طريقة مبنية داخلياً (built-in method) باسم `.endsWith()` لحل التحدي. ```js -assert(!/\.endsWith\(.*?\)\s*?;?/.test(code) && !/\['endsWith'\]/.test(code)); +assert(!/\.endsWith\(.*?\)\s*?;?/.test(__helpers.removeJSComments(code)) && !/\['endsWith'\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md index 5ad936f1598..e2dc10d975d 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md @@ -51,7 +51,7 @@ assert(repeatStringNumTimes('abc', -2) === ''); لا ينبغي استخدام الوظيفة `repeat()` المدمجة. ```js -assert(!/\.repeat/g.test(code)); +assert(!/\.repeat/g.test(__helpers.removeJSComments(code))); ``` `repeatStringNumTimes("abc", 0)` يجب أن ينتج `""`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md index 9df1e39c140..252e9f39dc8 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md @@ -53,19 +53,19 @@ assert.deepEqual( يجب أن تستخدم وظيفة `htmlColorNames` الطريقة `splice()` ```js -assert(/.splice/.test(code)); +assert(/.splice/.test(__helpers.removeJSComments(code))); ``` لا يجب عليك استخدام `shift()` أو `unshift()`. ```js -assert(!/shift|unshift/.test(code)); +assert(!/shift|unshift/.test(__helpers.removeJSComments(code))); ``` لا يجب عليك استخدام bracket notation القائمة. ```js -assert(!/\[\d\]\s*=/.test(code)); +assert(!/\[\d\]\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md index 34c6f46d014..8a39817e791 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md @@ -85,8 +85,8 @@ The definition of the `foods` object should not be changed. ```js assert( - code.search(/let foods/) === -1 && - code.search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ + __helpers.removeJSComments(code).search(/let foods/) === -1 && + __helpers.removeJSComments(code).search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ ) !== -1 ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md index c7ffea4bf9d..c4ec5d068c9 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md @@ -27,7 +27,7 @@ users.hasOwnProperty('Alan'); ```js -assert(code.match(/users/gm).length <= 2) +assert(__helpers.removeJSComments(code).match(/users/gm).length <= 2) ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index 75785747ba7..7b78f2efb2d 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ يجب أن تستخدم وظيفة `copyMachine` عملية `spread operator` مع القائمة `arr` ```js -assert(code.match(/\.\.\.\s*arr/)); +assert(__helpers.removeJSComments(__helpers.removeJSComments(code)).match(/\.\.\.\s*arr/)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md index 59b4eec8dda..3b74dd9f831 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md @@ -38,7 +38,7 @@ assert.deepEqual( يجب أن تستخدم وظيفة `forecast` الطريقة `slice()` ```js -assert(/\.slice\(/.test(code)); +assert(/\.slice\(/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index 1f481bac1cd..8b18e202ed9 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -51,7 +51,7 @@ We've defined a function `countOnline` which accepts one argument, `allUsers`. U ```js assert( - code.match( + __helpers.removeJSComments(code).match( /for\s*\(\s*(var|let|const)\s+[a-zA-Z_$]\w*\s+in\s+[a-zA-Z_$]\w*\s*\)/ ) ); diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md index 8a43399533e..a30d0dc7f89 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md @@ -61,7 +61,7 @@ assert(userActivity.data.online === 45); يجب تعيين خاصية `online` باستخدام dot او علامات الأقواس. ```js -assert.strictEqual(code.search(/online: 45/), -1); +assert.strictEqual(__helpers.removeJSComments(code).search(/online: 45/), -1); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md index cff13ae310e..3fb78e417a8 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md @@ -40,7 +40,7 @@ let newArray = array.splice(3, 2); ```js assert( - __helpers.removeWhiteSpace(code).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) ); ``` @@ -56,14 +56,14 @@ assert.strictEqual( يجب أن يستخدم التعلميات البرمجية الخاص بك وظيفة `splice()` علي `arr`. ```js -assert(__helpers.removeWhiteSpace(code).match(/arr\.splice\(/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(/)); ``` يجب فقط إزالة العناصر من `arr` وعدم إضافة أي عناصر إضافية إلى `arr`. ```js assert( - !__helpers.removeWhiteSpace(code).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) + !__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md index 57e8875e52d..6484b4fc6b8 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md @@ -39,9 +39,9 @@ assert( ```js assert( - code.search(/oranges:/) !== -1 && - code.search(/plums:/) !== -1 && - code.search(/strawberries:/) !== -1 + __helpers.removeJSComments(code).search(/oranges:/) !== -1 && + __helpers.removeJSComments(code).search(/plums:/) !== -1 && + __helpers.removeJSComments(code).search(/strawberries:/) !== -1 ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md index d664e57d896..4cbde6f1cfe 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md @@ -54,7 +54,7 @@ assert( ```js assert( (function () { - if (code.match(/\s*=\s*myArray\[0\]/g)) { + if (__helpers.removeJSComments(code).match(/\s*=\s*myArray\[0\]/g)) { return true; } else { return false; diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md index b8bac4a19ed..684b26717f7 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md @@ -45,7 +45,7 @@ assert(myData === 8); يجب أن تستخدم علامات الأقواس لقراءة القيمة الصحيحة من `myArray`. ```js -assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code))); +assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md index b82c66fdf84..232134caa08 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md @@ -54,7 +54,7 @@ assert(secondTree === 'pine'); التعليمات البرميجة الخاص بك يجب أن يستخدم dot و bracket notation للوصول إلى `myPlants`. ```js -assert(/=\s*myPlants\[1\].list\[1\]/.test(code)); +assert(/=\s*myPlants\[1\].list\[1\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md index 0d152807800..6cc03a0bc31 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md @@ -64,7 +64,7 @@ assert(drinkValue === 'water'); يجب عليك أستخدام علامات الأقواس مرتين ```js -assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md index 4b22e57c815..39257d958cd 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md @@ -60,7 +60,7 @@ assert(shirtValue === 'jersey'); يجب عليك استخدام النقطة التأشير مرتين ```js -assert(code.match(/testObj\.\w+/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\.\w+/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md index 53bde20f3e3..282717e67ea 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md @@ -56,19 +56,19 @@ assert(player === 'Montana'); يجب عليك استخدام علامات الأقواس للوصول إلى `testObj` ```js -assert(/testObj\s*?\[.*?\]/.test(code)); +assert(/testObj\s*?\[.*?\]/.test(__helpers.removeJSComments(code))); ``` لا يجب عليك تعيين قيمة `Montana` للمتغير `player` مباشرة. ```js -assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); +assert(!__helpers.removeJSComments(code).match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); ``` يجب أن تستخدم المتغير `playerNumber` في علامات الأقواس ```js -assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code)); +assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md index 0c1222e7830..b84c4d89c8e 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md @@ -53,7 +53,7 @@ assert(myDog.bark !== undefined); لا ينبغي أن تضيف `bark` إلى التعليمات البرمجية تهيئة الكائن `myDog`. ```js -assert(!/bark[^\n]:/.test(code)); +assert(!/bark[^\n]:/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md index e7429820397..d9cb2c4f17d 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md @@ -38,7 +38,7 @@ assert(sum === 20); يجب عليك استخدام المعامل `+`. ```js -assert(/\+/.test(code)); +assert(/\+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md index c43b833a4fc..d2960b609be 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md @@ -71,7 +71,7 @@ assert(switchOfStuff(4) === 'stuff'); يجب ألا تستخدم أي عبارات `if` أو `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` يجب أن تستخدم عبارة `default` @@ -83,7 +83,7 @@ assert(switchOfStuff('string-to-trigger-default-case') === 'stuff'); يجب أن يكون لديك في الأقل ٣ عبارات `break` ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md index 62b79a4d644..f940659fa46 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md @@ -36,7 +36,7 @@ assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2); يجب عليك إلحاق المتغير `someAdjective` إلى `myStr` باستخدام `+=`. ```js -assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md index d757a010d3a..5361b1acf26 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md @@ -29,7 +29,7 @@ myNum = myVar; لا يجب عليك تعديل التعليمات البرمجية فوق التعليق المحدد. ```js -assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code))); ``` المتغير `b` يجب أن يساوي `7`. @@ -41,7 +41,7 @@ assert(typeof b === 'number' && b === 7); قيمة المتغير `a` يجب أن يتم تعيينها إلى المتغير `b` باستخدام `=`. ```js -assert(/b\s*=\s*a\s*/g.test(code)); +assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md index 6c39b65533c..7c4fd968959 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md @@ -34,7 +34,7 @@ assert(processed === 2); يجب عليك تعيين `processArg` إلى `processed` ```js -assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code)); +assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md index 088a7b14a5a..32fb740f20a 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md @@ -39,19 +39,19 @@ if (condition1) { يجب أن يكون لديك في الأقل أربع تعبيرات `else` ```js -assert(code.match(/else/g).length > 3); +assert(__helpers.removeJSComments(code).match(/else/g).length > 3); ``` يجب أن يكون لديك في الأقل أربع تعبيرات `if` ```js -assert(code.match(/if/g).length > 3); +assert(__helpers.removeJSComments(code).match(/if/g).length > 3); ``` يجب أن يكون لديك في الأقل تعبير واحد `return` ```js -assert(code.match(/return/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/return/g).length >= 1); ``` `testSize(0)` يجب أن تنتج المقطع النصي `Tiny` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index 99b48c6e4c4..fb052b02356 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -2,7 +2,6 @@ id: bd7123c9c441eddfaeb4bdef title: التعليق (Comment) في كودك من JavaScript challengeType: 1 -removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' forumTopicId: 16783 dashedName: comment-your-javascript-code diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index d25e6a6b634..176a8183196 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -58,7 +58,7 @@ assert(testEqual('12') === 'Equal'); يجب عليك أن تستخدم العملية `==` ```js -assert(code.match(/==/g) && !code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/==/g) && !__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index 7651c79201d..8ac276217a0 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -73,7 +73,7 @@ assert(testGreaterThan(150) === 'Over 100'); يجب عليك استخدام مشغل `>` مرتين في الأقل ```js -assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index 5d56a0661fb..d89cdea8f6a 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -73,7 +73,7 @@ assert(testGreaterOrEqual(21) === '20 or Over'); يجب عليك استخدام مشغل `>=` مرتين في الأقل ```js -assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index 1ddb452bc04..61f85fc7e50 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -60,7 +60,7 @@ assert(testNotEqual('bob') === 'Not Equal'); يجب عليك استخدام المشغل `!=` ```js -assert(code.match(/(?!!==)!=/)); +assert(__helpers.removeJSComments(code).match(/(?!!==)!=/)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index 961d6cd2dd8..c82ed1e4b29 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -66,7 +66,7 @@ assert(testLessThan(99) === '55 or Over'); يجب عليك استخدام مشغل `<` مرتين في الأقل ```js -assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index de1b0570459..569d8cd4aa5 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -72,7 +72,7 @@ assert(testLessOrEqual(55) === 'More Than 24'); يجب عليك استخدام مشغل `<=` مرتين في الأقل ```js -assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index 492efaa3412..af433c46e95 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -49,7 +49,7 @@ assert(testStrict('7') === 'Not Equal'); يجب عليك استخدام مشغل `===` ```js -assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index 18ad4c5aaa0..932e5d5fb6c 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -52,7 +52,7 @@ assert(testStrictNotEqual('bob') === 'Not Equal'); يجب عليك استخدام المشغل `!==` ```js -assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md index c2d1d952a88..9bd3c1b1f4e 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md @@ -40,13 +40,13 @@ return "No"; يجب عليك استخدام المشغل `&&` مرة واحدة ```js -assert(code.match(/&&/g).length === 1); +assert(__helpers.removeJSComments(code).match(/&&/g).length === 1); ``` يجب أن يكون لديك عبارة `if` واحد فقط ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` يجب أن ينتج `testLogicalAnd(0)` المقطع النصي `No` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md index b0447a4664b..d946d394134 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md @@ -43,13 +43,13 @@ return "Yes"; يجب عليك استخدام المشغل `||` مرة واحدة ```js -assert(code.match(/\|\|/g).length === 1); +assert(__helpers.removeJSComments(code).match(/\|\|/g).length === 1); ``` يجب أن يكون لديك تعبير `if` واحد فقط ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` يجب أن ينتج `testLogicalOr(0)` مقطع `Outside` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md index dca867620cb..0c08549a503 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md @@ -54,16 +54,16 @@ assert(c === 19); يجب عليك استخدام مشغل `+=` لكل متغير. ```js -assert(code.match(/\+=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\+=/g).length === 3); ``` لا يجب عليك تعديل الكود فوق التعليق المحدد. ```js assert( - /let a = 3;/.test(code) && - /let b = 17;/.test(code) && - /let c = 12;/.test(code) + /let a = 3;/.test(__helpers.removeJSComments(code)) && + /let b = 17;/.test(__helpers.removeJSComments(code)) && + /let c = 12;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md index f315b7ac7cb..9a4bfedc4d8 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md @@ -48,16 +48,16 @@ assert(c === 3); يجب عليك استخدام مشغل `/=` لكل متغير. ```js -assert(code.match(/\/=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\/=/g).length === 3); ``` لا يجب عليك تعديل الكود فوق التعليق المحدد. ```js assert( - /let a = 48;/.test(code) && - /let b = 108;/.test(code) && - /let c = 33;/.test(code) + /let a = 48;/.test(__helpers.removeJSComments(code)) && + /let b = 108;/.test(__helpers.removeJSComments(code)) && + /let c = 33;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md index 8a36f3ee178..5d63f25b0c3 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md @@ -48,16 +48,16 @@ assert(c === 46); يجب عليك استخدام مشغل `*=` لكل متغير. ```js -assert(code.match(/\*=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\*=/g).length === 3); ``` لا يجب عليك تعديل الكود فوق التعليق المحدد. ```js assert( - /let a = 5;/.test(code) && - /let b = 12;/.test(code) && - /let c = 4\.6;/.test(code) + /let a = 5;/.test(__helpers.removeJSComments(code)) && + /let b = 12;/.test(__helpers.removeJSComments(code)) && + /let c = 4\.6;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md index 6b5425dfb42..5709ddee9db 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md @@ -48,14 +48,14 @@ assert(c === 2); يجب عليك استخدام مشغل `-=` لكل متغير. ```js -assert(code.match(/-=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/-=/g).length === 3); ``` لا يجب عليك تعديل الكود فوق التعليق المحدد. ```js assert( - /let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code) + /let a = 11;/.test(__helpers.removeJSComments(code)) && /let b = 9;/.test(__helpers.removeJSComments(code)) && /let c = 3;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md index a6153f6d93f..7143cc44762 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md @@ -47,19 +47,19 @@ assert(myStr === 'This is the start. This is the end.'); يجب عليك استخدام مشغل `+` لبناء `myStr`. ```js -assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g)); +assert(__helpers.removeJSComments(code).match(/(["']).*\1\s*\+\s*(["']).*\2/g)); ``` يجب أن يتم إنشاء `myStr` باستخدام كلمة `const`. ```js -assert(/const\s+myStr/.test(code)); +assert(/const\s+myStr/.test(__helpers.removeJSComments(code))); ``` يجب عليك تعيين النتيجة إلى المتغير `myStr`. ```js -assert(/myStr\s*=/.test(code)); +assert(/myStr\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index 8a5a60ad3d0..d8c5ec7ddf7 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -43,7 +43,7 @@ assert(myStr === 'This is the first sentence. This is the second sentence.'); يجب عليك استخدام مشغل `+=` لبناء `myStr`. ```js -assert(code.match(/myStr\s*\+=\s*(["']).*\1/g)); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*(["']).*\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md index e80668cde93..584513caf5c 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md @@ -35,7 +35,7 @@ assert(typeof myName !== 'undefined' && myName.length > 2); يجب عليك استخدام `+` مرتين لبناء `myStr` باحتواء `myName` داخله. ```js -assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); +assert(__helpers.removeJSComments(code).match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md index 98eb93fd0cb..1637aed9dd4 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md @@ -34,13 +34,13 @@ for (let i = 10; i > 0; i -= 2) { يجب أن تستخدم الحلقة التكرارية `for`. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` يجب أن تستخدم طريقة للقائمة (array method) باسم `push`. ```js -assert(code.match(/myArray.push/)); +assert(__helpers.removeJSComments(code).match(/myArray.push/)); ``` يجب أن تساوي `myArray` قيمة `[9, 7, 5, 3, 1]`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md index c72cab26475..4de762d26d7 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md @@ -37,7 +37,7 @@ var ourName; يجب أن تعلن `myName` باستخدام كلمة `var` و تنهي بالفاصلة المنقوطة (;) ```js -assert(/var\s+myName\s*;/.test(code)); +assert(/var\s+myName\s*;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md index b17352c4795..ee331b2a875 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md @@ -38,25 +38,25 @@ assert(myVar === 10); يجب تغيير `myVar = myVar - 1;`. ```js -assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); ``` لا يجب عليك تعيين `myVar` بقيمة `10`. ```js -assert(!code.match(/myVar\s*=\s*10.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*10.*?;?/)); ``` يجب عليك استخدام المشغل `--` على `myVar`. ```js -assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code)); +assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(__helpers.removeJSComments(code))); ``` لا يجب عليك تعديل الكود فوق التعليق المحدد. ```js -assert(/let myVar = 11;/.test(code)); +assert(/let myVar = 11;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md index 1a4f25f7689..53af25ec6fc 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md @@ -55,7 +55,7 @@ assert(typeof myDog === 'object' && myDog.tails === undefined); لا يجب عليك تعديل أسس `myDog`. ```js -assert(code.match(/"tails": 1/g).length > 0); +assert(__helpers.removeJSComments(code).match(/"tails": 1/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md index 87353a0f428..d4372c95b82 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md @@ -26,13 +26,13 @@ assert(quotient === 2.2); يجب عليك استخدام المشغل `/` لتقسيم 4.4 على 2 ```js -assert(/4\.40*\s*\/\s*2\.*0*/.test(code)); +assert(/4\.40*\s*\/\s*2\.*0*/.test(__helpers.removeJSComments(code))); ``` يجب تعيين متغير quotient مرة واحدة فقط ```js -assert(code.match(/quotient\s*=/g).length === 1); +assert(__helpers.removeJSComments(code).match(/quotient\s*=/g).length === 1); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md index b10b10c0f7a..48fc97a0bec 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md @@ -35,7 +35,7 @@ assert(quotient === 2); يجب عليك استخدام المشغل `/`. ```js -assert(/\d+\s*\/\s*\d+/.test(code)); +assert(/\d+\s*\/\s*\d+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md index 1df4b35efce..c39f411415a 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md @@ -36,7 +36,7 @@ I am a "double quoted" string inside "double quotes". يجب عليك استخدام علامة التنصيص المزدوجة (`"`) وتخرج العلامات أربع مرات مثل (`\"`). ```js -assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2); +assert(__helpers.removeJSComments(code).match(/\\"/g).length === 4 && __helpers.removeJSComments(code).match(/[^\\]"/g).length === 2); ``` يجب أن يحتوي المتغير `myStr` على المقطع النصي الآتي: `I am a "double quoted" string inside "double quotes".` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md index 1f5128d8db1..7532f20c849 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md @@ -29,8 +29,8 @@ console.log("Alan Peter".length); ```js assert( - code.match(/let lastNameLength = 0;/) && - code.match(/const lastName = "Lovelace";/) + __helpers.removeJSComments(code).match(/let lastNameLength = 0;/) && + __helpers.removeJSComments(code).match(/const lastName = "Lovelace";/) ); ``` @@ -43,7 +43,7 @@ assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8); يجب الحصول على الطول `lastName` باستخدام `.length` مثل: `lastName.length`. ```js -assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/)); +assert(__helpers.removeJSComments(code).match(/=\s*lastName\.length/g) && !__helpers.removeJSComments(code).match(/lastName\s*=\s*8/)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md index d4b9449fd10..183b2f51bc9 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md @@ -39,7 +39,7 @@ In mathematics, a number can be checked to be even or odd by checking the remain يجب تهيئة المتغير `remainder`. بمعنى آخر، يجب أن يكون initialized ```js -assert(/(const|let|var)\s+?remainder/.test(code)); +assert(/(const|let|var)\s+?remainder/.test(__helpers.removeJSComments(code))); ``` يجب أن تكون قيمة `remainder` تساوي `2` @@ -51,7 +51,7 @@ assert(remainder === 2); يجب عليك استخدام المشغل `%` ```js -assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code)); +assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md index cac2415e043..73182e1cfd7 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md @@ -36,7 +36,7 @@ assert((randomFraction() + '').match(/\./g)); يجب أن تستخدم `Math.random` لإنشاء رَقَم عشري عشوائي. ```js -assert(code.match(/Math\.random/g).length >= 0); +assert(__helpers.removeJSComments(code).match(/Math\.random/g).length >= 0); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md index 4d22d637db3..d2c36196745 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md @@ -46,22 +46,22 @@ assert( يجب عليك استخدام `Math.random` لتوليد رَقَم عشوائي. ```js -assert(code.match(/Math.random/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.random/g).length >= 1); ``` You should have multiplied the result of `Math.random` by 10 to make it a number in the range from zero to nine. ```js assert( - code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || - code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) + __helpers.removeJSComments(code).match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || + __helpers.removeJSComments(code).match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) ); ``` يجب عليك استخدام `Math.floor` لإزالة الجزء العشري من الرَّقَم. ```js -assert(code.match(/Math.floor/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.floor/g).length >= 1); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md index b34f2f2875a..54ca4671b74 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md @@ -49,10 +49,10 @@ assert(randomRange(0, 1) % 1 === 0); assert( (function () { if ( - code.match(/myMax/g).length > 1 && - code.match(/myMin/g).length > 2 && - code.match(/Math.floor/g) && - code.match(/Math.random/g) + __helpers.removeJSComments(code).match(/myMax/g).length > 1 && + __helpers.removeJSComments(code).match(/myMin/g).length > 2 && + __helpers.removeJSComments(code).match(/Math.floor/g) && + __helpers.removeJSComments(code).match(/Math.random/g) ) { return true; } else { diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md index ac950cf1016..04633056a1e 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md @@ -36,7 +36,7 @@ assert(myGlobal === 10); يجب إعلان `myGlobal` باستعمال `let` أو `const` ```js -assert(/(let|const)\s+myGlobal/.test(code)); +assert(/(let|const)\s+myGlobal/.test(__helpers.removeJSComments(code))); ``` يجب أن يكون `oopsGlobal` متغير شامل وأن يساوي `5` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md index 939e2deb792..3fb4a9a9c9a 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md @@ -45,7 +45,7 @@ assert(myOutfit() === 'sweater'); لا يجب عليك تغيير التعبير المنتج (return statement). ```js -assert(/return outerWear/.test(code)); +assert(/return outerWear/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md index d5cea9e9c23..9116c1c1641 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md @@ -39,20 +39,20 @@ assert(myVar === 88); ```js assert( - /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(code) + /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(__helpers.removeJSComments(code)) ); ``` يجب عليك استخدام المشغل `++`. ```js -assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code)); +assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(__helpers.removeJSComments(code))); ``` لا يجب عليك تعديل الكود فوق التعليق المحدد. ```js -assert(/let myVar = 87;/.test(code)); +assert(/let myVar = 87;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md index 6a1b80fc4f9..0667b1b1113 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md @@ -26,7 +26,7 @@ var myVar = 0; يجب عليك تهيئة `a` بقيمة `9`. ```js -assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code)); +assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md index 17a806de84d..058bc659dbe 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md @@ -30,20 +30,20 @@ if (num > 15) { يجب أن يكون لديك اثنين من تعبيرات `else` في الأقل ```js -assert(code.match(/else/g).length > 1); +assert(__helpers.removeJSComments(code).match(/else/g).length > 1); ``` يجب أن يكون لديك اثنين من تعبيرات `if` في الأقل ```js -assert(code.match(/if/g).length > 1); +assert(__helpers.removeJSComments(code).match(/if/g).length > 1); ``` يجب أن يكون لديك قوسين مقرونتين (curly braces) لكل `if else` لكتابه الكود بداخلها. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/ ) ); diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md index a3aed65e18a..be6e4bf3a2f 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md @@ -28,13 +28,13 @@ if (num > 10) { يجب أن يكون لديك عبارة `if` واحدة فقط في المحرر ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` يجب عليك استخدام عبارة `else` ```js -assert(/else/g.test(code)); +assert(/else/g.test(__helpers.removeJSComments(code))); ``` يجب أن تنتج `testElse(4)` المقطع النصي `5 or Smaller` @@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5'); لا يجب عليك تعديل الكود فوق التعليق المحدد. ```js -assert(/let result = "";/.test(code) && /return result;/.test(code)); +assert(/let result = "";/.test(__helpers.removeJSComments(code)) && /return result;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md index ab02052f5b7..be0613a39d9 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md @@ -32,7 +32,7 @@ for (let i = 0; i < 10; i += 2) { يجب أن تستخدم حلقة `for`. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` يجب أن يساوي `myArray` قيمة `[1, 3, 5, 7, 9]`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md index 052d3c437e7..f93145932f8 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md @@ -30,7 +30,7 @@ for (let i = 0; i < arr.length; i++) { يجب إعلان وتهيئة `total` بقيمة 0. ```js -assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); ``` يجب أن يساوي `total` قيمة 20. @@ -42,13 +42,13 @@ assert(total === 20); يجب عليك استخدام حلقة `for` للتكرار عبر `myArr`. ```js -assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code)); +assert(/for\s*\(/g.test(__helpers.removeJSComments(code)) && /myArr\s*\[/g.test(__helpers.removeJSComments(code))); ``` لا يجب عليك محاولة تعيين القيمة 20 إلى `total` قاصدًا. ```js -assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm)); +assert(!__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/total[=+-]0*[1-9]+/gm)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md index 7ca0dacd2b3..19b2b78807b 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md @@ -56,7 +56,7 @@ do { يجب أن تستخدم حلقة `do...while` لهذا التمرين. ```js -assert(code.match(/do/g)); +assert(__helpers.removeJSComments(code).match(/do/g)); ``` يجب أن يساوي `myArray` قيمة `[10]`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md index 6f9323f4a62..6b28ab0ad69 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md @@ -44,7 +44,7 @@ for (let i = 0; i < 5; i++) { يجب أن تستخدم حلقة `for`. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` يجب أن يساوي `myArray` قيمة `[1, 2, 3, 4, 5]`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md index 61bedb3e28f..fc6e191f561 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md @@ -36,7 +36,7 @@ while (i < 5) { يجب أن تستخدم حلقة `while`. ```js -assert(code.match(/while/g)); +assert(__helpers.removeJSComments(code).match(/while/g)); ``` يجب أن يساوي `myArray` قيمة `[5, 4, 3, 2, 1, 0]`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index 582c74d59bc..49ee8f4ec82 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -48,7 +48,7 @@ assert.throws(declared, ReferenceError); ```js assert( /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( - __helpers.removeWhiteSpace(code) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)) ) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md index e4daa7c5615..c36ad330ecb 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md @@ -47,7 +47,7 @@ assert( يجب عليك استخدام `pop()` على `myArray`. ```js -assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code)); +assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(__helpers.removeJSComments(code))); ``` يجب أن يحتوي `removedFromMyArray` على `["cat", 2]` فقط. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md index 1a08e71c6fa..0365565d0b0 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md @@ -52,7 +52,7 @@ assert( ```js assert( (function () { - if (code.match(/myArray\[0\]\s*=\s*/g)) { + if (__helpers.removeJSComments(code).match(/myArray\[0\]\s*=\s*/g)) { return true; } else { return false; diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md index 206ad63798b..9c033336862 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md @@ -94,13 +94,13 @@ assert(sequentialSizes(9) === 'High'); يجب ألا تستخدم أي عبارات `if` أو `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` يجب أن يكون لديك تسع عبارات `case` ```js -assert(code.match(/case/g).length === 9); +assert(__helpers.removeJSComments(code).match(/case/g).length === 9); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md index 3ae00f4a9c9..022a5fc5703 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md @@ -28,7 +28,7 @@ assert(product === 5.0); يجب عليك استخدام المشغل `*` ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md index 56eca97df15..8e070818e32 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md @@ -36,7 +36,7 @@ assert(product === 80); يجب عليك استخدام المشغل `*`. ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md index b8ff73b450e..efee7bfee8f 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md @@ -60,7 +60,7 @@ assert(logOutput == 16); ```js assert( /functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test( - code.replace(/\s/g, '') + __helpers.removeJSComments(code).replace(/\s/g, '') ) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md index 1dbeb107e21..361c446bb0d 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md @@ -47,7 +47,7 @@ assert(compareEquality('20', 20) === 'Not Equal'); يجب عليك استخدام المشغل `===` ```js -assert(code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index 58e825469e9..3d6e7b583fa 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -47,7 +47,7 @@ const badStr = 'Finn responds, "Let's go!"'; ```js assert( - !/\\/g.test(code) && + !/\\/g.test(__helpers.removeJSComments(code)) && myStr.match( '\\s*\\s*Link\\s*\\s*' ) @@ -57,7 +57,7 @@ assert( يجب أن يكون لديك علامتا اقتباس مفردتان `'` وأربع علامات اقتباس مزدوجة `"`. ```js -assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2); +assert(__helpers.removeJSComments(code).match(/"/g).length === 4 && __helpers.removeJSComments(code).match(/'/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index 46f21360043..2b9234c268d 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,7 +66,7 @@ assert.equal(sum([2, 3, 4, 5], 3), 9); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md index 217fd1f8388..66b3f4dce25 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md @@ -45,19 +45,19 @@ switch (val) { لا يجب عليك استخدام أي `else` في أي مكان في المحرر ```js -assert(!/else/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code))); ``` لا يجب عليك استخدام أي `if` في أي مكان في المحرر ```js -assert(!/if/g.test(code)); +assert(!/if/g.test(__helpers.removeJSComments(code))); ``` يجب أن يكون لديك على الأقل ٤ عبارات `break` ```js -assert(code.match(/break/g).length >= 4); +assert(__helpers.removeJSComments(code).match(/break/g).length >= 4); ``` `chainToSwitch("bob")` should return the string `Marley` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md index 54bde000220..7b33f352033 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md @@ -52,7 +52,7 @@ assert(isLess(15, 10) === false); يجب ألا تستخدم أي عبارات `if` أو `else` ```js -assert(!/if|else/g.test(code)); +assert(!/if|else/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md index 7c40c4f9c09..e4a5bbe2533 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md @@ -63,13 +63,13 @@ assert(caseInSwitch(4) === 'delta'); يجب ألا تستخدم أي عبارات `if` أو `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` يجب أن يكون لديك على الأقل ٣ عبارات `break` ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md index 2502ed5accb..02068d6b747 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md @@ -35,7 +35,7 @@ myVar = 5; لا يجب عليك تعديل الكود فوق التعليق المحدد. ```js -assert(/var a;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code))); ``` يجب أن يحتوي `a` قيمة 7. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md index 08a01e03ac0..0b6dbc045a9 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md @@ -35,7 +35,7 @@ assert(difference === 12); يجب أن تطرح رَقَم واحد فقط من `45`. ```js -assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code))); +assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md index 06234850a23..7ca68b9bd0c 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md @@ -40,7 +40,7 @@ assert(myStr === 'Hello World'); لا يجب عليك تعديل الكود فوق التعليق المحدد. ```js -assert(/myStr = "Jello World"/.test(code)); +assert(/myStr = "Jello World"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md index 29ec1dd4870..4329f4796e6 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md @@ -56,19 +56,19 @@ assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000); يجب أن يستخدم `studlyCapVar` حالة camelCase في كل من أقسام الإعلان والتخصيص. ```js -assert(code.match(/studlyCapVar/g).length === 2); +assert(__helpers.removeJSComments(code).match(/studlyCapVar/g).length === 2); ``` يجب أن يستخدم `properCamelCase` حالة camelCase في كل من أقسام التعريف والتخصيص. ```js -assert(code.match(/properCamelCase/g).length === 2); +assert(__helpers.removeJSComments(code).match(/properCamelCase/g).length === 2); ``` يجب أن يستخدم `titleCaseOver` حالة camelCase في كل من أقسام التعريف و التخصيص. ```js -assert(code.match(/titleCaseOver/g).length === 2); +assert(__helpers.removeJSComments(code).match(/titleCaseOver/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index d29ad8efa70..b86bb414d6e 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -39,9 +39,9 @@ assert(!/undefined/.test(c) && c === 'I am a String!'); ```js assert( - /a = a \+ 1;/.test(code) && - /b = b \+ 5;/.test(code) && - /c = c \+ " String!";/.test(code) + /a = a \+ 1;/.test(__helpers.removeJSComments(code)) && + /b = b \+ 5;/.test(__helpers.removeJSComments(code)) && + /c = c \+ " String!";/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md index 9c4f3faf517..6eff47199b9 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md @@ -39,7 +39,7 @@ assert(/happy coder/gi.test(myDog.name)); لا يجب عليك تعديل تعريف `myDog`. ```js -assert(/"name": "Coder"/.test(code)); +assert(/"name": "Coder"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md index 2f4ce5fd581..69b63e0182c 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md @@ -41,7 +41,7 @@ assert(firstLetterOfLastName === 'L'); يجب عليك استخدام علامات الأقواس. ```js -assert(code.match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md index 858985a0864..1fe4f9b569f 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(lastLetterOfLastName === 'e'); يجب عليك استخدام `.length` للحصول على آخر حرف. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md index db775becfc8..e450d886f22 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md @@ -39,7 +39,7 @@ assert(thirdLetterOfLastName === 'v'); يجب عليك استخدام علامات الأقواس. ```js -assert(code.match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md index 06ccc4f2a87..1fe37f3bcb0 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(secondToLastLetterOfLastName === 'c'); يجب عليك استخدام `.length` للحصول على الحرف الثاني إلى الأخير. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md index c092d0dc54d..a09b822a847 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md @@ -54,7 +54,7 @@ function findGreaterOrEqual(a, b) { يجب أن يستخدم `checkSign` مشغلين مشروطين متعددين ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(__helpers.removeJSComments(code))); ``` يجب أن ينتج `checkSign(10)` مقطع `positive`. هذا يعني أن الكتابة بالأحرف الكبيرة (capitalization) شيئ مؤثر diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index 83e94e1dbc6..99a54801608 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,7 +59,7 @@ assert.deepStrictEqual(countdown(5), [5, 4, 3, 2, 1]); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index 833632939db..57317a107d3 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,7 +26,7 @@ assert(Array.isArray(rangeOfNumbers(5, 10))); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index b3b080d7a84..c3327d59846 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -42,7 +42,7 @@ function findGreater(a, b) { يجب أن يستخدم `checkEqual` المشغل مشروط ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(__helpers.removeJSComments(code))); ``` يجب أن ينتج `checkEqual(1, 2)` مقطع الآتي: `Not Equal` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md index d8d905eb38b..87dbcdcd385 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md @@ -34,7 +34,7 @@ const a = parseInt("11", 2); يجب أن يستخدم `convertToInteger` وظيفة `parseInt()` ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` يجب أن ينتج `convertToInteger("10011")` رقماً diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md index 0cd44b5cfa0..c2b96211f2a 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md @@ -26,7 +26,7 @@ const a = parseInt("007"); يجب أن يستخدم `convertToInteger` وظيفة `parseInt()` ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` يجب أن ينتج `convertToInteger("56")` رقماً diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md index 60b437ce466..f178a570d6f 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md @@ -83,14 +83,14 @@ assert(typeof phoneticLookup('') === 'undefined'); لا يجب عليك تعديل تعبير `return` ```js -assert(code.match(/return\sresult;/)); +assert(__helpers.removeJSComments(code).match(/return\sresult;/)); ``` لا يجب عليك استخدام تعبيرات `case`, أو `switch`, أو `if` ```js assert( - !/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) + !/case|switch|if/g.test(__helpers.removeJSComments(code).replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md index 2316dd71518..a52e96a0d13 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md @@ -53,7 +53,7 @@ assert( يجب ألا تستخدم القيم `dog` او `ran` او `big` او `quickly` لإنشاء `wordBlanks`. ```js -const newCode = removeAssignments(code); +const newCode = removeAssignments(__helpers.removeJSComments(code)); assert( !/dog/.test(newCode) && !/ran/.test(newCode) && diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md index f8cc559c288..8e38e7611fb 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md @@ -50,7 +50,7 @@ assert(testConsole()); ```js const functionStr = reusableFunction && __helpers.removeWhiteSpace(reusableFunction.toString()); -const codeWithoutFunction = __helpers.removeWhiteSpace(code).replace(/reusableFunction\(\)\{/g, ''); +const codeWithoutFunction = __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).replace(/reusableFunction\(\)\{/g, ''); assert(/reusableFunction\(\)/.test(codeWithoutFunction)); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md index d112945a53d..8fcd30d9a1a 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md @@ -25,7 +25,7 @@ assert(power == 8); يجب أن يستخدم كودك الترتيب الصحيح لمعطيات (arguments) لتفعيل الوظيفة (funciton) المسمى `raiseToPower`. ```js -assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); +assert(__helpers.removeJSComments(code).match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md index 29385b2317a..f124bfeb126 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md @@ -37,7 +37,7 @@ assert(result == 9); يجب أن يفعيل كودك وظيفة `getNine`. ```js -assert(code.match(/getNine\(\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/getNine\(\)/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md index 9027b7de5aa..e1372e71018 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md @@ -27,25 +27,25 @@ assert(netWorkingCapital === 2); لا ينبغي أن تكون هناك استخدامات للمتغيرات تملى بشكل خاطئ في الكود. ```js -assert(!code.match(/recievables/g)); +assert(!__helpers.removeJSComments(code).match(/recievables/g)); ``` يجب إعلان متغير باسم `receivables` واستخدامه بشكل صحيح في الكود. ```js -assert(code.match(/receivables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/receivables/g).length == 2); ``` لا ينبغي أن تكون هناك استخدامات للمتغيرات تملى بشكل خاطئ في الكود. ```js -assert(!code.match(/payable;/g)); +assert(!__helpers.removeJSComments(code).match(/payable;/g)); ``` يجب إعلان متغير باسم `payables` واستخدامه بشكل صحيح في الكود. ```js -assert(code.match(/payables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/payables/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index d465c870265..f63e8e0560f 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -37,13 +37,13 @@ const allSameQuotes = 'I\'ve had a perfectly wonderful evening, but this wasn\'t يجب أن يصلح الكود الخاص بك علامات التنصيص حول قيمة `href` وهي `#Home` إما بتغييرها أو معالجتها برمز التخريج (\). ```js -assert(code.match(//g)); +assert(__helpers.removeJSComments(code).match(//g)); ``` يجب أن يحافظ الكود الخاص بك على علامات التنصيص المزدوجة حول المقطع كُلََّه. ```js -assert(code.match(/"

.*?<\/p>";/g)); +assert(__helpers.removeJSComments(code).match(/"

.*?<\/p>";/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md index 3c81d537b7c..0aca4cc9d99 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md @@ -37,25 +37,25 @@ for (let k = 0; k < len; k++) { يجب أن يقوم الكود الخاص بك بتعيين الشرط الأولي للحلقة (loop) بحيث يبدأ من الترتيب الأول. ```js -assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?=\s*?0\s*?;/g).length == 1); ``` يجب أن يقوم الكود الخاص بك بإصلاح الشرط الأولي للحلقة بحيث يبدأ الترتيب من 0. ```js -assert(!code.match(/i\s?=\s*?1\s*?;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s?=\s*?1\s*?;/g)); ``` يجب أن يضبط الكود الخاص بك الشرط الطرفي (terminal condition) للحلقة بحيث يتوقف عند الترتيب الأخير. ```js -assert(code.match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); ``` يجب أن يصلح الكود الخاص بك الشرط الطرفي للحلقة بحيث يتوقف عند 1 قبل الطول. ```js -assert(!code.match(/i\s*?<=\s*?len;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?<=\s*?len;/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md index 5f122ece22f..d7b0239ca14 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md @@ -21,7 +21,7 @@ dashedName: catch-unclosed-parentheses-brackets-braces-and-quotes يجب أن يصلح الكود الخاص بك القطعة المفقودة من القائمة. ```js -assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); +assert(__helpers.removeJSComments(code).match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); ``` يجب أن يصلح الكود الخاص بك القطعة المفقودة من `.reduce()`. يجب أن يظهر إخراج وحدة التحكم أن `Sum of array values is: 6`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md index b5237232346..62c32b17615 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md @@ -43,7 +43,7 @@ assert(result == 'Not equal!'); يجب أن يستخدم الشرط إما `==` أو `===` لاختبار المساواة. ```js -assert(code.match(/x\s*?===?\s*?y/g)); +assert(__helpers.removeJSComments(code).match(/x\s*?===?\s*?y/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md index 5bb8e3e75f0..dab90c08d49 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md @@ -31,13 +31,13 @@ function loopy() { الكود الخاص بك يجب أن يغير مشغل المقارنة في حالة الشرط الانتهائي (الجزء الوسط) من حلقة `for`. ```js -assert(code.match(/i\s*?<=\s*?4;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?<=\s*?4;/g).length == 1); ``` الكود الخاص بك يجب أن يصلح مشغل المقارنة (comparison operator) في حالة الشرط الانتهائي للحلقة (terminal condition of the loop). ```js -assert(!code.match(/i\s*?!=\s*?4;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?!=\s*?4;/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index ea9679fa268..8a47474fa81 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -23,7 +23,7 @@ dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-c يجب عليك استخدام `console.log()` لطباعة `output` المتغير. ```js -assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/console\.log\(output\)/)); ``` يجب عليك استخدام `console.clear()` لمسح وحدة تحكم المتصفح. @@ -31,7 +31,7 @@ assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console.clear\(\)/) ); ``` @@ -41,7 +41,7 @@ assert( ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console\.log\(output\)[\s\S]*console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md index 644a4fd8659..b5dd83c2d4f 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md @@ -29,7 +29,7 @@ console.log('Hello world!'); يجب أن يستخدم الكود الخاص بك `console.log()` للتحقق من قيمة المتغير `a`. ```js -assert(code.match(/console\.log\(a\)/g)); +assert(__helpers.removeJSComments(code).match(/console\.log\(a\)/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md index 8555dd002d9..f2db8de0dd5 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md @@ -32,19 +32,19 @@ console.log(typeof {}); الكود الخاص بك يجب أن يستخدم `typeof` في تعبيرات `console.log()` للتحقق من نوع المتغيرات. ```js -assert(code.match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); ``` الكود الخاص بك يجب أن يستخدم `typeof` للتحقق من نوع المتغير `seven`. ```js -assert(code.match(/typeof[\( ]seven\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]seven\)?/g)); ``` الكود الخاص بك يجب أن يستخدم `typeof` للتحقق من نوع المتغير `three`. ```js -assert(code.match(/typeof[\( ]three\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]three\)?/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index 42c9c370f03..4b8d7465488 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -87,13 +87,13 @@ console.log(i); يجب ألا تكون `var` موجودة في الكود. ```js -assert(!code.match(/var/g)); +assert(!__helpers.removeJSComments(code).match(/var/g)); ``` يجب أن يساوي المتغير `i` المعلن عنه في `if` المقطع النصي `block scope`. ```js -assert(code.match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); +assert(__helpers.removeJSComments(code).match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); ``` يجب أن ينتج `checkScope()` مقطع `function scope` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index 489ce5d4552..0c3d333470b 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,7 +32,7 @@ const myPromise = new Promise((resolve, reject) => { ```js assert( - code.match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) ); ``` @@ -40,7 +40,7 @@ assert( ```js assert( - code.match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md index f0d03e09830..087aecfa4ee 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md @@ -32,7 +32,7 @@ assert(makeServerRequest instanceof Promise); ```js assert( - code.match( + __helpers.removeJSComments(code).match( /Promise\s*\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g ) ); diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md index dbb3efb9de0..f5f035c0674 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md @@ -25,14 +25,14 @@ dashedName: create-a-module-script يجب عليك إنشاء علامة `script`. ```js -assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); +assert(__helpers.removeJSComments(code).match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); ``` يجب أن يحتوي علامة `script` على سمة `type` بقيمة `module`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g ) ); @@ -42,7 +42,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g ) ); diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md index dbe392ddf58..da1a64afc60 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md @@ -38,7 +38,7 @@ export default function(x, y) { ```js assert( - code.match( + __helpers.removeJSComments(code).match( /export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g ) ); diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md index 8cfe577f000..5ef4717108e 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md @@ -75,7 +75,7 @@ assert.match(code, /(`.*\${.*}.*`)/); ينبغي استخدام iterator. ```js -assert(code.match(/for|map|reduce|forEach|while/)); +assert(__helpers.removeJSComments(code).match(/for|map|reduce|forEach|while/)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md index a93e90a44eb..a3a232926a7 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md @@ -34,7 +34,7 @@ myPromise.then(result => { ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.then\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.then\(/g) ); ``` @@ -50,7 +50,7 @@ assert(resultIsParameter); assert( resultIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.then\(.*?result.*?console.log\(result\).*?\)/) ); ``` @@ -60,7 +60,7 @@ assert( ## --after-user-code-- ```js -const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(code)); +const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md index 33cf40190b7..801e29766de 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md @@ -28,7 +28,7 @@ myPromise.catch(error => { ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.catch\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.catch\(/g) ); ``` @@ -44,7 +44,7 @@ assert(errorIsParameter); assert( errorIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.catch\(.*?error.*?console.log\(error\).*?\)/) ); ``` @@ -54,7 +54,7 @@ assert( ## --after-user-code-- ```js -const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(code)); +const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md index c2e20d2b64b..21fe43142f1 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md @@ -25,7 +25,7 @@ import add from "./math_functions.js"; يجب عليك استيراد `subtract` بشكل صحيح من `math_functions.js`. ```js -assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); +assert(__helpers.removeJSComments(code).match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md index ed4e825f649..4c7921a1be9 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md @@ -36,19 +36,19 @@ console.log(s); لا ينبغي أن تستبدل كلمة `const`. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `s` يجب أن يكون متغير ثابت (باستخدام `const`). ```js -assert(code.match(/const\s+s/g)); +assert(__helpers.removeJSComments(code).match(/const\s+s/g)); ``` لا يجب عليك تغيير إعلان القائمة (array) الأصلي. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g )); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md index 95b07292cb4..c7689a80dfc 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md @@ -34,19 +34,19 @@ console.log(obj); لا ينبغي أن تستبدل كلمة `const`. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `MATH_CONSTANTS` يجب أن يكون متغير ثابت (باستخدام `const`). ```js -assert(code.match(/const\s+MATH_CONSTANTS/g)); +assert(__helpers.removeJSComments(code).match(/const\s+MATH_CONSTANTS/g)); ``` لا يجب عليك تغيير الإعلان الأصلي لـ `MATH_CONSTANTS`. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g )); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md index 9736be2f19e..11ce8aad80d 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md @@ -32,7 +32,7 @@ import { add, subtract } from './math_functions.js'; ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); @@ -42,7 +42,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index 62bf54416df..3707a3f0260 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -44,7 +44,7 @@ assert(increment(5) === 6); يجب استخدام قيمة `1` للوسائط الافتراضية (default parameter) في `value`. ```js -assert(code.match(/value\s*=\s*1/g)); +assert(__helpers.removeJSComments(code).match(/value\s*=\s*1/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md index b7bd92f124d..8c31e1142ab 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md @@ -31,7 +31,7 @@ myMathModule.subtract(5,3); ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g ) ); diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index 9dba2c45ed4..209df343980 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -66,7 +66,7 @@ assert( يجب استخدام مصطلح `class`. ```js -assert(code.match(/class/g)); +assert(__helpers.removeJSComments(code).match(/class/g)); ``` يجب أن يمثل `Vegetable`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md index 0710d83fe2b..b877a0d9bed 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md @@ -51,7 +51,7 @@ assert(b === 8); يجب عليك استخدام array destructuring لمبادلة `a` و `b`. ```js -assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code)); +assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index 084e7c9f464..d63b105cf19 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -43,8 +43,8 @@ const { johnDoe: { age: userAge, email: userEmail }} = user; ```js assert( - !code.match(/lowToday = LOCAL_FORECAST\.today\.low/g) && - !code.match(/highToday = LOCAL_FORECAST\.today.high/g) + !__helpers.removeJSComments(code).match(/lowToday = LOCAL_FORECAST\.today\.low/g) && + !__helpers.removeJSComments(code).match(/highToday = LOCAL_FORECAST\.today.high/g) ); ``` @@ -52,7 +52,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(low\s*:\s*lowToday[^}]*|[^,]*,\s*low\s*:\s*lowToday\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); @@ -62,7 +62,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday,?\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index 9c5d0e5dca1..9e926493ca8 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -34,8 +34,8 @@ const { name: userName, age: userAge } = user; ```js assert( - !code.match(/highToday = HIGH_TEMPERATURES\.today/g) && - !code.match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) + !__helpers.removeJSComments(code).match(/highToday = HIGH_TEMPERATURES\.today/g) && + !__helpers.removeJSComments(code).match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) ); ``` @@ -43,7 +43,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(today\s*:\s*highToday[^}]*|[^,]*,\s*today\s*:\s*highToday\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); @@ -53,7 +53,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(tomorrow\s*:\s*highTomorrow[^}]*|[^,]*,\s*tomorrow\s*:\s*highTomorrow\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 0f8968774f6..555dfe038a9 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,7 +43,7 @@ const { name, age } = user; ```js assert( - !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !__helpers.removeJSComments(code).match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -51,7 +51,7 @@ assert( ```js assert( - code.match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` @@ -59,7 +59,7 @@ assert( ```js assert( - code.match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md index d07fda10ba0..397751dccf6 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md @@ -50,13 +50,13 @@ assert(half(stats) === 28.015); وينبغي استخدام الـ Destructuring. ```js -assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/half=\({\w+,\w+}\)/)); ``` ينبغي استخدام وسيط التركيبي (Destructured parameter). ```js -assert(!code.match(/stats\.max|stats\.min/)); +assert(!__helpers.removeJSComments(code).match(/stats\.max|stats\.min/)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index 1d8c79e43a4..397aa32ca03 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -47,7 +47,7 @@ assert.deepEqual(_testArr, [1, 2, 3, 4, 5]) `Array.slice()` لا ينبغي استخدامه. ```js -assert(!code.match(/\.\s*slice\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*slice\s*\(/)); ``` You should use the rest syntax. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md index 97b51e62416..fb7fcf305d7 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md @@ -42,7 +42,7 @@ export { add, subtract }; ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+uppercaseString|export\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)})/g ) ); @@ -52,7 +52,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+lowercaseString|export\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)})/g ) ); diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md index cada1dfdc73..b581a6c8223 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md @@ -57,7 +57,7 @@ assert(sum() === 0); يجب أن تكون `sum` وظيفة السهم, التي تستخدم تشكيل وسيط rest الآتي (`...`) على وسيط `args`. ```js -assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/sum=\(\.\.\.args\)=>/)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md index 7cf7ab2d6c6..1d5405b7fef 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md @@ -55,7 +55,7 @@ assert(arr2.every((v, i) => v === arr1[i]) && arr2.length); `...` spread operator should be used to duplicate `arr1`. ```js -assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); +assert(__helpers.removeJSComments(code).match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); ``` `arr2` should remain unchanged when `arr1` is changed. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md index dccae5e2440..91b90cbbe0c 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md @@ -54,7 +54,7 @@ assert.match(code, /const\s+myConcat/g); ```js assert( - /myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) && + /myConcat=\(\w+,\w+\)=>/.test(__helpers.removeJSComments(code).replace(/\s/g, '')) && typeof myConcat === 'function' ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index fca5b33a36a..65ab8c8aa0b 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,14 +39,14 @@ const person = { وينبغي عدم استخدام الـ function expression التقليدي. ```js -assert(!code.match(/function/)); +assert(!__helpers.removeJSComments(code).match(/function/)); ``` يجب أن تكون `setGear` وظيفة معلنا (declarative function). ```js assert( - typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/) + typeof bicycle.setGear === 'function' && __helpers.removeJSComments(code).match(/setGear\s*\(.+\)\s*\{/) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md index 10d42464020..523117063e6 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md @@ -43,7 +43,7 @@ assert.deepEqual( يجب أن لا يستخدم الكود `key:value`. ```js -assert(!code.match(/:/g)) +assert(!__helpers.removeJSComments(code).match(/:/g)) ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md index abe219f0563..6e0579d9598 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md @@ -30,13 +30,13 @@ arr.push(4, 5, 6); يجب أن يستخدم الكود الخاص بك دالة `concat`. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` يجب ألا يستخدم الكود الخاص بك دالة `push`. ```js -assert(!code.match(/\.?[\s\S]*?push/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?push/g)); ``` يجب ألا تتغير مصفوفة `first`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md index 91ca7918cf6..de7d1684695 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md @@ -31,7 +31,7 @@ dashedName: apply-functional-programming-to-convert-strings-to-url-slugs لا ينبغي أن يستخدم الكود الخاص بك `replace` لهذا التحدي. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `urlSlug("Winter Is Coming")` يجب أن يعيد السلسلة `winter-is-coming`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md index c4730c8e76e..6aed1382d0f 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md @@ -27,13 +27,13 @@ const str = arr.join(" "); يجب أن يستخدم الكود الخاص بك دالة `join`. ```js -assert(code.match(/\.join/g)); +assert(__helpers.removeJSComments(code).match(/\.join/g)); ``` يجب ألا يستخدم الكود الخاص بك دالة `replace`. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `sentensify("May-the-force-be-with-you")` يجب أن يعيد string. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md index 54929ec6016..6ed44b55379 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md @@ -25,7 +25,7 @@ dashedName: combine-two-arrays-using-the-concat-method يجب أن يستخدم الكود الخاص بك دالة `concat`. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` يجب ألا تتغير مصفوفة `first`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md index 824a00172da..e4b0b66412d 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md @@ -47,7 +47,7 @@ assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_ يجب ألا يستخدم كودك الطريقة (method) المسمى `map`. ```js -assert(!code.match(/\.?[\s\S]*?map/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?map/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md index 07ac65a4007..806f88f68b3 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md @@ -43,7 +43,7 @@ assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFi يجب ألا يستخدم كودك الطريقة (method) المسمى `filter`. ```js -assert(!code.match(/\.?[\s\S]*?filter/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?filter/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md index e642e513ccd..8168680dc5f 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md @@ -77,7 +77,7 @@ assert(add(11)(22)(33) === 66); يجب أن يتضمن الكود الخاص بك بيانا نهائيا يرجع `x + y + z`. ```js -assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); +assert(__helpers.removeJSComments(code).match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md index 0e8fb9f65b6..7de5e8cd9b3 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md @@ -30,13 +30,13 @@ cities.splice(3, 1); يجب أن يستخدم كودك طريقة `slice`. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` يجب ألا يستخدم كودك طريقة `splice`. ```js -assert(!code.match(/\.?[\s\S]*?splice/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?splice/g)); ``` You should not mutate the original array passed to the function. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md index e4377dd2e60..1aa6b691bad 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md @@ -28,7 +28,7 @@ const newArray = arr.slice(1, 3); يجب أن يستخدم الكود الخاص بك دالة `slice`. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` متغير `inputAnim` يجب ألا يتغير. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md index b8d6118e5fa..2da4b215d53 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md @@ -47,7 +47,7 @@ reverseAlpha(['l', 'h', 'z', 'b', 's']); يجب أن يستخدم الكود الخاص بك دالة `sort`. ```js -assert(code.match(/\.sort/g)); +assert(__helpers.removeJSComments(code).match(/\.sort/g)); ``` `alphabeticalOrder(["a", "d", "c", "a", "z", "g"])` يجب ان تعيد `["a", "a", "c", "d", "g", "z"]`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md index bc2734eea03..f388cf859ec 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md @@ -33,7 +33,7 @@ const byDigits = otherString.split(/\d/); يجب أن يستخدم الكود الخاص بك دالة `split`. ```js -assert(code.match(/\.split/g)); +assert(__helpers.removeJSComments(code).match(/\.split/g)); ``` `splitify("Hello World,I-am code")` يجب ان يعيد `["Hello", "World", "I", "am", "code"]`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index d28d5081e35..336000b015f 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), `for` و `while` و `forEach` يجب عدم استخدامها. ```js -assert(!code.match(/for|while|forEach/g)); +assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ``` `map` او `filter` او `reduce` ينبغي استخدامها. @@ -36,7 +36,7 @@ assert(!code.match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md index 77ae3abd24a..5965c44c883 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md @@ -31,7 +31,7 @@ numbers.every(function(currentValue) { يجب أن يستخدم الكود الخاص بك دالة `every`. ```js -assert(code.match(/\.every/g)); +assert(__helpers.removeJSComments(code).match(/\.every/g)); ``` `checkPositive([1, 2, 3, -4, 5])` يجب أن ترجع `false`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md index bfe8d4135a5..48e6c343e5e 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md @@ -46,13 +46,13 @@ assert( يجب أن يستخدم الكود الخاص بك دالة `filter`. ```js -assert(code.match(/\s*\.\s*filter/g)); +assert(__helpers.removeJSComments(code).match(/\s*\.\s*filter/g)); ``` يجب ألا يستخدم الكود الخاص بك حلقة `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` `filteredList` يجب أن يساوي `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"}, {"title": "Batman Begins", "rating": "8.3"}]`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 788d4ee7593..f4512ec906d 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,13 +52,13 @@ assert( يجب ألا يستخدم الكود الخاص بك حلقة `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); ``` يجب أن يستخدم الكود الخاص بك دالة `map`. ```js -assert(code.match(/\.map/g)); +assert(__helpers.removeJSComments(code).match(/\.map/g)); ``` `ratings` يجب أن يساوي `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"},{"title": "Batman Begins", "rating": "8.3"}, {"title": "Avatar", "rating": "7.9"}]`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md index 7d563d8038c..606e387cb24 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md @@ -66,7 +66,7 @@ assert( يجب أن يستخدم الكود الخاص بك دالة `reduce`. ```js -assert(code.match(/\.reduce/g)); +assert(__helpers.removeJSComments(code).match(/\.reduce/g)); ``` The `getRating(watchList)` يجب أن يساوي 8.675. @@ -78,7 +78,7 @@ assert(getRating(watchList) === 8.675); يجب ألا يستخدم الكود الخاص بك حلقة `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` يجب أن يعيد الكود الإخراج الصحيح بعد تعديل كائن `watchList`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md index 82479d6f995..d850cccb8a1 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md @@ -31,7 +31,7 @@ numbers.some(function(currentValue) { يجب أن يستخدم الكود الخاص بك دالة `some`. ```js -assert(code.match(/\.some/g)); +assert(__helpers.removeJSComments(code).match(/\.some/g)); ``` `checkPositive([1, 2, 3, -4, 5])` يجب أن يرجع `true`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md index 8dd6d0dcc28..b6309c9604a 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md @@ -39,7 +39,7 @@ assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4]); يجب ألا يستخدم الحل الخاص بك الوظائف `Array.prototype.flat()` أو `Array.prototype.flatMap()`. ```js -assert(!code.match(/\.\s*flat\s*\(/) && !code.match(/\.\s*flatMap\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*flat\s*\(/) && !__helpers.removeJSComments(code).match(/\.\s*flatMap\s*\(/)); ``` وينبغي عدم استخدام المتغيرات العالمية (Global variables). diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md index 05c0d16a0ad..ed3b2a29abb 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md @@ -49,7 +49,7 @@ Bird.prototype = { `Dog.prototype` يجب أن يتم تعيينه إلى object جديد. ```js -assert(/Dog\.prototype\s*?=\s*?{/.test(code)); +assert(/Dog\.prototype\s*?=\s*?{/.test(__helpers.removeJSComments(code))); ``` `Dog.prototype` يجب أن تحتوي على الخاصية `numLegs`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md index 65e3159bfb7..882b4c28200 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md @@ -61,7 +61,7 @@ assert(typeof beagle !== 'undefined'); ```js assert( /(let|const|var)\s{1,}duck\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` @@ -71,7 +71,7 @@ assert( ```js assert( /(let|const|var)\s{1,}beagle\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md index 90230752779..22c314f4009 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md @@ -61,7 +61,7 @@ assert.deepEqual(prototypeProps, ['numLegs']); يجب عليك حل هذا التحدي دون استخدام الوظيفة المدمجة في `Object.keys()`. ```js -assert(!/\Object.keys/.test(code)); +assert(!/\Object.keys/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md index 3e741eee12e..ef533c42eb8 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md @@ -43,7 +43,7 @@ assert(dog.sayLegs() === 'This dog has 4 legs.'); يجب أن يستخدم الكود كلمة `this` للوصول إلى خاصية `numLegs` لـ `dog`. ```js -assert(code.match(/this\.numLegs/g)); +assert(__helpers.removeJSComments(code).match(/this\.numLegs/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md index 5a49dc2ece6..72b48abf6f4 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md @@ -51,7 +51,7 @@ assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1); يجب عليك حل هذا التحدي دون استخدام الدالة المدمجة في `Object.keys()`. ```js -assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); +assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(__helpers.removeJSComments(code))); ``` يجب عليك حل هذا التحدي بدون إدخال قيم مثبتة (hard-coding) في قائمة `ownProps`. @@ -59,7 +59,7 @@ assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); ```js assert( !/\[\s*(?:'|")(?:name|numLegs)|(?:push|concat)\(\s*(?:'|")(?:name|numLegs)/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md index cf3376c4723..f1a9195562a 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md @@ -55,7 +55,7 @@ assert(joinDogFraternity(new Dog('')) === true); `joinDogFraternity` يجب أن تستخدم خاصية الـ `constructor`. ```js -assert(/\.constructor/.test(code) && !/instanceof/.test(code)); +assert(/\.constructor/.test(__helpers.removeJSComments(code)) && !/instanceof/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md index 71e6d45c26f..d1bc79a67e5 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md @@ -29,13 +29,13 @@ dashedName: understand-the-immediately-invoked-function-expression-iife وينبغي أن يكون ال function مجهول اي anonymous. ```js -assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, ''))); +assert(/\((function|\(\))(=>|\(\)){?/.test(__helpers.removeJSComments(code).replace(/\s/g, ''))); ``` يجب أن يكون ال function الخاص بك بين قوسين في نهاية العبارة لاستدعائه على الفور. ```js -assert(/\(.*(\)\(|\}\(\))\)/.test(code.replace(/[\s;]/g, ''))); +assert(/\(.*(\)\(|\}\(\))\)/.test(__helpers.removeJSComments(code).replace(/[\s;]/g, ''))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md index 5ddeeef034c..dd81952921b 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md @@ -42,7 +42,7 @@ duck.hasOwnProperty("name"); يجب أن يظهر الكود الخاص بك أن `Object.prototype` هو ال prototype لـ `Dog.prototype` ```js -assert(/Object\.prototype\.isPrototypeOf/.test(code)); +assert(/Object\.prototype\.isPrototypeOf/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md index 56d19d9f4a3..bcc756da27d 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md @@ -35,7 +35,7 @@ Bird.prototype.isPrototypeOf(duck); يجب أن تظهر أن `Dog.prototype` هو `prototype` الـ `beagle` ```js -assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code)); +assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md index 3eb00fc833c..9a21c43e2ac 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md @@ -52,7 +52,7 @@ assert(hound instanceof Dog); الكود الخاص بك يجب أن يستخدم مشغل `new` لإنشاء instance الـ `Dog`. ```js -assert(code.match(/new/g)); +assert(__helpers.removeJSComments(code).match(/new/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md index 29c1ceb7889..8aec44c68e6 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md @@ -43,7 +43,7 @@ ducky.getHatchedEggCount(); يجب أن تكون خاصية `weight` متغير خاص ويجب تعيينه قيمة `15`. ```js -assert(code.match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); ``` يجب أن ينشئ الكود الخاص بك method في `Bird` تسمى `getWeight` لإرجاع قيمة المتغير الخاص `weight`. @@ -55,7 +55,7 @@ assert(new Bird().getWeight() === 15); يجب أن تقوم دالة `getWeight` بإرجاع المتغير الخاص `weight`. ```js -assert(code.match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); +assert(__helpers.removeJSComments(code).match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md index b79ace14daa..5947bf6ed32 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md @@ -29,13 +29,13 @@ console.log(duck.name); يجب أن يستخدم كودك `console.log` لطباعة قيمة خاصية `name` لكائن `dog`. ```js -assert(/console.log\(.*dog\.name.*\)/g.test(code)); +assert(/console.log\(.*dog\.name.*\)/g.test(__helpers.removeJSComments(code))); ``` يجب أن يستخدم كودك `console.log` لطباعة قيمة خاصية `numLegs` لكائن `dog`. ```js -assert(/console.log\(.*dog\.numLegs.*\)/g.test(code)); +assert(/console.log\(.*dog\.numLegs.*\)/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md index e969e1df811..45aa980605e 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md @@ -53,7 +53,7 @@ assert(typeof myHouse.numBedrooms === 'number'); يجب عليك التحقق من أن `myHouse` هو instance لـ `House` باستخدام مشغل `instanceof`. ```js -assert(/myHouse\s*instanceof\s*House/.test(code)); +assert(/myHouse\s*instanceof\s*House/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md index 6df8bfbbed6..587b0be1822 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md @@ -75,7 +75,7 @@ assert(!myRegex.test('EleanorRoosevelt')); يجب عليك استخدام `.test()` لاختبار regex. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` يجب أن تنتج `true`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md index 0d4377c890d..69a11d7585c 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md @@ -51,7 +51,7 @@ assert(codingRegex.source === 'coding'); يجب أن يستخدم الكود الخاص بك دالة `.match()`. ```js -assert(code.match(/\.match\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.match\(.*\)/)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md index f39787a62ae..900400030cd 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md @@ -31,7 +31,7 @@ huRegex.test(hugStr); يجب أن يستخدم الكود الخاص بك دالة `.test()`. ```js -assert(code.match(/\.test\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.test\(.*\)/)); ``` يجب عليك استخدام الـ wildcard character في الـ regex الخاص بك `unRegex` diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index fb762fe43fc..c1d2e09bf54 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -52,7 +52,7 @@ assert(!waldoRegex.test('Somewhere is hiding in this text.')); يجب عليك إجراء مطابقة حرفية للمقطع النصية (string) باستخدام regex الخاص بك. ```js -assert(!/\/.*\/i/.test(code)); +assert(!/\/.*\/i/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md index a3430ef252e..8109e44e2bb 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md @@ -27,13 +27,13 @@ assert(result === 'Hello, World!'); يجب ألا يستخدم حلك طريقة `String.prototype.trim()`. ```js -assert(!code.match(/\.?[\s\S]*?trim/)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?trim/)); ``` متغير النتيجة `result` يجب ألا يتم تعيينه مباشرة إلى string ```js -assert(!code.match(/result\s*=\s*["'`].*?["'`]/)); +assert(!__helpers.removeJSComments(code).match(/result\s*=\s*["'`].*?["'`]/)); ``` لا ينبغي تغيير قيمة متغير `hello`. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md index cd0a8f778e3..0362f3f67d2 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md @@ -37,7 +37,7 @@ wrongText.replace(silverRegex, "blue"); يجب عليك استخدام `.replace()` للبحث والاستبدال. ```js -assert(code.match(/\.replace\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.replace\(.*\)/)); ``` يجب أن يقوم الـ regex الخاص بك بتغيير السلسلة `one two three` إلى السلسلة `three two one` @@ -49,7 +49,7 @@ assert(result === 'three two one'); لا يجب عليك تغيير السطر الأخير. ```js -assert(code.match(/result\s*=\s*str\.replace\(.*?\)/)); +assert(__helpers.removeJSComments(code).match(/result\s*=\s*str\.replace\(.*?\)/)); ``` `fixRegex` يجب أن تستخدم ثلاث مجموعات التقاط على الأقل. diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md index 51b4814993e..89fc44891ec 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md @@ -31,7 +31,7 @@ testRegex.test(testStr); يجب عليك استخدام `.test()` لاختبار الـ regex. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` يجب أن تنتج `true`. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md index 83fd4cd466d..92cffbb1261 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md @@ -15,12 +15,9 @@ You should have `if number >= 10:` within the `for` loop. ```js ({ - test: () => { - const transformedCode = code.replace(/\r/g, ""); - const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); - const { function_body } = verify_card_number; - - assert.match(function_body, /if +number +>= +10:/); + test: () => + { + assert(runPython(`_Node(_code).find_function("verify_card_number").find_for_loops()[1].find_ifs()[0].find_conditions()[0].is_equivalent("number >= 10")`)); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md index 67ac4c0e173..9127855203d 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md @@ -115,7 +115,10 @@ from importlib import reload reload(probability_calculator) probability_calculator.random.seed(95) -def test_hat_draw(self): + +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw(self): hat = probability_calculator.Hat(red=5,blue=2) actual = hat.draw(2) expected = ['blue', 'red'] @@ -140,6 +143,49 @@ t.result.wasSuccessful() }); ``` +The `draw` method should behave correctly when the number of balls to extract is bigger than the number of balls in the hat. + +```js +({ + test: () => { + pyodide.FS.writeFile("/home/pyodide/probability_calculator.py", code); + pyodide.FS.writeFile( + "/home/pyodide/test_module.py", + ` +import unittest +import probability_calculator +from importlib import reload + +reload(probability_calculator) + +probability_calculator.random.seed(95) +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw_2(self): + hat = probability_calculator.Hat(yellow=5,red=1,green=3,blue=9,test=1) + actual = hat.draw(20) + expected = ['yellow', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'green', 'green', 'green', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'test'] + self.assertEqual(actual, expected, 'Expected hat draw to return all items from hat contents.') + actual = len(hat.contents) + expected = 0 + self.assertEqual(actual, expected, 'Expected hat draw to leave no items in contents.') + ` + ); + const testCode = ` +from unittest import main +import test_module +from importlib import reload + +reload(test_module) +t = main(module='test_module', exit=False) +t.result.wasSuccessful() +`; + const out = __pyodide.runPython(testCode); + assert(out); + }, +}); +``` + The `experiment` method should return a different probability. @@ -221,7 +267,8 @@ class Hat: def draw(self, number): drawn = [] if number >= len(self.contents): - return self.contents + drawn.extend(self.contents) + self.contents = [] else: for i in range(number): drawn.append( @@ -229,8 +276,7 @@ class Hat: ) return drawn -def experiment(hat, expected_balls, num_balls_drawn, num_experiments): - +def experiment(hat, expected_balls, num_balls_drawn, num_experiments): expected_balls_list = [] drawn_list = [] success = 0 @@ -248,12 +294,7 @@ def experiment(hat, expected_balls, num_balls_drawn, num_experiments): except: continue if len(exp_ball_list_copy) == 0: - success += 1 - - - - - probability = success/num_experiments - + success += 1 + probability = success/num_experiments return probability ``` diff --git a/curriculum/challenges/arabic/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md b/curriculum/challenges/arabic/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md index 19ea0d3c265..397f8d13d67 100644 --- a/curriculum/challenges/arabic/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md +++ b/curriculum/challenges/arabic/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md @@ -48,9 +48,9 @@ The initial declaration of the `homeworkStack` should not be changed. ```js assert( - code.match(/=/g).length === 1 && + __helpers.removeJSComments(code).match(/=/g).length === 1 && /homeworkStack\s*=\s*\["BIO12"\s*,\s*"HIS80"\s*,\s*"MAT122"\s*,\s*"PSY44"\]/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/arabic/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md b/curriculum/challenges/arabic/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md index fd5f572c78e..7618ff2a003 100644 --- a/curriculum/challenges/arabic/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md +++ b/curriculum/challenges/arabic/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md @@ -2,7 +2,6 @@ id: 5f356ed60a5decd94ab66986 title: الخطوة 22 challengeType: 0 -removeComments: false dashedName: step-22 --- diff --git a/curriculum/challenges/arabic/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md b/curriculum/challenges/arabic/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md index 6812eb99e19..8d7378a182b 100644 --- a/curriculum/challenges/arabic/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md +++ b/curriculum/challenges/arabic/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md @@ -40,15 +40,15 @@ assert(canvasFilter === 'blur(2px)'); ## --seed-contents-- ```css +--fcc-editable-region-- .canvas { width: 500px; height: 600px; background-color: #4d0f00; overflow: hidden; ---fcc-editable-region-- ---fcc-editable-region-- } +--fcc-editable-region-- .frame { border: 50px solid black; diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md index e76b7ad113d..840b14796d8 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md @@ -7,7 +7,7 @@ dashedName: step-55 # --description-- -Inside, the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. +Inside the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. Now, you should see a category displayed underneath each post topic. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md index eca279b42fe..b69803b87d0 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md @@ -7,9 +7,11 @@ dashedName: step-43 # --description-- -Notice how the `10` value is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. +Notice how the number `10` is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the numbers values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. -To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. Leave the function empty for now. +To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. The parameters of `a` and `b` represent the number values in the array that will be sorted. + +Leave the function empty for now. # --hints-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md index d253c95b6c6..ee57c994e55 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md @@ -26,7 +26,7 @@ assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\( Your callback function should return `a - b`. ```js -assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+a\s*-\s*b\s*;?\s*}\s*\)/); +assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+(?:parseInt)?(?:Number)?\(?a\)?\s*-\s*(?:parseInt)?(?:Number)?\(?b\)?\s*;?\s*}\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b514741ae01..b1b54dda895 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -11,6 +11,8 @@ In your `evalFormula`, declare an `idToText` arrow function which takes an `id` Your `idToText` function should return the result of calling `.find()` on the `cells` array with a callback function that takes an `cell` parameter and returns `cell.id === id`. +Both of your functions should use implicit returns. + # --hints-- You should declare an `idToText` variable in your `evalFormula` function. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md index 57110b715a9..37487b1771c 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md @@ -23,13 +23,7 @@ Open up the console to see the result. # --hints-- -You should call `.repeat()` on your two `" "` strings. - -```js -assert.lengthOf(code.match(/" ".repeat/g), 2); -``` - -Your `" "` strings should be repeated `rowCount - rowNumber` times. +You should call `.repeat()` on your `" "` strings to repeat them `rowCount - rowNumber` times. ```js assert.equal(padRow(1, 3), " # "); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md index 3306b1a478b..4170d3bd12b 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md @@ -3,7 +3,6 @@ id: 660f3ce51f70571e1c5227c8 title: Step 69 challengeType: 1 dashedName: step-69 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md index ea0a831040f..7a939244a7c 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md @@ -3,7 +3,6 @@ id: 660f3dd626be3a1ffe27e5d1 title: Step 70 challengeType: 1 dashedName: step-70 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md index e30d808ccb6..b676558ec74 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md @@ -3,7 +3,6 @@ id: 660f4f79e2a82a4e92290f44 title: Step 101 challengeType: 1 dashedName: step-101 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md index dc683e61ce5..3f088de2c91 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md @@ -3,7 +3,6 @@ id: 660f53ad3d39175c5d4335ac title: Step 108 challengeType: 1 dashedName: step-108 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md new file mode 100644 index 00000000000..286128cc2cf --- /dev/null +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md @@ -0,0 +1,74 @@ +--- +id: 662693f82c91a66be46c881b +title: Step 1 +challengeType: 1 +dashedName: step-1 +--- + +# --description-- + +A teacher has finished grading their students' tests and needs your help to calculate the average score for the class. + +Complete the `getAverage` function which takes in an array of test scores and returns the average score. + +The average is calculated by adding up all the scores and dividing by the total number of scores. + +```js +average = sum of all scores / total number of scores +``` + +A couple of function calls have been provided for you so you can test out your code. + +**Tips** + +- You can use a loop to iterate over the `scores` array and add up all the scores. +- You can use the `length` property to get the total number of scores. + +# --hints-- + +Your `getAverage` function should return a number. + +```js +assert.strictEqual(typeof getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 'number'); +``` + +`getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])` should return `71.7`. + +```js +assert.strictEqual(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 71.7); +``` + +`getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])` should return `85.4`. + +```js +assert.strictEqual(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]), 85.4); +``` + +`getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100])` should return `92.4`. + +```js +assert.strictEqual(getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100]), 92.4); +``` + +Your `getAverage` function should return the average score of the test scores. + +```js +assert.strictEqual(getAverage([52, 56, 60, 65, 70, 75, 80, 85, 90, 95]), 72.8); +assert.strictEqual(getAverage([45, 50, 55, 60, 65, 70, 75, 80, 85, 90]), 67.5); +assert.strictEqual(getAverage([38, 42, 46, 50, 54, 58, 62, 66, 70, 74]), 56); +``` + +# --seed-- + +## --seed-contents-- + +```js +--fcc-editable-region-- +function getAverage(scores) { + +} + +console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])); +console.log(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md new file mode 100644 index 00000000000..f7e9253a5a5 --- /dev/null +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md @@ -0,0 +1,104 @@ +--- +id: 6626a060c4006f793e10cb33 +title: Step 2 +challengeType: 1 +dashedName: step-2 +--- + +# --description-- + +Now the teacher needs your help converting the student score to a letter grade. + +Complete the `getGrade` function that takes a number `score` as a parameter. Your function should return a string representing a letter grade based on the score. + +Here are the scores and their corresponding letter grades: + +| Score Range | Grade | +| ----------- | ------- | +| `100` | `"A++"` | +| `90 - 99` | `"A"` | +| `80 - 89` | `"B"` | +| `70 - 79` | `"C"` | +| `60 - 69` | `"D"` | +| `0 - 59` | `"F"` | + + +**Tips** + +- Remember that you learned about conditional statements(`if`, `else if`, and `else`). +- Remember that you learned about comparison operators (`>`, `<`, `>=`, `<=`, `===`). + +# --hints-- + +Your `getGrade` function should return `"A++"` if the score is `100`. + +```js +assert.strictEqual(getGrade(100), "A++"); +``` + +Your `getGrade` function should return `"A"` if the score is `94`. + +```js +assert.strictEqual(getGrade(94), "A"); +``` + +Your `getGrade` function should return `"B"` if the score is between `80` and `89`. + +```js +assert.strictEqual(getGrade(80), "B"); +assert.strictEqual(getGrade(83), "B"); +assert.strictEqual(getGrade(88), "B"); +``` + +Your `getGrade` function should return `"C"` if the score is `78`. + +```js +assert.strictEqual(getGrade(75), "C"); +``` + +Your `getGrade` function should return `"D"` if the score is between `60` and `69`. + +```js +assert.strictEqual(getGrade(60), "D"); +assert.strictEqual(getGrade(63), "D"); +assert.strictEqual(getGrade(68), "D"); +``` + +Your `getGrade` function should return `"F"` if the score is `57`. + +```js +assert.strictEqual(getGrade(57), "F"); +``` + +Your `getGrade` function should return `"F"` if the score is between `0` and `59`. + +```js +assert.strictEqual(getGrade(0), "F"); +assert.strictEqual(getGrade(30), "F"); +assert.strictEqual(getGrade(43), "F"); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} +--fcc-editable-region-- +function getGrade(score) { + +} + +console.log(getGrade(96)); +console.log(getGrade(82)); +console.log(getGrade(56)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md new file mode 100644 index 00000000000..b168e1325fc --- /dev/null +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md @@ -0,0 +1,88 @@ +--- +id: 6626b4c58c027d86478ff5eb +title: Step 3 +challengeType: 1 +dashedName: step-3 +--- + +# --description-- + +The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an `"F"`. + +Complete the function `hasPassingGrade` that takes a student score as a parameter. Your function should return `true` if the student has a passing grade and `false` if they do not. + +**Tips** + +- Use the `getGrade` function to get the student's grade. Then check if the grade is passing or not. + +# --hints-- + +Your `hasPassingGrade` function should return a boolean value. + +```js +assert.strictEqual(typeof hasPassingGrade(100), "boolean"); +``` + +Your `hasPassingGrade` function should return `true` if the grade is an `"A"`. + +```js +assert.isTrue(hasPassingGrade(100)); +``` + +Your `hasPassingGrade` function should return `false` if the grade is an `"F"`. + +```js +assert.isFalse(hasPassingGrade(53)); +``` + +Your `hasPassingGrade` function should return `true` for all passing grades. + +```js +assert.isTrue(hasPassingGrade(87)); +assert.isTrue(hasPassingGrade(60)); +assert.isTrue(hasPassingGrade(73)); +assert.isTrue(hasPassingGrade(96)); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +--fcc-editable-region-- +function hasPassingGrade(score) { + +} + + +console.log(hasPassingGrade(100)); +console.log(hasPassingGrade(53)); +console.log(hasPassingGrade(87)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md new file mode 100644 index 00000000000..08ee3cea27b --- /dev/null +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md @@ -0,0 +1,143 @@ +--- +id: 6626b8dcf5057f896f948440 +title: Step 4 +challengeType: 1 +dashedName: step-4 +--- + +# --description-- + +Now that the teacher has all of the information they need, they want to be able to message the student with the results. + +Complete the `studentMsg` function with `totalScores` and `studentScore` for parameters. The function should return a string representing a message to the student. + +If the student passed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You passed the course. +``` + +If the student failed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You failed the course. +``` + +Replace `average-goes-here` with the average of the total scores. Replace `grade-goes-here` with the student's grade. + +**Tips** + +- Use the `getAverage` function to get the class average. +- Use the `getGrade` function to get the student's grade. +- Use string concatenation (`+`) to build the message. +- Be careful with the punctuation and spaces in the message. + +# --hints-- + +Your function call of `studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)` should return the following message: `"Class average: 71.7. Your grade: F. You failed the course."`. + +```js +assert.strictEqual(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37), "Class average: 71.7. Your grade: F. You failed the course."); +``` + +Your function call of `studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)` should return the following message: `"Class average: 50.8. Your grade: A++. You passed the course."`. + +```js +assert.strictEqual(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100), "Class average: 50.8. Your grade: A++. You passed the course."); +``` + +Your `studentMsg` function should return a the correct message based on the student's score and the class average. + +```js +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 92), "Class average: 70.25. Your grade: A. You passed the course."); +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 57), "Class average: 70.25. Your grade: F. You failed the course."); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +--fcc-editable-region-- +function studentMsg(totalScores, studentScore) { + +} +console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)); +--fcc-editable-region-- + +``` + + +# --solutions-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +function studentMsg(totalScores, studentScore) { + let average = getAverage(totalScores); + let grade = getGrade(studentScore); + + return `Class average: ${average}. Your grade: ${grade}. You ${ + hasPassingGrade(studentScore) ? "passed" : "failed" + } the course.`; +} + +``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md index 74e4e2da124..b57d43165ad 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md @@ -87,7 +87,7 @@ assert(confirmEnding('Abstraction', 'action') === true); 不應使用內置方法 `.endsWith()` 來完成挑戰。 ```js -assert(!/\.endsWith\(.*?\)\s*?;?/.test(code) && !/\['endsWith'\]/.test(code)); +assert(!/\.endsWith\(.*?\)\s*?;?/.test(__helpers.removeJSComments(code)) && !/\['endsWith'\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md index 3342baefba8..e3fae3cbcdb 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md @@ -51,7 +51,7 @@ assert(repeatStringNumTimes('abc', -2) === ''); 不應使用內置的 `repeat()` 方法。 ```js -assert(!/\.repeat/g.test(code)); +assert(!/\.repeat/g.test(__helpers.removeJSComments(code))); ``` `repeatStringNumTimes("abc", 0)` 應返回 `""`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md index e6c806b95f8..ea64bec386e 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md @@ -53,19 +53,19 @@ assert.deepEqual( `htmlColorNames` 函數中應調用 `splice()` 方法。 ```js -assert(/.splice/.test(code)); +assert(/.splice/.test(__helpers.removeJSComments(code))); ``` 不應使用 `shift()` 或 `unshift()`。 ```js -assert(!/shift|unshift/.test(code)); +assert(!/shift|unshift/.test(__helpers.removeJSComments(code))); ``` 不應使用數組的方括號表示法。 ```js -assert(!/\[\d\]\s*=/.test(code)); +assert(!/\[\d\]\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md index a587cc155cc..17ba7c2e327 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md @@ -85,8 +85,8 @@ assert(foods.strawberries === 27); ```js assert( - code.search(/let foods/) === -1 && - code.search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ + __helpers.removeJSComments(code).search(/let foods/) === -1 && + __helpers.removeJSComments(code).search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ ) !== -1 ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md index f0f51ba526e..0034a61a0aa 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md @@ -27,7 +27,7 @@ users.hasOwnProperty('Alan'); ```js -assert(code.match(/users/gm).length <= 2) +assert(__helpers.removeJSComments(code).match(/users/gm).length <= 2) ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index caa1ca8309d..02fbf769cef 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ `copyMachine` 函數中應對 `arr` 使用展開運算符(`spread operator`)。 ```js -assert(code.match(/\.\.\.\s*arr/)); +assert(__helpers.removeJSComments(__helpers.removeJSComments(code)).match(/\.\.\.\s*arr/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md index 368423b7969..7c09103e8de 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md @@ -38,7 +38,7 @@ assert.deepEqual( `forecast` 函數中應使用 `slice()` 方法。 ```js -assert(/\.slice\(/.test(code)); +assert(/\.slice\(/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index d36ca6ed9ee..0cc1a1ccc7d 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -51,7 +51,7 @@ for (const food in refrigerator) { ```js assert( - code.match( + __helpers.removeJSComments(code).match( /for\s*\(\s*(var|let|const)\s+[a-zA-Z_$]\w*\s+in\s+[a-zA-Z_$]\w*\s*\)/ ) ); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md index 55e52abdf87..d75383e3f81 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md @@ -61,7 +61,7 @@ assert(userActivity.data.online === 45); 應使用點號表示法或方括號表示法來修改 `online` 屬性值。 ```js -assert.strictEqual(code.search(/online: 45/), -1); +assert.strictEqual(__helpers.removeJSComments(code).search(/online: 45/), -1); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md index c2e13a57f3e..df9d323ddd1 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md @@ -40,7 +40,7 @@ let newArray = array.splice(3, 2); ```js assert( - __helpers.removeWhiteSpace(code).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) ); ``` @@ -56,14 +56,14 @@ assert.strictEqual( 應對 `arr` 調用 `splice()` 方法。 ```js -assert(__helpers.removeWhiteSpace(code).match(/arr\.splice\(/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(/)); ``` splice 應只刪除 `arr` 裏面的元素,不能給 `arr` 添加元素。 ```js assert( - !__helpers.removeWhiteSpace(code).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) + !__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md index 5bdab287a99..f78e73612df 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md @@ -39,9 +39,9 @@ assert( ```js assert( - code.search(/oranges:/) !== -1 && - code.search(/plums:/) !== -1 && - code.search(/strawberries:/) !== -1 + __helpers.removeJSComments(code).search(/oranges:/) !== -1 && + __helpers.removeJSComments(code).search(/plums:/) !== -1 && + __helpers.removeJSComments(code).search(/strawberries:/) !== -1 ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md index dd056fd9651..35d588bfa2c 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md @@ -54,7 +54,7 @@ assert( ```js assert( (function () { - if (code.match(/\s*=\s*myArray\[0\]/g)) { + if (__helpers.removeJSComments(code).match(/\s*=\s*myArray\[0\]/g)) { return true; } else { return false; diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md index f919d96cc4c..509a09acf94 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md @@ -45,7 +45,7 @@ assert(myData === 8); 你應該使用方括號從 `myArray` 中讀取正確的值。 ```js -assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code))); +assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md index b608a59a46c..d42dfaf2cbe 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md @@ -54,7 +54,7 @@ assert(secondTree === 'pine'); 你的代碼應該使用點號和方括號訪問 `myPlants`。 ```js -assert(/=\s*myPlants\[1\].list\[1\]/.test(code)); +assert(/=\s*myPlants\[1\].list\[1\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md index fae451f97bc..2c743cccf38 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md @@ -64,7 +64,7 @@ assert(drinkValue === 'water'); 你應該使用兩次方括號 ```js -assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md index a3dae61ebd2..576418c0735 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md @@ -60,7 +60,7 @@ assert(shirtValue === 'jersey'); 你應該使用兩個點號 ```js -assert(code.match(/testObj\.\w+/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\.\w+/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md index ede0ad4e0a5..2ea5f387464 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md @@ -56,19 +56,19 @@ assert(player === 'Montana'); 你應該使用括號表示法來訪問 `testObj`。 ```js -assert(/testObj\s*?\[.*?\]/.test(code)); +assert(/testObj\s*?\[.*?\]/.test(__helpers.removeJSComments(code))); ``` 你不應將值 `Montana` 直接分配給變量 `player`。 ```js -assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); +assert(!__helpers.removeJSComments(code).match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); ``` 你應該在括號符號中使用變量 `playerNumber`。 ```js -assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code)); +assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md index b99d7e1d724..8d26847f757 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md @@ -53,7 +53,7 @@ assert(myDog.bark !== undefined); 不應該在 `myDog` 的初始化中添加 `bark`。 ```js -assert(!/bark[^\n]:/.test(code)); +assert(!/bark[^\n]:/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md index 12a23a3a84e..38ff6c4fadd 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md @@ -38,7 +38,7 @@ assert(sum === 20); 請使用 `+` 運算符。 ```js -assert(/\+/.test(code)); +assert(/\+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md index b6f5dae2fe5..cc50a2a7fc8 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md @@ -71,7 +71,7 @@ assert(switchOfStuff(4) === 'stuff'); 不能使用 `if` 或 `else` 語句。 ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` 你應該使用 `default` 語句。 @@ -83,7 +83,7 @@ assert(switchOfStuff('string-to-trigger-default-case') === 'stuff'); 你至少應該寫 3 個 `break` 語句。 ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md index 44569682541..4ea482345d6 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md @@ -36,7 +36,7 @@ assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2); 你應該使用 `+=` 運算符將 `someAdjective` 追加到 `myStr`。 ```js -assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md index 758384331f4..0f1c65d2135 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md @@ -29,7 +29,7 @@ myNum = myVar; 你不應該修改註釋上面的代碼。 ```js -assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code))); ``` `b` 的值應該爲 `7`。 @@ -41,7 +41,7 @@ assert(typeof b === 'number' && b === 7); 應該使用 `=` 將 `a` 賦給 `b`。 ```js -assert(/b\s*=\s*a\s*/g.test(code)); +assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md index 3119b97e8d8..214e04cf5a8 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md @@ -34,7 +34,7 @@ assert(processed === 2); 應該將 `processArg` 賦值給 `processed`。 ```js -assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code)); +assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md index 3d646d0b332..2650e992e9a 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md @@ -39,19 +39,19 @@ if (condition1) { 應至少有 4 個 `else` 語句。 ```js -assert(code.match(/else/g).length > 3); +assert(__helpers.removeJSComments(code).match(/else/g).length > 3); ``` 應至少有 4 個 `if` 語句。 ```js -assert(code.match(/if/g).length > 3); +assert(__helpers.removeJSComments(code).match(/if/g).length > 3); ``` 應至少有 1 個 `return` 語句。 ```js -assert(code.match(/return/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/return/g).length >= 1); ``` `testSize(0)` 應該返回字符串 `Tiny` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index b3f766493b1..0832e60bfa3 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -2,7 +2,6 @@ id: bd7123c9c441eddfaeb4bdef title: 給代碼添加註釋 challengeType: 1 -removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' forumTopicId: 16783 dashedName: comment-your-javascript-code diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index fde6b0c846e..9bb5a9a8dc8 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -58,7 +58,7 @@ assert(testEqual('12') === 'Equal'); 應該使用 `==` 運算符 ```js -assert(code.match(/==/g) && !code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/==/g) && !__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index bec7a7c31fa..04788f079b7 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -73,7 +73,7 @@ assert(testGreaterThan(150) === 'Over 100'); 你應該使用 `>` 至少兩次 ```js -assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index b9eb0cf4419..4b72e450302 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -73,7 +73,7 @@ assert(testGreaterOrEqual(21) === '20 or Over'); 你應該使用 `>=` 運算符至少兩次。 ```js -assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index c5841332990..5a7c0ec55e3 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -60,7 +60,7 @@ assert(testNotEqual('bob') === 'Not Equal'); 你應該使用 `!=` 運算符 ```js -assert(code.match(/(?!!==)!=/)); +assert(__helpers.removeJSComments(code).match(/(?!!==)!=/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index 3cfac468649..1ddc2878d47 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -66,7 +66,7 @@ assert(testLessThan(99) === '55 or Over'); 應該使用 `<` 運算符至少兩次 ```js -assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index da386b35ec5..cb907e60db8 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -72,7 +72,7 @@ assert(testLessOrEqual(55) === 'More Than 24'); 應該使用 `<=` 運算符至少兩次 ```js -assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index 784409a7ed3..a7fd0ce4277 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -49,7 +49,7 @@ assert(testStrict('7') === 'Not Equal'); 應該使用 `===` 運算符 ```js -assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index 2dff6ed7fe3..580c4d3bbf6 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -52,7 +52,7 @@ assert(testStrictNotEqual('bob') === 'Not Equal'); 應該使用 `!==` 運算符 ```js -assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md index 2a3949e976e..16c5db1d078 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md @@ -40,13 +40,13 @@ return "No"; 你應該使用 `&&` 運算符一次。 ```js -assert(code.match(/&&/g).length === 1); +assert(__helpers.removeJSComments(code).match(/&&/g).length === 1); ``` 你應該只有一個 `if` 表達式。 ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalAnd(0)` 應該返回字符串 `No` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md index 5a112a6eb25..e7403021aff 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md @@ -43,13 +43,13 @@ return "Yes"; 應該使用一次 `||` 操作符。 ```js -assert(code.match(/\|\|/g).length === 1); +assert(__helpers.removeJSComments(code).match(/\|\|/g).length === 1); ``` 應該只有一個 `if` 表達式。 ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalOr(0)` 應該返回字符串 `Outside` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md index 03ea0eed421..0c346ed5779 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md @@ -54,16 +54,16 @@ assert(c === 19); 應該對每個變量使用 `+=` 操作符。 ```js -assert(code.match(/\+=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\+=/g).length === 3); ``` 不要修改註釋上面的代碼。 ```js assert( - /let a = 3;/.test(code) && - /let b = 17;/.test(code) && - /let c = 12;/.test(code) + /let a = 3;/.test(__helpers.removeJSComments(code)) && + /let b = 17;/.test(__helpers.removeJSComments(code)) && + /let c = 12;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md index 8f72ef59378..1146a6ad2b4 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md @@ -48,16 +48,16 @@ assert(c === 3); 應該對每個變量使用 `/=` 操作符。 ```js -assert(code.match(/\/=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\/=/g).length === 3); ``` 不要修改註釋上面的代碼。 ```js assert( - /let a = 48;/.test(code) && - /let b = 108;/.test(code) && - /let c = 33;/.test(code) + /let a = 48;/.test(__helpers.removeJSComments(code)) && + /let b = 108;/.test(__helpers.removeJSComments(code)) && + /let c = 33;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md index e7af1297212..0ffe912f3cd 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md @@ -48,16 +48,16 @@ assert(c === 46); 應該對每個變量使用 `*=` 操作符。 ```js -assert(code.match(/\*=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\*=/g).length === 3); ``` 不要修改註釋上面的代碼。 ```js assert( - /let a = 5;/.test(code) && - /let b = 12;/.test(code) && - /let c = 4\.6;/.test(code) + /let a = 5;/.test(__helpers.removeJSComments(code)) && + /let b = 12;/.test(__helpers.removeJSComments(code)) && + /let c = 4\.6;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md index 1bf3a6d2d26..a0321bab2c5 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md @@ -48,14 +48,14 @@ assert(c === 2); 應該對每個變量使用 `-=` 操作符。 ```js -assert(code.match(/-=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/-=/g).length === 3); ``` 不要修改註釋上面的代碼。 ```js assert( - /let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code) + /let a = 11;/.test(__helpers.removeJSComments(code)) && /let b = 9;/.test(__helpers.removeJSComments(code)) && /let c = 3;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md index 924cc5dcd25..dd521d267ce 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md @@ -47,19 +47,19 @@ assert(myStr === 'This is the start. This is the end.'); 應該使用 `+` 運算符來構建 `myStr`。 ```js -assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g)); +assert(__helpers.removeJSComments(code).match(/(["']).*\1\s*\+\s*(["']).*\2/g)); ``` `myStr` 應該使用 `const` 關鍵字創建。 ```js -assert(/const\s+myStr/.test(code)); +assert(/const\s+myStr/.test(__helpers.removeJSComments(code))); ``` 應該將結果分配給 `myStr` 變量。 ```js -assert(/myStr\s*=/.test(code)); +assert(/myStr\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index e7f7deecf4d..2e5f343b21b 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -43,7 +43,7 @@ assert(myStr === 'This is the first sentence. This is the second sentence.'); 應該使用 `+=` 操作符創建 `myStr` 變量。 ```js -assert(code.match(/myStr\s*\+=\s*(["']).*\1/g)); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*(["']).*\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md index a8a05660bfe..fafec068c68 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md @@ -35,7 +35,7 @@ assert(typeof myName !== 'undefined' && myName.length > 2); 使用兩個 `+` 操作符創建包含 `myName` 的 `myStr` 變量。 ```js -assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); +assert(__helpers.removeJSComments(code).match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md index 52d240cf1b1..59b72afdf91 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md @@ -34,13 +34,13 @@ for (let i = 10; i > 0; i -= 2) { 應該使用 `for` 循環。 ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` 應該使用數組方法 `push`。 ```js -assert(code.match(/myArray.push/)); +assert(__helpers.removeJSComments(code).match(/myArray.push/)); ``` `myArray` 應該等於 `[9, 7, 5, 3, 1]`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md index d6b0f9458ae..6b7ee9b2180 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md @@ -37,7 +37,7 @@ var ourName; 使用 `var` 關鍵字定義一個變量 `myName`,並使用分號結尾。 ```js -assert(/var\s+myName\s*;/.test(code)); +assert(/var\s+myName\s*;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md index 81e322ff7c2..1a89ba4a511 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md @@ -38,25 +38,25 @@ assert(myVar === 10); 應該修改 `myVar = myVar - 1;`。 ```js -assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); ``` 你不應將 `10` 分配給 `myVar`。 ```js -assert(!code.match(/myVar\s*=\s*10.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*10.*?;?/)); ``` 應該對 `myVar` 使用 `--` 運算符。 ```js -assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code)); +assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(__helpers.removeJSComments(code))); ``` 你不應該修改註釋上面的代碼。 ```js -assert(/let myVar = 11;/.test(code)); +assert(/let myVar = 11;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md index 358361c0dc4..2a5ff049b64 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md @@ -55,7 +55,7 @@ assert(typeof myDog === 'object' && myDog.tails === undefined); 不要修改 `myDog` 的初始化代碼。 ```js -assert(code.match(/"tails": 1/g).length > 0); +assert(__helpers.removeJSComments(code).match(/"tails": 1/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md index b8ce5b2bfa1..405c91406ac 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md @@ -26,13 +26,13 @@ assert(quotient === 2.2); 使用 `/` 運算符將 4.4 除以 2。 ```js -assert(/4\.40*\s*\/\s*2\.*0*/.test(code)); +assert(/4\.40*\s*\/\s*2\.*0*/.test(__helpers.removeJSComments(code))); ``` quotient 變量應該只被賦值一次。 ```js -assert(code.match(/quotient\s*=/g).length === 1); +assert(__helpers.removeJSComments(code).match(/quotient\s*=/g).length === 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md index 8b0e9eef966..68d4bc14f6f 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md @@ -35,7 +35,7 @@ assert(quotient === 2); 使用 `/` 運算符。 ```js -assert(/\d+\s*\/\s*\d+/.test(code)); +assert(/\d+\s*\/\s*\d+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md index f73c76399a3..5669580a4f9 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md @@ -36,7 +36,7 @@ I am a "double quoted" string inside "double quotes". 你的代碼中應該包含兩個雙引號(`"`)以及四個轉義的雙引號(`\"`)。 ```js -assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2); +assert(__helpers.removeJSComments(code).match(/\\"/g).length === 4 && __helpers.removeJSComments(code).match(/[^\\]"/g).length === 2); ``` 變量 `myStr` 應該包含字符串 `I am a "double quoted" string inside "double quotes".` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md index 7e013d29c91..ee15d48df68 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md @@ -29,8 +29,8 @@ console.log("Alan Peter".length); ```js assert( - code.match(/let lastNameLength = 0;/) && - code.match(/const lastName = "Lovelace";/) + __helpers.removeJSComments(code).match(/let lastNameLength = 0;/) && + __helpers.removeJSComments(code).match(/const lastName = "Lovelace";/) ); ``` @@ -43,7 +43,7 @@ assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8); 你應該使用 `.length` 獲取 `lastName` 的長度,像這樣 `lastName.length`。 ```js -assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/)); +assert(__helpers.removeJSComments(code).match(/=\s*lastName\.length/g) && !__helpers.removeJSComments(code).match(/lastName\s*=\s*8/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md index b1bab47c241..192d7e55f7a 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md @@ -39,7 +39,7 @@ dashedName: finding-a-remainder-in-javascript 變量 `remainder` 應該被初始化。 ```js -assert(/(const|let|var)\s+?remainder/.test(code)); +assert(/(const|let|var)\s+?remainder/.test(__helpers.removeJSComments(code))); ``` `remainder` 的值應該等於 `2`。 @@ -51,7 +51,7 @@ assert(remainder === 2); 你應該使用 `%` 運算符。 ```js -assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code)); +assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md index dbaac0798ee..8f0031434a4 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md @@ -36,7 +36,7 @@ assert((randomFraction() + '').match(/\./g)); 需要使用 `Math.random` 生成隨機的小數。 ```js -assert(code.match(/Math\.random/g).length >= 0); +assert(__helpers.removeJSComments(code).match(/Math\.random/g).length >= 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md index d97f3df904a..54fdabe08bc 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md @@ -46,22 +46,22 @@ assert( 應該使用 `Math.random` 生成一個隨機數字。 ```js -assert(code.match(/Math.random/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.random/g).length >= 1); ``` 應該將 `Math.random` 的結果乘以 10,以生成 0 到 9 之間的隨機數。 ```js assert( - code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || - code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) + __helpers.removeJSComments(code).match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || + __helpers.removeJSComments(code).match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) ); ``` 應該使用 `Math.floor` 來刪除數字的十進制部分。 ```js -assert(code.match(/Math.floor/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.floor/g).length >= 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md index 20669e97ef7..50686fd6d48 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md @@ -49,10 +49,10 @@ assert(randomRange(0, 1) % 1 === 0); assert( (function () { if ( - code.match(/myMax/g).length > 1 && - code.match(/myMin/g).length > 2 && - code.match(/Math.floor/g) && - code.match(/Math.random/g) + __helpers.removeJSComments(code).match(/myMax/g).length > 1 && + __helpers.removeJSComments(code).match(/myMin/g).length > 2 && + __helpers.removeJSComments(code).match(/Math.floor/g) && + __helpers.removeJSComments(code).match(/Math.random/g) ) { return true; } else { diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md index 343ee857947..692193e4f06 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md @@ -36,7 +36,7 @@ assert(myGlobal === 10); `myGlobal` 應該使用 `let` 或 `const` 關鍵字聲明 ```js -assert(/(let|const)\s+myGlobal/.test(code)); +assert(/(let|const)\s+myGlobal/.test(__helpers.removeJSComments(code))); ``` `oopsGlobal` 應爲全局變量,值爲 `5`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md index 70d72bd9777..476dd3e55dc 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md @@ -45,7 +45,7 @@ assert(myOutfit() === 'sweater'); 不要修改 return 語句。 ```js -assert(/return outerWear/.test(code)); +assert(/return outerWear/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md index eb8ff2ac035..b8dbe39acb6 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md @@ -39,20 +39,20 @@ assert(myVar === 88); ```js assert( - /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(code) + /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(__helpers.removeJSComments(code)) ); ``` 應該使用 `++` 運算符。 ```js -assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code)); +assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(__helpers.removeJSComments(code))); ``` 不應該修改註釋上面的代碼。 ```js -assert(/let myVar = 87;/.test(code)); +assert(/let myVar = 87;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md index a8360c285b5..3a5ca8419d5 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md @@ -26,7 +26,7 @@ var myVar = 0; 應該初始化 `a` 的值爲 `9`。 ```js -assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code)); +assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md index 33de6be143e..4997a7bbd1e 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md @@ -30,20 +30,20 @@ if (num > 15) { 你應該至少有兩個 `else` 表達式。 ```js -assert(code.match(/else/g).length > 1); +assert(__helpers.removeJSComments(code).match(/else/g).length > 1); ``` 你應該至少有兩個 `if` 表達式。 ```js -assert(code.match(/if/g).length > 1); +assert(__helpers.removeJSComments(code).match(/if/g).length > 1); ``` 應該關閉每一個 `if else` 代碼塊。 ```js assert( - code.match( + __helpers.removeJSComments(code).match( /if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/ ) ); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md index 37f119c5936..323aadf4583 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md @@ -28,13 +28,13 @@ if (num > 10) { 應該只有一個 `if` 語句。 ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` 應該使用一個 `else` 語句。 ```js -assert(/else/g.test(code)); +assert(/else/g.test(__helpers.removeJSComments(code))); ``` `testElse(4)` 應該返回字符串 `5 or Smaller` @@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5'); 不要修改相應註釋的上面或下面的代碼。 ```js -assert(/let result = "";/.test(code) && /return result;/.test(code)); +assert(/let result = "";/.test(__helpers.removeJSComments(code)) && /return result;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md index 93e415a1848..591477f14ce 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md @@ -32,7 +32,7 @@ for (let i = 0; i < 10; i += 2) { 應該使用 `for` 循環。 ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` 應該等於 `[1, 3, 5, 7, 9]`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md index 95eebdca777..f472d29a78f 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md @@ -30,7 +30,7 @@ for (let i = 0; i < arr.length; i++) { `total` 應該被聲明, 並且初始化值爲 0。 ```js -assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); ``` `total` 應該等於 20。 @@ -42,13 +42,13 @@ assert(total === 20); 你應該使用 `for` 循環在 `myArr` 中遍歷。 ```js -assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code)); +assert(/for\s*\(/g.test(__helpers.removeJSComments(code)) && /myArr\s*\[/g.test(__helpers.removeJSComments(code))); ``` 不能直接把 `total` 設置成 20。 ```js -assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm)); +assert(!__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/total[=+-]0*[1-9]+/gm)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md index 1c611e6d48e..c39fe3d69ba 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md @@ -56,7 +56,7 @@ do { 你應該使用 `do...while` 循環。 ```js -assert(code.match(/do/g)); +assert(__helpers.removeJSComments(code).match(/do/g)); ``` `myArray` 應該等於 `[10]`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md index 42316e40802..07cfd4a8619 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md @@ -44,7 +44,7 @@ for (let i = 0; i < 5; i++) { 你應該使用 `for` 循環。 ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` 應該等於 `[1, 2, 3, 4, 5]`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md index 600404d45f9..fe9c13ef30b 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md @@ -36,7 +36,7 @@ while (i < 5) { 你應該使用 `while` 循環。 ```js -assert(code.match(/while/g)); +assert(__helpers.removeJSComments(code).match(/while/g)); ``` `myArray` 應該等於 `[5, 4, 3, 2, 1, 0]`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index 628ae3dcb86..80e75eebae1 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -48,7 +48,7 @@ assert.throws(declared, ReferenceError); ```js assert( /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( - __helpers.removeWhiteSpace(code) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)) ) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md index b6c87acf1f7..3cc5cbc239d 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md @@ -47,7 +47,7 @@ assert( 對 `myArray` 使用 `pop()` 函數。 ```js -assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code)); +assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(__helpers.removeJSComments(code))); ``` `removedFromMyArray` 應該只包含 `["cat", 2]`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md index 37b315235e6..c8f5cb89a62 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md @@ -52,7 +52,7 @@ assert( ```js assert( (function () { - if (code.match(/myArray\[0\]\s*=\s*/g)) { + if (__helpers.removeJSComments(code).match(/myArray\[0\]\s*=\s*/g)) { return true; } else { return false; diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md index 634cd2f46b3..0eabd9b2d48 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md @@ -94,13 +94,13 @@ assert(sequentialSizes(9) === 'High'); 你不應使用 `if` 或 `else` 語句。 ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` 你應該編寫 9 個`case`語句。 ```js -assert(code.match(/case/g).length === 9); +assert(__helpers.removeJSComments(code).match(/case/g).length === 9); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md index b3696fed5ce..e454bb9edbb 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md @@ -28,7 +28,7 @@ assert(product === 5.0); 要使用 `*` 運算符。 ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md index 68345e124f2..d9f9d755f4d 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md @@ -36,7 +36,7 @@ assert(product === 80); 使用 `*` 運算符。 ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md index fbf1c2c468c..094c92922b8 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md @@ -60,7 +60,7 @@ assert(logOutput == 16); ```js assert( /functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test( - code.replace(/\s/g, '') + __helpers.removeJSComments(code).replace(/\s/g, '') ) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md index 34ebcf37f01..29c500031f6 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md @@ -47,7 +47,7 @@ assert(compareEquality('20', 20) === 'Not Equal'); 你應該使用 `===` 運算符 ```js -assert(code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index 7cb1ebf3801..d67ca391cbf 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -47,7 +47,7 @@ const badStr = 'Finn responds, "Let's go!"'; ```js assert( - !/\\/g.test(code) && + !/\\/g.test(__helpers.removeJSComments(code)) && myStr.match( '\\s*\\s*Link\\s*\\s*' ) @@ -57,7 +57,7 @@ assert( 應該要有兩個單引號 `'` 和四個雙引號 `"`。 ```js -assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2); +assert(__helpers.removeJSComments(code).match(/"/g).length === 4 && __helpers.removeJSComments(code).match(/'/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index 6a73a9abbb6..5ab11e8e172 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,7 +66,7 @@ assert.equal(sum([2, 3, 4, 5], 3), 9); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md index 58e02524540..90383d85dcf 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md @@ -45,19 +45,19 @@ switch (val) { 不要使用 `else` 表達式 ```js -assert(!/else/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code))); ``` 不要使用 `if` 表達式 ```js -assert(!/if/g.test(code)); +assert(!/if/g.test(__helpers.removeJSComments(code))); ``` 你應該有至少 4 個 `break` 表達式 ```js -assert(code.match(/break/g).length >= 4); +assert(__helpers.removeJSComments(code).match(/break/g).length >= 4); ``` `chainToSwitch("bob")` 應該返回字符串 `Marley` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md index cae224e413c..64a557a32ba 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md @@ -52,7 +52,7 @@ assert(isLess(15, 10) === false); 不應該使用 `if` 或者 `else` 語句 ```js -assert(!/if|else/g.test(code)); +assert(!/if|else/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md index 099e0a82ef4..04ee15179cb 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md @@ -63,13 +63,13 @@ assert(caseInSwitch(4) === 'delta'); 不能使用任何 `if` 或 `else` 表達式 ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` 你應該有至少 3 個 `break` 表達式 ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md index 5408ecdf244..fd5248ed8f2 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md @@ -35,7 +35,7 @@ myVar = 5; 不應該修改註釋上面的代碼。 ```js -assert(/var a;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code))); ``` `a` 的值應該爲 7。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md index 8b767dfabbc..f03041250cb 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md @@ -35,7 +35,7 @@ assert(difference === 12); 你只能從 `45` 中減去一個數。 ```js -assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code))); +assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md index e7f8ffcf02b..92c44c2455c 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md @@ -40,7 +40,7 @@ assert(myStr === 'Hello World'); 不要修改註釋上面的代碼。 ```js -assert(/myStr = "Jello World"/.test(code)); +assert(/myStr = "Jello World"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md index cf0b7ac11a1..6d9264b44d1 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md @@ -56,19 +56,19 @@ assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000); `studlyCapVar` 在聲明和賦值時都應該使用駝峯命名法。 ```js -assert(code.match(/studlyCapVar/g).length === 2); +assert(__helpers.removeJSComments(code).match(/studlyCapVar/g).length === 2); ``` `properCamelCase` 在聲明和賦值時都應該使用駝峯命名法。 ```js -assert(code.match(/properCamelCase/g).length === 2); +assert(__helpers.removeJSComments(code).match(/properCamelCase/g).length === 2); ``` `titleCaseOver` 在聲明和賦值時都應該使用駝峯命名法。 ```js -assert(code.match(/titleCaseOver/g).length === 2); +assert(__helpers.removeJSComments(code).match(/titleCaseOver/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index c335ff3ef23..810203ad1e9 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -39,9 +39,9 @@ assert(!/undefined/.test(c) && c === 'I am a String!'); ```js assert( - /a = a \+ 1;/.test(code) && - /b = b \+ 5;/.test(code) && - /c = c \+ " String!";/.test(code) + /a = a \+ 1;/.test(__helpers.removeJSComments(code)) && + /b = b \+ 5;/.test(__helpers.removeJSComments(code)) && + /c = c \+ " String!";/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md index 93c13e9e31c..419aed1f677 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md @@ -39,7 +39,7 @@ assert(/happy coder/gi.test(myDog.name)); 不要修改 `myDog` 的定義。 ```js -assert(/"name": "Coder"/.test(code)); +assert(/"name": "Coder"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md index 1f41c91343c..318e60bc105 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md @@ -41,7 +41,7 @@ assert(firstLetterOfLastName === 'L'); 應該使用方括號表示法。 ```js -assert(code.match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md index 7c146fa16aa..5399e966fc8 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(lastLetterOfLastName === 'e'); 您應該使用 `.length` 獲取最後一個字母。 ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md index 23babc53026..12ff754ef5e 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md @@ -39,7 +39,7 @@ assert(thirdLetterOfLastName === 'v'); 應該使用方括號表示法。 ```js -assert(code.match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md index bc403199a36..b19668ae82d 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(secondToLastLetterOfLastName === 'c'); 您應該使用 `.length` 獲取倒數第二個字母。 ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md index 7bb646a50aa..6f4130c0398 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md @@ -54,7 +54,7 @@ function findGreaterOrEqual(a, b) { `checkSign` 應該使用多個三元運算符。 ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(__helpers.removeJSComments(code))); ``` `checkSign(10)` 應該返回字符串 `positive`。 注意區分大寫字母和小寫字母。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index afa9caeb654..a90057f37de 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,7 +59,7 @@ assert.deepStrictEqual(countdown(5), [5, 4, 3, 2, 1]); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index c793ef04a4e..11e6f7afe4e 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,7 +26,7 @@ assert(Array.isArray(rangeOfNumbers(5, 10))); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index 959f63f9ecd..968ee7c3407 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -42,7 +42,7 @@ function findGreater(a, b) { `checkEqual` 應該使用條件運算符。 ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(__helpers.removeJSComments(code))); ``` `checkEqual(1, 2)` 應該返回字符串 `Not Equal` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md index c88f18ce8c1..417807e54bc 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md @@ -34,7 +34,7 @@ const a = parseInt("11", 2); `convertToInteger` 應該使用 `parseInt()` 函數。 ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("10011")` 應該返回一個數字。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md index 43c13f31a2e..38e8a654923 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md @@ -26,7 +26,7 @@ const a = parseInt("007"); `convertToInteger` 中應該使用 `parseInt()` 函數。 ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("56")` 應該返回一個數字。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md index 46936d8aaab..c903d075903 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md @@ -83,14 +83,14 @@ assert(typeof phoneticLookup('') === 'undefined'); 請不要修改 `return` 語句 ```js -assert(code.match(/return\sresult;/)); +assert(__helpers.removeJSComments(code).match(/return\sresult;/)); ``` 請不要使用 `case`、`switch`、`if` 語句 ```js assert( - !/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) + !/case|switch|if/g.test(__helpers.removeJSComments(code).replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md index bf6b70f575b..c89612735f9 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md @@ -53,7 +53,7 @@ assert( 你不應該直接使用 `dog`、`ran`、`big` 或 `quickly` 來創建 `wordBlanks`。 ```js -const newCode = removeAssignments(code); +const newCode = removeAssignments(__helpers.removeJSComments(code)); assert( !/dog/.test(newCode) && !/ran/.test(newCode) && diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md index 16f9866f0ac..1c119f91b53 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md @@ -50,7 +50,7 @@ assert(testConsole()); ```js const functionStr = reusableFunction && __helpers.removeWhiteSpace(reusableFunction.toString()); -const codeWithoutFunction = __helpers.removeWhiteSpace(code).replace(/reusableFunction\(\)\{/g, ''); +const codeWithoutFunction = __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).replace(/reusableFunction\(\)\{/g, ''); assert(/reusableFunction\(\)/.test(codeWithoutFunction)); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md index 5e52440ccf1..66a85f714b2 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md @@ -25,7 +25,7 @@ assert(power == 8); 你調用 `raiseToPower` 函數時,傳遞參數的順序應正確。 ```js -assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); +assert(__helpers.removeJSComments(code).match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md index 11cd720ac44..3ad28c9d848 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md @@ -37,7 +37,7 @@ assert(result == 9); 你應該調用 `getNine` 函數。 ```js -assert(code.match(/getNine\(\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/getNine\(\)/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md index fb19823bd27..45ba626819d 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md @@ -27,25 +27,25 @@ assert(netWorkingCapital === 2); 代碼中不應該有拼寫錯誤的變量實例。 ```js -assert(!code.match(/recievables/g)); +assert(!__helpers.removeJSComments(code).match(/recievables/g)); ``` 應在代碼中聲明並正確使用 `receivables` 變量。 ```js -assert(code.match(/receivables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/receivables/g).length == 2); ``` 代碼中不應該有拼寫錯誤的變量實例。 ```js -assert(!code.match(/payable;/g)); +assert(!__helpers.removeJSComments(code).match(/payable;/g)); ``` 應在代碼中聲明並正確使用 `payables` 變量。 ```js -assert(code.match(/payables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/payables/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index 113b7a5e7c6..f21d8d1059c 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -37,13 +37,13 @@ const allSameQuotes = 'I\'ve had a perfectly wonderful evening, but this wasn\'t 你應通過更改或轉義來修復 `href` 的值 `#Home` 周圍的引號。 ```js -assert(code.match(//g)); +assert(__helpers.removeJSComments(code).match(//g)); ``` 你應該在整個字符串外圍保留雙引號。 ```js -assert(code.match(/"

.*?<\/p>";/g)); +assert(__helpers.removeJSComments(code).match(/"

.*?<\/p>";/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md index 818088e3785..e712f96c96c 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md @@ -37,25 +37,25 @@ for (let k = 0; k < len; k++) { 應該設置循環的初始條件,使循環從第一個索引開始。 ```js -assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?=\s*?0\s*?;/g).length == 1); ``` 應修復循環的初始條件,使循環從索引 0 開始。 ```js -assert(!code.match(/i\s?=\s*?1\s*?;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s?=\s*?1\s*?;/g)); ``` 應該設置循環的終止條件,使循環在最後一個索引處停止。 ```js -assert(code.match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); ``` 應該修復循環的終止條件,使循環在索引爲字符串長度減 1 的位置停止。 ```js -assert(!code.match(/i\s*?<=\s*?len;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?<=\s*?len;/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md index e9a3695c6dc..ff1db8f1e4f 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md @@ -21,7 +21,7 @@ dashedName: catch-unclosed-parentheses-brackets-braces-and-quotes 應該修復數組缺少的部分。 ```js -assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); +assert(__helpers.removeJSComments(code).match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); ``` 應該修復 `.reduce()` 方法缺少的部分。 控制檯應該輸出 `Sum of array values is: 6`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md index 6f80b4306a8..329d31e1c85 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md @@ -43,7 +43,7 @@ assert(result == 'Not equal!'); 條件語句可以使用 `==` 或 `===` 來測試是否相等。 ```js -assert(code.match(/x\s*?===?\s*?y/g)); +assert(__helpers.removeJSComments(code).match(/x\s*?===?\s*?y/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md index 7a684f366c5..0aa2b6917bd 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md @@ -31,13 +31,13 @@ function loopy() { 你應該在`for`循環的終止條件(中間部分)中更改比較運算符。 ```js -assert(code.match(/i\s*?<=\s*?4;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?<=\s*?4;/g).length == 1); ``` 你應該修改比較運算符來避免出現死循環。 ```js -assert(!code.match(/i\s*?!=\s*?4;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?!=\s*?4;/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index a1d3679bc89..dccd5ea46df 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -23,7 +23,7 @@ dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-c 你應該使用 `console.log()` 來打印 `output` 變量。 ```js -assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/console\.log\(output\)/)); ``` 你應該使用 `console.clear()` 來清除瀏覽器控制檯。 @@ -31,7 +31,7 @@ assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console.clear\(\)/) ); ``` @@ -41,7 +41,7 @@ assert( ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console\.log\(output\)[\s\S]*console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md index 60788da7ddb..29ad35ea331 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md @@ -29,7 +29,7 @@ console.log('Hello world!'); 應使用 `console.log()` 來檢查變量 `a` 的值。 ```js -assert(code.match(/console\.log\(a\)/g)); +assert(__helpers.removeJSComments(code).match(/console\.log\(a\)/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md index 8c8d66da89c..c16ca4f29d7 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md @@ -32,19 +32,19 @@ JavaScript 有七種原始(不可變)數據類型: `Boolean`,`Null`,`U 應在兩個 `console.log()` 語句中使用 `typeof` 來檢查變量的類型。 ```js -assert(code.match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); ``` 應使用 `typeof` 來檢查變量 `seven` 的類型。 ```js -assert(code.match(/typeof[\( ]seven\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]seven\)?/g)); ``` 應使用 `typeof` 來檢查變量 `three` 的類型。 ```js -assert(code.match(/typeof[\( ]three\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]three\)?/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index 212ee120458..fa22bba725d 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -87,13 +87,13 @@ console.log(i); 代碼中不應該出現 `var`。 ```js -assert(!code.match(/var/g)); +assert(!__helpers.removeJSComments(code).match(/var/g)); ``` `if` 語句中聲明的變量 `i` 應該等於字符串 `block scope`。 ```js -assert(code.match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); +assert(__helpers.removeJSComments(code).match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); ``` `checkScope()` 應該返回字符串 `function scope`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index 51cd70743fb..de1cd013458 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,7 +32,7 @@ const myPromise = new Promise((resolve, reject) => { ```js assert( - code.match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) ); ``` @@ -40,7 +40,7 @@ assert( ```js assert( - code.match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md index c38a198165d..765f42d2fe1 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md @@ -32,7 +32,7 @@ promise 應該接收一個函數做爲參數,該函數應該包含 `resolve` ```js assert( - code.match( + __helpers.removeJSComments(code).match( /Promise\s*\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g ) ); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md index 68837354edf..8b11400afdf 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md @@ -25,14 +25,14 @@ dashedName: create-a-module-script 應該創建一個 `script` 標籤。 ```js -assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); +assert(__helpers.removeJSComments(code).match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); ``` `script` 標籤應該有一個值爲 `module` 的 `type` 屬性。 ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g ) ); @@ -42,7 +42,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g ) ); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md index 5dca83d5f7f..15b8da7e386 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md @@ -38,7 +38,7 @@ export default function(x, y) { ```js assert( - code.match( + __helpers.removeJSComments(code).match( /export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g ) ); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md index d56dbab663d..2c0fb1fb0e2 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md @@ -75,7 +75,7 @@ assert.match(code, /(`.*\${.*}.*`)/); 應該使用遍歷。 ```js -assert(code.match(/for|map|reduce|forEach|while/)); +assert(__helpers.removeJSComments(code).match(/for|map|reduce|forEach|while/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md index fadd04bc1e1..c9de23aa55c 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md @@ -34,7 +34,7 @@ myPromise.then(result => { ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.then\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.then\(/g) ); ``` @@ -50,7 +50,7 @@ assert(resultIsParameter); assert( resultIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.then\(.*?result.*?console.log\(result\).*?\)/) ); ``` @@ -60,7 +60,7 @@ assert( ## --after-user-code-- ```js -const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(code)); +const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md index e192c9f2cfb..1e6fda38adb 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md @@ -28,7 +28,7 @@ myPromise.catch(error => { ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.catch\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.catch\(/g) ); ``` @@ -44,7 +44,7 @@ assert(errorIsParameter); assert( errorIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.catch\(.*?error.*?console.log\(error\).*?\)/) ); ``` @@ -54,7 +54,7 @@ assert( ## --after-user-code-- ```js -const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(code)); +const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md index 4e869300bd9..ca3007393ac 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md @@ -25,7 +25,7 @@ import add from "./math_functions.js"; 應從 `math_functions.js` 中正確導入 `subtract`。 ```js -assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); +assert(__helpers.removeJSComments(code).match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md index 3b0a896ade4..e50bc739f84 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md @@ -36,19 +36,19 @@ console.log(s); 不要替換 `const` 關鍵字。 ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `s` 應該是一個常量變量(通過使用 `const`)。 ```js -assert(code.match(/const\s+s/g)); +assert(__helpers.removeJSComments(code).match(/const\s+s/g)); ``` 不要改變原數組的聲明。 ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g )); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md index aef3600f631..26bf21fc939 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md @@ -34,19 +34,19 @@ console.log(obj); 不要替換 `const` 關鍵字。 ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `MATH_CONSTANTS` 應該爲一個常量(使用 `const`)。 ```js -assert(code.match(/const\s+MATH_CONSTANTS/g)); +assert(__helpers.removeJSComments(code).match(/const\s+MATH_CONSTANTS/g)); ``` 不要改變 `MATH_CONSTANTS` 的原始聲明。 ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g )); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md index 81172e0f7e8..c78d3b5edc8 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md @@ -32,7 +32,7 @@ import { add, subtract } from './math_functions.js'; ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); @@ -42,7 +42,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index 52502e247c6..4a530a5bdb7 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -44,7 +44,7 @@ assert(increment(5) === 6); 參數 `value` 的默認值是 `1`。 ```js -assert(code.match(/value\s*=\s*1/g)); +assert(__helpers.removeJSComments(code).match(/value\s*=\s*1/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md index 0a5d503aebf..fbb5d7b3051 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md @@ -31,7 +31,7 @@ myMathModule.subtract(5,3); ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g ) ); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index 7b70a6d5c30..102d5159afd 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -66,7 +66,7 @@ assert( 應使用 `class` 關鍵字。 ```js -assert(code.match(/class/g)); +assert(__helpers.removeJSComments(code).match(/class/g)); ``` `Vegetable` 可以被實例化。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md index f3886aa8e21..9e448f5e18d 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md @@ -51,7 +51,7 @@ assert(b === 8); 應使用數組解構來交換 `a` 和 `b` 的值。 ```js -assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code)); +assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index efc74c3fe25..96b80da4256 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -43,8 +43,8 @@ const { johnDoe: { age: userAge, email: userEmail }} = user; ```js assert( - !code.match(/lowToday = LOCAL_FORECAST\.today\.low/g) && - !code.match(/highToday = LOCAL_FORECAST\.today.high/g) + !__helpers.removeJSComments(code).match(/lowToday = LOCAL_FORECAST\.today\.low/g) && + !__helpers.removeJSComments(code).match(/highToday = LOCAL_FORECAST\.today.high/g) ); ``` @@ -52,7 +52,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(low\s*:\s*lowToday[^}]*|[^,]*,\s*low\s*:\s*lowToday\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); @@ -62,7 +62,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday,?\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index 8b01d1547e7..e39fac55993 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -34,8 +34,8 @@ const { name: userName, age: userAge } = user; ```js assert( - !code.match(/highToday = HIGH_TEMPERATURES\.today/g) && - !code.match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) + !__helpers.removeJSComments(code).match(/highToday = HIGH_TEMPERATURES\.today/g) && + !__helpers.removeJSComments(code).match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) ); ``` @@ -43,7 +43,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(today\s*:\s*highToday[^}]*|[^,]*,\s*today\s*:\s*highToday\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); @@ -53,7 +53,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(tomorrow\s*:\s*highTomorrow[^}]*|[^,]*,\s*tomorrow\s*:\s*highTomorrow\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 7c45dfb0974..85624a58aac 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,7 +43,7 @@ const { name, age } = user; ```js assert( - !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !__helpers.removeJSComments(code).match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -51,7 +51,7 @@ assert( ```js assert( - code.match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` @@ -59,7 +59,7 @@ assert( ```js assert( - code.match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md index b26e17b13f2..4092b3a8f51 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md @@ -50,13 +50,13 @@ assert(half(stats) === 28.015); 應該使用解構賦值。 ```js -assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/half=\({\w+,\w+}\)/)); ``` 應該使用解構參數。 ```js -assert(!code.match(/stats\.max|stats\.min/)); +assert(!__helpers.removeJSComments(code).match(/stats\.max|stats\.min/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index f019f8244d5..5e9816e3db2 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -47,7 +47,7 @@ assert.deepEqual(_testArr, [1, 2, 3, 4, 5]) 不應該使用 `Array.slice()`。 ```js -assert(!code.match(/\.\s*slice\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*slice\s*\(/)); ``` You should use the rest syntax. diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md index 6747be0ae8a..74b4a3c6686 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md @@ -42,7 +42,7 @@ export { add, subtract }; ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+uppercaseString|export\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)})/g ) ); @@ -52,7 +52,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+lowercaseString|export\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)})/g ) ); diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md index a875608a13c..6287d5d3d2f 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md @@ -57,7 +57,7 @@ assert(sum() === 0); `sum` 應是一個箭頭函數,對 `args` 參數使用 rest 操作符語法(`...`)。 ```js -assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/sum=\(\.\.\.args\)=>/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md index 9fbdb7146e9..ccbc940496a 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md @@ -55,7 +55,7 @@ assert(arr2.every((v, i) => v === arr1[i]) && arr2.length); 應使用展開操作符 `...` 來複制 `arr1`。 ```js -assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); +assert(__helpers.removeJSComments(code).match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); ``` 當 `arr1` 改變的時候,`arr2` 應保持不變。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md index a3e2c5fbf65..4f1093881f2 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md @@ -54,7 +54,7 @@ assert.match(code, /const\s+myConcat/g); ```js assert( - /myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) && + /myConcat=\(\w+,\w+\)=>/.test(__helpers.removeJSComments(code).replace(/\s/g, '')) && typeof myConcat === 'function' ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 94522929a9f..383ae8c56c3 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,14 +39,14 @@ const person = { 不應使用傳統的函數定義方法。 ```js -assert(!code.match(/function/)); +assert(!__helpers.removeJSComments(code).match(/function/)); ``` `setGear` 應是一個聲明函數。 ```js assert( - typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/) + typeof bicycle.setGear === 'function' && __helpers.removeJSComments(code).match(/setGear\s*\(.+\)\s*\{/) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md index 39bc0aebacc..45dc24705de 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md @@ -43,7 +43,7 @@ assert.deepEqual( 不要使用 `key:value`。 ```js -assert(!code.match(/:/g)) +assert(!__helpers.removeJSComments(code).match(/:/g)) ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md index 71672cd4913..e0c3fd4936c 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md @@ -30,13 +30,13 @@ arr.push(4, 5, 6); 應該使用 `concat` 方法。 ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` 不能使用 `push` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?push/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?push/g)); ``` 不能改變 `first` 數組。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md index 6912fd3a29d..46f1c94de1d 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md @@ -31,7 +31,7 @@ dashedName: apply-functional-programming-to-convert-strings-to-url-slugs 不能使用 `replace` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `urlSlug("Winter Is Coming")` 應返回 `winter-is-coming`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md index b2f4eda2d72..6de371e4730 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md @@ -27,13 +27,13 @@ const str = arr.join(" "); 應使用 `join` 方法。 ```js -assert(code.match(/\.join/g)); +assert(__helpers.removeJSComments(code).match(/\.join/g)); ``` 不能使用 `replace` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `sentensify("May-the-force-be-with-you")` 應返回一個字符串。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md index c82569f3d61..e129ec8cfdc 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md @@ -25,7 +25,7 @@ dashedName: combine-two-arrays-using-the-concat-method 應該使用 `concat` 方法。 ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` 不應該改變 `first` 數組。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md index 0c4ff587740..8474537b902 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md @@ -47,7 +47,7 @@ assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_ 你的代碼不應該使用 `map` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?map/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?map/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md index 624fe60617c..4d1ddca5581 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md @@ -43,7 +43,7 @@ assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFi 你的代碼不應該使用 `filter` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?filter/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?filter/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md index 21c948e08ee..00f77540005 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md @@ -77,7 +77,7 @@ assert(add(11)(22)(33) === 66); 應返回 `x + y + z` 的最終結果。 ```js -assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); +assert(__helpers.removeJSComments(code).match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md index b43097821fd..65898a31cba 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md @@ -30,13 +30,13 @@ cities.splice(3, 1); 你的代碼中應使用 `slice` 方法。 ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` 不能使用 `splice` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?splice/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?splice/g)); ``` You should not mutate the original array passed to the function. diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md index e096a3d94a9..64c4ff4f2dd 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md @@ -28,7 +28,7 @@ const newArray = arr.slice(1, 3); 應該使用 `slice` 方法。 ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` 不能改變 `inputAnim` 變量。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md index cf6eedde997..65e593ef154 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md @@ -47,7 +47,7 @@ JavaScript 的默認排序方法是 Unicode 值順序排序,有時可能會得 應該使用 `sort` 方法。 ```js -assert(code.match(/\.sort/g)); +assert(__helpers.removeJSComments(code).match(/\.sort/g)); ``` `alphabeticalOrder(["a", "d", "c", "a", "z", "g"])` 應返回 `["a", "a", "c", "d", "g", "z"]`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md index 1aba206b00a..70c551162f9 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md @@ -33,7 +33,7 @@ const byDigits = otherString.split(/\d/); 應該使用 `split` 方法。 ```js -assert(code.match(/\.split/g)); +assert(__helpers.removeJSComments(code).match(/\.split/g)); ``` `splitify("Hello World,I-am code")` 應返回 `["Hello", "World", "I", "am", "code"]`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index 69dd34bd61b..452f99ff4cb 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), 不應該使用 `for`、`while` 或者 `forEach`。 ```js -assert(!code.match(/for|while|forEach/g)); +assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ``` 應該使用 `map`、`filter` 或者 `reduce`。 @@ -36,7 +36,7 @@ assert(!code.match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md index 8de8e231b88..a4e68799b74 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md @@ -31,7 +31,7 @@ numbers.every(function(currentValue) { 應使用`every`方法。 ```js -assert(code.match(/\.every/g)); +assert(__helpers.removeJSComments(code).match(/\.every/g)); ``` `checkPositive([1, 2, 3, -4, 5])` 應返回 `false`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md index 3d58580472f..9e77b12dc26 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md @@ -46,13 +46,13 @@ assert( 應使用 `filter` 方法。 ```js -assert(code.match(/\s*\.\s*filter/g)); +assert(__helpers.removeJSComments(code).match(/\s*\.\s*filter/g)); ``` 不能使用 `for` 循環。 ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` `filteredList` 應該等於 `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"}, {"title": "Batman Begins", "rating": "8.3"}]`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 043ab703c1c..e6f3ed505a5 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,13 +52,13 @@ assert( 不能使用 `for` 循環。 ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); ``` 你的代碼應使用 `map` 方法。 ```js -assert(code.match(/\.map/g)); +assert(__helpers.removeJSComments(code).match(/\.map/g)); ``` `ratings` 應該等於 `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"},{"title": "Batman Begins", "rating": "8.3"}, {"title": "Avatar", "rating": "7.9"}]`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md index 7a697c34e5a..61753ec53b6 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md @@ -66,7 +66,7 @@ assert( 應該使用`reduce`方法。 ```js -assert(code.match(/\.reduce/g)); +assert(__helpers.removeJSComments(code).match(/\.reduce/g)); ``` `getRating(watchList)` 應該等於 8.675。 @@ -78,7 +78,7 @@ assert(getRating(watchList) === 8.675); 不能使用 `for` 循環。 ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` 在修改 `watchList` 對象後應該返回正確的輸出。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md index ed2c5c9b4d5..01ee32d8ca9 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md @@ -31,7 +31,7 @@ numbers.some(function(currentValue) { 應該使用 `some` 方法。 ```js -assert(code.match(/\.some/g)); +assert(__helpers.removeJSComments(code).match(/\.some/g)); ``` `checkPositive([1, 2, 3, -4, 5])` 應返回 `true`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md index c9c461f285c..a980923c638 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md @@ -39,7 +39,7 @@ assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4]); 代碼中不應使用 `Array.prototype.flat()` 或 `Array.prototype.flatMap()` 方法。 ```js -assert(!code.match(/\.\s*flat\s*\(/) && !code.match(/\.\s*flatMap\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*flat\s*\(/) && !__helpers.removeJSComments(code).match(/\.\s*flatMap\s*\(/)); ``` 不應使用全局變量。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md index 4879f135ce2..0d18b1c14af 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md @@ -49,7 +49,7 @@ Bird.prototype = { `Dog.prototype` 應該被設置爲一個新對象。 ```js -assert(/Dog\.prototype\s*?=\s*?{/.test(code)); +assert(/Dog\.prototype\s*?=\s*?{/.test(__helpers.removeJSComments(code))); ``` `Dog.prototype` 應該擁有屬性 `numLegs`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md index f8992b9370f..2906fc5bab3 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md @@ -61,7 +61,7 @@ assert(typeof beagle !== 'undefined'); ```js assert( /(let|const|var)\s{1,}duck\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` @@ -71,7 +71,7 @@ assert( ```js assert( /(let|const|var)\s{1,}beagle\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md index 4a0b5c3edc5..fcd8b9935c4 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md @@ -61,7 +61,7 @@ assert.deepEqual(prototypeProps, ['numLegs']); 在不使用內置方法 `Object.keys()` 的前提下完成這個挑戰。 ```js -assert(!/\Object.keys/.test(code)); +assert(!/\Object.keys/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md index 83353dac14f..0de9c087b20 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md @@ -43,7 +43,7 @@ assert(dog.sayLegs() === 'This dog has 4 legs.'); 應該使用 `this` 關鍵字來訪問 `dog` 對象的 `numLegs` 屬性值。 ```js -assert(code.match(/this\.numLegs/g)); +assert(__helpers.removeJSComments(code).match(/this\.numLegs/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md index eb6456276b0..23512116fe4 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md @@ -51,7 +51,7 @@ assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1); 在不使用內置方法 `Object.keys()` 的前提下完成這個挑戰。 ```js -assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); +assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(__helpers.removeJSComments(code))); ``` 你應該解決這個挑戰,而不是硬編碼 `ownProps` 數組。 @@ -59,7 +59,7 @@ assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); ```js assert( !/\[\s*(?:'|")(?:name|numLegs)|(?:push|concat)\(\s*(?:'|")(?:name|numLegs)/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md index 36d37b86b28..21406c0f06d 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md @@ -55,7 +55,7 @@ assert(joinDogFraternity(new Dog('')) === true); `joinDogFraternity` 中應該用到 `constructor` 屬性。 ```js -assert(/\.constructor/.test(code) && !/instanceof/.test(code)); +assert(/\.constructor/.test(__helpers.removeJSComments(code)) && !/instanceof/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md index 27f17a5c196..da5073ce89d 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md @@ -29,13 +29,13 @@ JavaScript 中的一個常見模式就是,函數在聲明後立刻執行: 該函數應該是匿名的。 ```js -assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, ''))); +assert(/\((function|\(\))(=>|\(\)){?/.test(__helpers.removeJSComments(code).replace(/\s/g, ''))); ``` 函數應該在表達式的末尾有括號,以便立即調用它。 ```js -assert(/\(.*(\)\(|\}\(\))\)/.test(code.replace(/[\s;]/g, ''))); +assert(/\(.*(\)\(|\}\(\))\)/.test(__helpers.removeJSComments(code).replace(/[\s;]/g, ''))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md index b954e0d84c6..1025c92bf5d 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md @@ -42,7 +42,7 @@ duck.hasOwnProperty("name"); 你的代碼應該展示 `Object.prototype` 是 `Dog.prototype` 的原型。 ```js -assert(/Object\.prototype\.isPrototypeOf/.test(code)); +assert(/Object\.prototype\.isPrototypeOf/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md index bd8ebc432c1..99d54bf59fa 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md @@ -35,7 +35,7 @@ Bird.prototype.isPrototypeOf(duck); `Dog.prototype` 應該是 `beagle` 的 `prototype`。 ```js -assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code)); +assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md index b678702e555..c6ccbc91eb4 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md @@ -52,7 +52,7 @@ assert(hound instanceof Dog); 你的代碼中應該使用 `new` 操作符來創建 `Dog` 構造函數的新實例。 ```js -assert(code.match(/new/g)); +assert(__helpers.removeJSComments(code).match(/new/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md index f403c20580b..eeb724b3518 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md @@ -43,7 +43,7 @@ ducky.getHatchedEggCount(); `weight` 屬性應該是一個私有變量,值應該是 `15`。 ```js -assert(code.match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); ``` 你的代碼應該在 `Bird` 中創建一個名爲 `getWeight` 方法,該方法返回私有變量 `weight`。 @@ -55,7 +55,7 @@ assert(new Bird().getWeight() === 15); 你的 `getWeight` 函數應該返回私有變量 `weight`。 ```js -assert(code.match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); +assert(__helpers.removeJSComments(code).match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md index 11f0fc4aed8..2f9ecb6fac5 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md @@ -29,13 +29,13 @@ console.log(duck.name); 你應該使用 `console.log` 來將 `dog` 對象的 `name` 屬性值輸出到控制檯。 ```js -assert(/console.log\(.*dog\.name.*\)/g.test(code)); +assert(/console.log\(.*dog\.name.*\)/g.test(__helpers.removeJSComments(code))); ``` 你應該使用 `console.log` 來將 `dog` 對象的 `numLegs` 屬性值輸出到控制檯。 ```js -assert(/console.log\(.*dog\.numLegs.*\)/g.test(code)); +assert(/console.log\(.*dog\.numLegs.*\)/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md index cc66c2bfd54..ec61864eb1d 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md @@ -53,7 +53,7 @@ assert(typeof myHouse.numBedrooms === 'number'); 應該使用 `instanceof` 操作符驗證 `myHouse` 這個對象是 `House` 構造函數的一個實例。 ```js -assert(/myHouse\s*instanceof\s*House/.test(code)); +assert(/myHouse\s*instanceof\s*House/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md index 22cac0bf419..84b264eb896 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md @@ -75,7 +75,7 @@ assert(!myRegex.test('EleanorRoosevelt')); 你應該使用 `.test()` 方法來檢測正則表達式。 ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` 你的返回結果應該爲 `true`。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md index 04deb9c7a61..30159d1c767 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md @@ -51,7 +51,7 @@ assert(codingRegex.source === 'coding'); 您應該使用 `.match()` 方法。 ```js -assert(code.match(/\.match\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.match\(.*\)/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md index aadbaa0ecd8..9e7e179e472 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md @@ -31,7 +31,7 @@ huRegex.test(hugStr); 你應該使用 `.test()` 方法。 ```js -assert(code.match(/\.test\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.test\(.*\)/)); ``` 你應該在你的正則表達式 `unRegex` 中使用通配符。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index 2441dd76ac3..78158ac3e93 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -52,7 +52,7 @@ assert(!waldoRegex.test('Somewhere is hiding in this text.')); 你應該使用你的正則表達式對字符串執行文字匹配。 ```js -assert(!/\/.*\/i/.test(code)); +assert(!/\/.*\/i/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md index c333840f06a..53edfcd012b 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md @@ -27,13 +27,13 @@ assert(result === 'Hello, World!'); 你不應該使用 `String.prototype.trim()` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?trim/)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?trim/)); ``` `result` 變量的值不應該是一個字符串。 ```js -assert(!code.match(/result\s*=\s*["'`].*?["'`]/)); +assert(!__helpers.removeJSComments(code).match(/result\s*=\s*["'`].*?["'`]/)); ``` `hello` 變量的值不應更改。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md index f7ca692246e..1fa91cdaece 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md @@ -37,7 +37,7 @@ wrongText.replace(silverRegex, "blue"); 你應該使用 `.replace()` 搜索並替換。 ```js -assert(code.match(/\.replace\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.replace\(.*\)/)); ``` 你的正則表達式應該將字符串 `one two three` 更改爲字符串 `three two one` @@ -49,7 +49,7 @@ assert(result === 'three two one'); 你不應該改變最後一行。 ```js -assert(code.match(/result\s*=\s*str\.replace\(.*?\)/)); +assert(__helpers.removeJSComments(code).match(/result\s*=\s*str\.replace\(.*?\)/)); ``` `fixRegex` 應該至少使用三個抓取組。 diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md index cf1b4193fa2..caad72f4fd3 100644 --- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md +++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md @@ -31,7 +31,7 @@ testRegex.test(testStr); 你應該使用 `.test()` 方法來檢測正則表達式。 ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` 你的返回結果應該爲 `true`。 diff --git a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md index dc1b6f4801f..30fae60dd06 100644 --- a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md +++ b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md @@ -15,12 +15,9 @@ You should have `if number >= 10:` within the `for` loop. ```js ({ - test: () => { - const transformedCode = code.replace(/\r/g, ""); - const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); - const { function_body } = verify_card_number; - - assert.match(function_body, /if +number +>= +10:/); + test: () => + { + assert(runPython(`_Node(_code).find_function("verify_card_number").find_for_loops()[1].find_ifs()[0].find_conditions()[0].is_equivalent("number >= 10")`)); } }) ``` diff --git a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md index 937da29e859..d90f85fed85 100644 --- a/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md +++ b/curriculum/challenges/chinese-traditional/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md @@ -115,7 +115,10 @@ from importlib import reload reload(probability_calculator) probability_calculator.random.seed(95) -def test_hat_draw(self): + +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw(self): hat = probability_calculator.Hat(red=5,blue=2) actual = hat.draw(2) expected = ['blue', 'red'] @@ -140,6 +143,49 @@ t.result.wasSuccessful() }); ``` +The `draw` method should behave correctly when the number of balls to extract is bigger than the number of balls in the hat. + +```js +({ + test: () => { + pyodide.FS.writeFile("/home/pyodide/probability_calculator.py", code); + pyodide.FS.writeFile( + "/home/pyodide/test_module.py", + ` +import unittest +import probability_calculator +from importlib import reload + +reload(probability_calculator) + +probability_calculator.random.seed(95) +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw_2(self): + hat = probability_calculator.Hat(yellow=5,red=1,green=3,blue=9,test=1) + actual = hat.draw(20) + expected = ['yellow', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'green', 'green', 'green', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'test'] + self.assertEqual(actual, expected, 'Expected hat draw to return all items from hat contents.') + actual = len(hat.contents) + expected = 0 + self.assertEqual(actual, expected, 'Expected hat draw to leave no items in contents.') + ` + ); + const testCode = ` +from unittest import main +import test_module +from importlib import reload + +reload(test_module) +t = main(module='test_module', exit=False) +t.result.wasSuccessful() +`; + const out = __pyodide.runPython(testCode); + assert(out); + }, +}); +``` + The `experiment` method should return a different probability. @@ -221,7 +267,8 @@ class Hat: def draw(self, number): drawn = [] if number >= len(self.contents): - return self.contents + drawn.extend(self.contents) + self.contents = [] else: for i in range(number): drawn.append( @@ -229,8 +276,7 @@ class Hat: ) return drawn -def experiment(hat, expected_balls, num_balls_drawn, num_experiments): - +def experiment(hat, expected_balls, num_balls_drawn, num_experiments): expected_balls_list = [] drawn_list = [] success = 0 @@ -248,12 +294,7 @@ def experiment(hat, expected_balls, num_balls_drawn, num_experiments): except: continue if len(exp_ball_list_copy) == 0: - success += 1 - - - - - probability = success/num_experiments - + success += 1 + probability = success/num_experiments return probability ``` diff --git a/curriculum/challenges/chinese-traditional/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md b/curriculum/challenges/chinese-traditional/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md index 19ea0d3c265..397f8d13d67 100644 --- a/curriculum/challenges/chinese-traditional/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md +++ b/curriculum/challenges/chinese-traditional/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md @@ -48,9 +48,9 @@ The initial declaration of the `homeworkStack` should not be changed. ```js assert( - code.match(/=/g).length === 1 && + __helpers.removeJSComments(code).match(/=/g).length === 1 && /homeworkStack\s*=\s*\["BIO12"\s*,\s*"HIS80"\s*,\s*"MAT122"\s*,\s*"PSY44"\]/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md index fe3376a81a8..65249667521 100644 --- a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md @@ -2,7 +2,6 @@ id: 5f356ed60a5decd94ab66986 title: 步驟 22 challengeType: 0 -removeComments: false dashedName: step-22 --- diff --git a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md index 295d06e8a94..d5d331a2759 100644 --- a/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md +++ b/curriculum/challenges/chinese-traditional/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md @@ -40,15 +40,15 @@ assert(canvasFilter === 'blur(2px)'); ## --seed-contents-- ```css +--fcc-editable-region-- .canvas { width: 500px; height: 600px; background-color: #4d0f00; overflow: hidden; ---fcc-editable-region-- ---fcc-editable-region-- } +--fcc-editable-region-- .frame { border: 50px solid black; diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md index 1fcd57382fa..97d081cbce5 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md @@ -7,7 +7,7 @@ dashedName: step-55 # --description-- -Inside, the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. +Inside the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. Now, you should see a category displayed underneath each post topic. diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md index eca279b42fe..b69803b87d0 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md @@ -7,9 +7,11 @@ dashedName: step-43 # --description-- -Notice how the `10` value is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. +Notice how the number `10` is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the numbers values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. -To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. Leave the function empty for now. +To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. The parameters of `a` and `b` represent the number values in the array that will be sorted. + +Leave the function empty for now. # --hints-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md index d253c95b6c6..ee57c994e55 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md @@ -26,7 +26,7 @@ assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\( Your callback function should return `a - b`. ```js -assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+a\s*-\s*b\s*;?\s*}\s*\)/); +assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+(?:parseInt)?(?:Number)?\(?a\)?\s*-\s*(?:parseInt)?(?:Number)?\(?b\)?\s*;?\s*}\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b514741ae01..b1b54dda895 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -11,6 +11,8 @@ In your `evalFormula`, declare an `idToText` arrow function which takes an `id` Your `idToText` function should return the result of calling `.find()` on the `cells` array with a callback function that takes an `cell` parameter and returns `cell.id === id`. +Both of your functions should use implicit returns. + # --hints-- You should declare an `idToText` variable in your `evalFormula` function. diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md index 57110b715a9..37487b1771c 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md @@ -23,13 +23,7 @@ Open up the console to see the result. # --hints-- -You should call `.repeat()` on your two `" "` strings. - -```js -assert.lengthOf(code.match(/" ".repeat/g), 2); -``` - -Your `" "` strings should be repeated `rowCount - rowNumber` times. +You should call `.repeat()` on your `" "` strings to repeat them `rowCount - rowNumber` times. ```js assert.equal(padRow(1, 3), " # "); diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md index 3306b1a478b..4170d3bd12b 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md @@ -3,7 +3,6 @@ id: 660f3ce51f70571e1c5227c8 title: Step 69 challengeType: 1 dashedName: step-69 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md index ea0a831040f..7a939244a7c 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md @@ -3,7 +3,6 @@ id: 660f3dd626be3a1ffe27e5d1 title: Step 70 challengeType: 1 dashedName: step-70 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md index e30d808ccb6..b676558ec74 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md @@ -3,7 +3,6 @@ id: 660f4f79e2a82a4e92290f44 title: Step 101 challengeType: 1 dashedName: step-101 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md index dc683e61ce5..3f088de2c91 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md @@ -3,7 +3,6 @@ id: 660f53ad3d39175c5d4335ac title: Step 108 challengeType: 1 dashedName: step-108 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md new file mode 100644 index 00000000000..286128cc2cf --- /dev/null +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md @@ -0,0 +1,74 @@ +--- +id: 662693f82c91a66be46c881b +title: Step 1 +challengeType: 1 +dashedName: step-1 +--- + +# --description-- + +A teacher has finished grading their students' tests and needs your help to calculate the average score for the class. + +Complete the `getAverage` function which takes in an array of test scores and returns the average score. + +The average is calculated by adding up all the scores and dividing by the total number of scores. + +```js +average = sum of all scores / total number of scores +``` + +A couple of function calls have been provided for you so you can test out your code. + +**Tips** + +- You can use a loop to iterate over the `scores` array and add up all the scores. +- You can use the `length` property to get the total number of scores. + +# --hints-- + +Your `getAverage` function should return a number. + +```js +assert.strictEqual(typeof getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 'number'); +``` + +`getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])` should return `71.7`. + +```js +assert.strictEqual(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 71.7); +``` + +`getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])` should return `85.4`. + +```js +assert.strictEqual(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]), 85.4); +``` + +`getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100])` should return `92.4`. + +```js +assert.strictEqual(getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100]), 92.4); +``` + +Your `getAverage` function should return the average score of the test scores. + +```js +assert.strictEqual(getAverage([52, 56, 60, 65, 70, 75, 80, 85, 90, 95]), 72.8); +assert.strictEqual(getAverage([45, 50, 55, 60, 65, 70, 75, 80, 85, 90]), 67.5); +assert.strictEqual(getAverage([38, 42, 46, 50, 54, 58, 62, 66, 70, 74]), 56); +``` + +# --seed-- + +## --seed-contents-- + +```js +--fcc-editable-region-- +function getAverage(scores) { + +} + +console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])); +console.log(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md new file mode 100644 index 00000000000..f7e9253a5a5 --- /dev/null +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md @@ -0,0 +1,104 @@ +--- +id: 6626a060c4006f793e10cb33 +title: Step 2 +challengeType: 1 +dashedName: step-2 +--- + +# --description-- + +Now the teacher needs your help converting the student score to a letter grade. + +Complete the `getGrade` function that takes a number `score` as a parameter. Your function should return a string representing a letter grade based on the score. + +Here are the scores and their corresponding letter grades: + +| Score Range | Grade | +| ----------- | ------- | +| `100` | `"A++"` | +| `90 - 99` | `"A"` | +| `80 - 89` | `"B"` | +| `70 - 79` | `"C"` | +| `60 - 69` | `"D"` | +| `0 - 59` | `"F"` | + + +**Tips** + +- Remember that you learned about conditional statements(`if`, `else if`, and `else`). +- Remember that you learned about comparison operators (`>`, `<`, `>=`, `<=`, `===`). + +# --hints-- + +Your `getGrade` function should return `"A++"` if the score is `100`. + +```js +assert.strictEqual(getGrade(100), "A++"); +``` + +Your `getGrade` function should return `"A"` if the score is `94`. + +```js +assert.strictEqual(getGrade(94), "A"); +``` + +Your `getGrade` function should return `"B"` if the score is between `80` and `89`. + +```js +assert.strictEqual(getGrade(80), "B"); +assert.strictEqual(getGrade(83), "B"); +assert.strictEqual(getGrade(88), "B"); +``` + +Your `getGrade` function should return `"C"` if the score is `78`. + +```js +assert.strictEqual(getGrade(75), "C"); +``` + +Your `getGrade` function should return `"D"` if the score is between `60` and `69`. + +```js +assert.strictEqual(getGrade(60), "D"); +assert.strictEqual(getGrade(63), "D"); +assert.strictEqual(getGrade(68), "D"); +``` + +Your `getGrade` function should return `"F"` if the score is `57`. + +```js +assert.strictEqual(getGrade(57), "F"); +``` + +Your `getGrade` function should return `"F"` if the score is between `0` and `59`. + +```js +assert.strictEqual(getGrade(0), "F"); +assert.strictEqual(getGrade(30), "F"); +assert.strictEqual(getGrade(43), "F"); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} +--fcc-editable-region-- +function getGrade(score) { + +} + +console.log(getGrade(96)); +console.log(getGrade(82)); +console.log(getGrade(56)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md new file mode 100644 index 00000000000..b168e1325fc --- /dev/null +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md @@ -0,0 +1,88 @@ +--- +id: 6626b4c58c027d86478ff5eb +title: Step 3 +challengeType: 1 +dashedName: step-3 +--- + +# --description-- + +The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an `"F"`. + +Complete the function `hasPassingGrade` that takes a student score as a parameter. Your function should return `true` if the student has a passing grade and `false` if they do not. + +**Tips** + +- Use the `getGrade` function to get the student's grade. Then check if the grade is passing or not. + +# --hints-- + +Your `hasPassingGrade` function should return a boolean value. + +```js +assert.strictEqual(typeof hasPassingGrade(100), "boolean"); +``` + +Your `hasPassingGrade` function should return `true` if the grade is an `"A"`. + +```js +assert.isTrue(hasPassingGrade(100)); +``` + +Your `hasPassingGrade` function should return `false` if the grade is an `"F"`. + +```js +assert.isFalse(hasPassingGrade(53)); +``` + +Your `hasPassingGrade` function should return `true` for all passing grades. + +```js +assert.isTrue(hasPassingGrade(87)); +assert.isTrue(hasPassingGrade(60)); +assert.isTrue(hasPassingGrade(73)); +assert.isTrue(hasPassingGrade(96)); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +--fcc-editable-region-- +function hasPassingGrade(score) { + +} + + +console.log(hasPassingGrade(100)); +console.log(hasPassingGrade(53)); +console.log(hasPassingGrade(87)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md new file mode 100644 index 00000000000..08ee3cea27b --- /dev/null +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md @@ -0,0 +1,143 @@ +--- +id: 6626b8dcf5057f896f948440 +title: Step 4 +challengeType: 1 +dashedName: step-4 +--- + +# --description-- + +Now that the teacher has all of the information they need, they want to be able to message the student with the results. + +Complete the `studentMsg` function with `totalScores` and `studentScore` for parameters. The function should return a string representing a message to the student. + +If the student passed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You passed the course. +``` + +If the student failed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You failed the course. +``` + +Replace `average-goes-here` with the average of the total scores. Replace `grade-goes-here` with the student's grade. + +**Tips** + +- Use the `getAverage` function to get the class average. +- Use the `getGrade` function to get the student's grade. +- Use string concatenation (`+`) to build the message. +- Be careful with the punctuation and spaces in the message. + +# --hints-- + +Your function call of `studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)` should return the following message: `"Class average: 71.7. Your grade: F. You failed the course."`. + +```js +assert.strictEqual(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37), "Class average: 71.7. Your grade: F. You failed the course."); +``` + +Your function call of `studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)` should return the following message: `"Class average: 50.8. Your grade: A++. You passed the course."`. + +```js +assert.strictEqual(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100), "Class average: 50.8. Your grade: A++. You passed the course."); +``` + +Your `studentMsg` function should return a the correct message based on the student's score and the class average. + +```js +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 92), "Class average: 70.25. Your grade: A. You passed the course."); +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 57), "Class average: 70.25. Your grade: F. You failed the course."); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +--fcc-editable-region-- +function studentMsg(totalScores, studentScore) { + +} +console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)); +--fcc-editable-region-- + +``` + + +# --solutions-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +function studentMsg(totalScores, studentScore) { + let average = getAverage(totalScores); + let grade = getGrade(studentScore); + + return `Class average: ${average}. Your grade: ${grade}. You ${ + hasPassingGrade(studentScore) ? "passed" : "failed" + } the course.`; +} + +``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md index 6fc979bbbd4..e5d58abf33b 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md @@ -87,7 +87,7 @@ assert(confirmEnding('Abstraction', 'action') === true); 不应使用内置方法 `.endsWith()` 来完成挑战。 ```js -assert(!/\.endsWith\(.*?\)\s*?;?/.test(code) && !/\['endsWith'\]/.test(code)); +assert(!/\.endsWith\(.*?\)\s*?;?/.test(__helpers.removeJSComments(code)) && !/\['endsWith'\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md index 2b64dc4fcf8..221e7acc759 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md @@ -51,7 +51,7 @@ assert(repeatStringNumTimes('abc', -2) === ''); 不应使用内置的 `repeat()` 方法。 ```js -assert(!/\.repeat/g.test(code)); +assert(!/\.repeat/g.test(__helpers.removeJSComments(code))); ``` `repeatStringNumTimes("abc", 0)` 应返回 `""`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md index e15c47aa840..8ba713aa635 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md @@ -53,19 +53,19 @@ assert.deepEqual( `htmlColorNames` 函数中应调用 `splice()` 方法。 ```js -assert(/.splice/.test(code)); +assert(/.splice/.test(__helpers.removeJSComments(code))); ``` 不应使用 `shift()` 或 `unshift()`。 ```js -assert(!/shift|unshift/.test(code)); +assert(!/shift|unshift/.test(__helpers.removeJSComments(code))); ``` 不应使用数组的方括号表示法。 ```js -assert(!/\[\d\]\s*=/.test(code)); +assert(!/\[\d\]\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md index 0a01dbd4f2c..01cb9a4cd32 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md @@ -85,8 +85,8 @@ assert(foods.strawberries === 27); ```js assert( - code.search(/let foods/) === -1 && - code.search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ + __helpers.removeJSComments(code).search(/let foods/) === -1 && + __helpers.removeJSComments(code).search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ ) !== -1 ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md index 381ddf60cca..83ead5c692d 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md @@ -27,7 +27,7 @@ users.hasOwnProperty('Alan'); ```js -assert(code.match(/users/gm).length <= 2) +assert(__helpers.removeJSComments(code).match(/users/gm).length <= 2) ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index 75f9c0d0326..2748887e0d6 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ `copyMachine` 函数中应对 `arr` 使用展开运算符(`spread operator`)。 ```js -assert(code.match(/\.\.\.\s*arr/)); +assert(__helpers.removeJSComments(__helpers.removeJSComments(code)).match(/\.\.\.\s*arr/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md index 8b90badcd04..bee09a61fb7 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md @@ -38,7 +38,7 @@ assert.deepEqual( `forecast` 函数中应使用 `slice()` 方法。 ```js -assert(/\.slice\(/.test(code)); +assert(/\.slice\(/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index 26902bbc49a..5a1d8d33900 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -51,7 +51,7 @@ for (const food in refrigerator) { ```js assert( - code.match( + __helpers.removeJSComments(code).match( /for\s*\(\s*(var|let|const)\s+[a-zA-Z_$]\w*\s+in\s+[a-zA-Z_$]\w*\s*\)/ ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md index 4eabe78a49b..74d43c60875 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md @@ -61,7 +61,7 @@ assert(userActivity.data.online === 45); 应使用点号表示法或方括号表示法来修改 `online` 属性值。 ```js -assert.strictEqual(code.search(/online: 45/), -1); +assert.strictEqual(__helpers.removeJSComments(code).search(/online: 45/), -1); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md index cfe53f8d1cb..e5b948458ad 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md @@ -40,7 +40,7 @@ let newArray = array.splice(3, 2); ```js assert( - __helpers.removeWhiteSpace(code).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) ); ``` @@ -56,14 +56,14 @@ assert.strictEqual( 应对 `arr` 调用 `splice()` 方法。 ```js -assert(__helpers.removeWhiteSpace(code).match(/arr\.splice\(/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(/)); ``` splice 应只删除 `arr` 里面的元素,不能给 `arr` 添加元素。 ```js assert( - !__helpers.removeWhiteSpace(code).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) + !__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md index ac8cb81f886..5534be843e2 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md @@ -39,9 +39,9 @@ assert( ```js assert( - code.search(/oranges:/) !== -1 && - code.search(/plums:/) !== -1 && - code.search(/strawberries:/) !== -1 + __helpers.removeJSComments(code).search(/oranges:/) !== -1 && + __helpers.removeJSComments(code).search(/plums:/) !== -1 && + __helpers.removeJSComments(code).search(/strawberries:/) !== -1 ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md index 7d526095d55..c0fe7850679 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md @@ -54,7 +54,7 @@ assert( ```js assert( (function () { - if (code.match(/\s*=\s*myArray\[0\]/g)) { + if (__helpers.removeJSComments(code).match(/\s*=\s*myArray\[0\]/g)) { return true; } else { return false; diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md index d76f63cb144..41f53301530 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md @@ -45,7 +45,7 @@ assert(myData === 8); 你应该使用方括号从 `myArray` 中读取正确的值。 ```js -assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code))); +assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md index 0592535b3d0..572f3de825b 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md @@ -54,7 +54,7 @@ assert(secondTree === 'pine'); 你的代码应该使用点号和方括号访问 `myPlants`。 ```js -assert(/=\s*myPlants\[1\].list\[1\]/.test(code)); +assert(/=\s*myPlants\[1\].list\[1\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md index 043f2e84b29..9aa8eae3de4 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md @@ -64,7 +64,7 @@ assert(drinkValue === 'water'); 你应该使用两次方括号 ```js -assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md index 704e06c45f6..7ae1fa5f68c 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md @@ -60,7 +60,7 @@ assert(shirtValue === 'jersey'); 你应该使用两个点号 ```js -assert(code.match(/testObj\.\w+/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\.\w+/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md index 9151b2913b9..04a9684c7db 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md @@ -56,19 +56,19 @@ assert(player === 'Montana'); 你应该使用括号表示法来访问 `testObj`。 ```js -assert(/testObj\s*?\[.*?\]/.test(code)); +assert(/testObj\s*?\[.*?\]/.test(__helpers.removeJSComments(code))); ``` 你不应将值 `Montana` 直接分配给变量 `player`。 ```js -assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); +assert(!__helpers.removeJSComments(code).match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); ``` 你应该在括号符号中使用变量 `playerNumber`。 ```js -assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code)); +assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md index 1cb9728b5d1..db302b0e025 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md @@ -53,7 +53,7 @@ assert(myDog.bark !== undefined); 不应该在 `myDog` 的初始化中添加 `bark`。 ```js -assert(!/bark[^\n]:/.test(code)); +assert(!/bark[^\n]:/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md index b8e5d7b0b33..bfd48a9292b 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md @@ -38,7 +38,7 @@ assert(sum === 20); 请使用 `+` 运算符。 ```js -assert(/\+/.test(code)); +assert(/\+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md index 565dd14f8a5..0ab66596960 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md @@ -71,7 +71,7 @@ assert(switchOfStuff(4) === 'stuff'); 不能使用 `if` 或 `else` 语句。 ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` 你应该使用 `default` 语句。 @@ -83,7 +83,7 @@ assert(switchOfStuff('string-to-trigger-default-case') === 'stuff'); 你至少应该写 3 个 `break` 语句。 ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md index 9d668d14f88..50ce3aa51d4 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md @@ -36,7 +36,7 @@ assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2); 你应该使用 `+=` 运算符将 `someAdjective` 追加到 `myStr`。 ```js -assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md index 1a756600d96..356b0a9485f 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md @@ -29,7 +29,7 @@ myNum = myVar; 你不应该修改注释上面的代码。 ```js -assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code))); ``` `b` 的值应该为 `7`。 @@ -41,7 +41,7 @@ assert(typeof b === 'number' && b === 7); 应该使用 `=` 将 `a` 赋给 `b`。 ```js -assert(/b\s*=\s*a\s*/g.test(code)); +assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md index 0fe02ca176f..a63fdd7bd66 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md @@ -34,7 +34,7 @@ assert(processed === 2); 应该将 `processArg` 赋值给 `processed`。 ```js -assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code)); +assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md index 343184029d8..63ea6f5ccf4 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md @@ -39,19 +39,19 @@ if (condition1) { 应至少有 4 个 `else` 语句。 ```js -assert(code.match(/else/g).length > 3); +assert(__helpers.removeJSComments(code).match(/else/g).length > 3); ``` 应至少有 4 个 `if` 语句。 ```js -assert(code.match(/if/g).length > 3); +assert(__helpers.removeJSComments(code).match(/if/g).length > 3); ``` 应至少有 1 个 `return` 语句。 ```js -assert(code.match(/return/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/return/g).length >= 1); ``` `testSize(0)` 应该返回字符串 `Tiny` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index f56f0a3d24c..cdbe74eefba 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -2,7 +2,6 @@ id: bd7123c9c441eddfaeb4bdef title: 给代码添加注释 challengeType: 1 -removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' forumTopicId: 16783 dashedName: comment-your-javascript-code diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index 41bdb37ea74..60eff9eed0a 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -58,7 +58,7 @@ assert(testEqual('12') === 'Equal'); 应该使用 `==` 运算符 ```js -assert(code.match(/==/g) && !code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/==/g) && !__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index 161ce2caa3d..91751b2cfdc 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -73,7 +73,7 @@ assert(testGreaterThan(150) === 'Over 100'); 你应该使用 `>` 至少两次 ```js -assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index aab50a44a06..9aeea593719 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -73,7 +73,7 @@ assert(testGreaterOrEqual(21) === '20 or Over'); 你应该使用 `>=` 运算符至少两次。 ```js -assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index 5593e46bcd6..6f85362679c 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -60,7 +60,7 @@ assert(testNotEqual('bob') === 'Not Equal'); 你应该使用 `!=` 运算符 ```js -assert(code.match(/(?!!==)!=/)); +assert(__helpers.removeJSComments(code).match(/(?!!==)!=/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index d1ace773e5a..8c4ff9fc60a 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -66,7 +66,7 @@ assert(testLessThan(99) === '55 or Over'); 应该使用 `<` 运算符至少两次 ```js -assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index 68d7e587601..0d0e499a7dd 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -72,7 +72,7 @@ assert(testLessOrEqual(55) === 'More Than 24'); 应该使用 `<=` 运算符至少两次 ```js -assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index b4d509aece0..d05f8c2789a 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -49,7 +49,7 @@ assert(testStrict('7') === 'Not Equal'); 应该使用 `===` 运算符 ```js -assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index d5a3421f1ee..c7318a06224 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -52,7 +52,7 @@ assert(testStrictNotEqual('bob') === 'Not Equal'); 应该使用 `!==` 运算符 ```js -assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md index bb9565832ad..1a04ffa1efb 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md @@ -40,13 +40,13 @@ return "No"; 你应该使用 `&&` 运算符一次。 ```js -assert(code.match(/&&/g).length === 1); +assert(__helpers.removeJSComments(code).match(/&&/g).length === 1); ``` 你应该只有一个 `if` 表达式。 ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalAnd(0)` 应该返回字符串 `No` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md index b29a51ac874..49ed064938a 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md @@ -43,13 +43,13 @@ return "Yes"; 应该使用一次 `||` 操作符。 ```js -assert(code.match(/\|\|/g).length === 1); +assert(__helpers.removeJSComments(code).match(/\|\|/g).length === 1); ``` 应该只有一个 `if` 表达式。 ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalOr(0)` 应该返回字符串 `Outside` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md index fcf67346694..fff2b715a1c 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md @@ -54,16 +54,16 @@ assert(c === 19); 应该对每个变量使用 `+=` 操作符。 ```js -assert(code.match(/\+=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\+=/g).length === 3); ``` 不要修改注释上面的代码。 ```js assert( - /let a = 3;/.test(code) && - /let b = 17;/.test(code) && - /let c = 12;/.test(code) + /let a = 3;/.test(__helpers.removeJSComments(code)) && + /let b = 17;/.test(__helpers.removeJSComments(code)) && + /let c = 12;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md index 4d79833dcdc..9b67b70a258 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md @@ -48,16 +48,16 @@ assert(c === 3); 应该对每个变量使用 `/=` 操作符。 ```js -assert(code.match(/\/=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\/=/g).length === 3); ``` 不要修改注释上面的代码。 ```js assert( - /let a = 48;/.test(code) && - /let b = 108;/.test(code) && - /let c = 33;/.test(code) + /let a = 48;/.test(__helpers.removeJSComments(code)) && + /let b = 108;/.test(__helpers.removeJSComments(code)) && + /let c = 33;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md index 96165f198ec..de609c367ed 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md @@ -48,16 +48,16 @@ assert(c === 46); 应该对每个变量使用 `*=` 操作符。 ```js -assert(code.match(/\*=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\*=/g).length === 3); ``` 不要修改注释上面的代码。 ```js assert( - /let a = 5;/.test(code) && - /let b = 12;/.test(code) && - /let c = 4\.6;/.test(code) + /let a = 5;/.test(__helpers.removeJSComments(code)) && + /let b = 12;/.test(__helpers.removeJSComments(code)) && + /let c = 4\.6;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md index 79ab231e713..88041ecd796 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md @@ -48,14 +48,14 @@ assert(c === 2); 应该对每个变量使用 `-=` 操作符。 ```js -assert(code.match(/-=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/-=/g).length === 3); ``` 不要修改注释上面的代码。 ```js assert( - /let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code) + /let a = 11;/.test(__helpers.removeJSComments(code)) && /let b = 9;/.test(__helpers.removeJSComments(code)) && /let c = 3;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md index 21fad49fda2..e3ddda610c3 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md @@ -47,19 +47,19 @@ assert(myStr === 'This is the start. This is the end.'); 应该使用 `+` 运算符来构建 `myStr`。 ```js -assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g)); +assert(__helpers.removeJSComments(code).match(/(["']).*\1\s*\+\s*(["']).*\2/g)); ``` `myStr` 应该使用 `const` 关键字创建。 ```js -assert(/const\s+myStr/.test(code)); +assert(/const\s+myStr/.test(__helpers.removeJSComments(code))); ``` 应该将结果分配给 `myStr` 变量。 ```js -assert(/myStr\s*=/.test(code)); +assert(/myStr\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index 2c62ea85d77..1993b69de69 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -43,7 +43,7 @@ assert(myStr === 'This is the first sentence. This is the second sentence.'); 应该使用 `+=` 操作符创建 `myStr` 变量。 ```js -assert(code.match(/myStr\s*\+=\s*(["']).*\1/g)); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*(["']).*\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md index 5a835cf0a54..19f3ad29d98 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md @@ -35,7 +35,7 @@ assert(typeof myName !== 'undefined' && myName.length > 2); 使用两个 `+` 操作符创建包含 `myName` 的 `myStr` 变量。 ```js -assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); +assert(__helpers.removeJSComments(code).match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md index 0cb916e7a9d..d699235a1c1 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md @@ -34,13 +34,13 @@ for (let i = 10; i > 0; i -= 2) { 应该使用 `for` 循环。 ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` 应该使用数组方法 `push`。 ```js -assert(code.match(/myArray.push/)); +assert(__helpers.removeJSComments(code).match(/myArray.push/)); ``` `myArray` 应该等于 `[9, 7, 5, 3, 1]`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md index 792389fb8f0..c6268f9fa78 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md @@ -37,7 +37,7 @@ var ourName; 使用 `var` 关键字定义一个变量 `myName`,并使用分号结尾。 ```js -assert(/var\s+myName\s*;/.test(code)); +assert(/var\s+myName\s*;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md index a45765f10c5..6a51248a42e 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md @@ -38,25 +38,25 @@ assert(myVar === 10); 应该修改 `myVar = myVar - 1;`。 ```js -assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); ``` 你不应将 `10` 分配给 `myVar`。 ```js -assert(!code.match(/myVar\s*=\s*10.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*10.*?;?/)); ``` 应该对 `myVar` 使用 `--` 运算符。 ```js -assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code)); +assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(__helpers.removeJSComments(code))); ``` 你不应该修改注释上面的代码。 ```js -assert(/let myVar = 11;/.test(code)); +assert(/let myVar = 11;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md index 097db448dc3..6e0e33ef5fe 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md @@ -55,7 +55,7 @@ assert(typeof myDog === 'object' && myDog.tails === undefined); 不要修改 `myDog` 的初始化代码。 ```js -assert(code.match(/"tails": 1/g).length > 0); +assert(__helpers.removeJSComments(code).match(/"tails": 1/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md index b7bcc0a118d..7164ebfd58f 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md @@ -26,13 +26,13 @@ assert(quotient === 2.2); 使用 `/` 运算符将 4.4 除以 2。 ```js -assert(/4\.40*\s*\/\s*2\.*0*/.test(code)); +assert(/4\.40*\s*\/\s*2\.*0*/.test(__helpers.removeJSComments(code))); ``` quotient 变量应该只被赋值一次。 ```js -assert(code.match(/quotient\s*=/g).length === 1); +assert(__helpers.removeJSComments(code).match(/quotient\s*=/g).length === 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md index b2700333de1..f2415a260a9 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md @@ -35,7 +35,7 @@ assert(quotient === 2); 使用 `/` 运算符。 ```js -assert(/\d+\s*\/\s*\d+/.test(code)); +assert(/\d+\s*\/\s*\d+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md index dc2d088dfc1..bbb3a8d93bf 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md @@ -36,7 +36,7 @@ I am a "double quoted" string inside "double quotes". 你的代码中应该包含两个双引号(`"`)以及四个转义的双引号(`\"`)。 ```js -assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2); +assert(__helpers.removeJSComments(code).match(/\\"/g).length === 4 && __helpers.removeJSComments(code).match(/[^\\]"/g).length === 2); ``` 变量 `myStr` 应该包含字符串 `I am a "double quoted" string inside "double quotes".` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md index b93708f70e3..f526b77834a 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md @@ -29,8 +29,8 @@ console.log("Alan Peter".length); ```js assert( - code.match(/let lastNameLength = 0;/) && - code.match(/const lastName = "Lovelace";/) + __helpers.removeJSComments(code).match(/let lastNameLength = 0;/) && + __helpers.removeJSComments(code).match(/const lastName = "Lovelace";/) ); ``` @@ -43,7 +43,7 @@ assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8); 你应该使用 `.length` 获取 `lastName` 的长度,像这样 `lastName.length`。 ```js -assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/)); +assert(__helpers.removeJSComments(code).match(/=\s*lastName\.length/g) && !__helpers.removeJSComments(code).match(/lastName\s*=\s*8/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md index a1db0551aa5..fbd14892d87 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md @@ -39,7 +39,7 @@ dashedName: finding-a-remainder-in-javascript 变量 `remainder` 应该被初始化。 ```js -assert(/(const|let|var)\s+?remainder/.test(code)); +assert(/(const|let|var)\s+?remainder/.test(__helpers.removeJSComments(code))); ``` `remainder` 的值应该等于 `2`。 @@ -51,7 +51,7 @@ assert(remainder === 2); 你应该使用 `%` 运算符。 ```js -assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code)); +assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md index 4ce91e487c7..9ff2a090b58 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md @@ -36,7 +36,7 @@ assert((randomFraction() + '').match(/\./g)); 需要使用 `Math.random` 生成随机的小数。 ```js -assert(code.match(/Math\.random/g).length >= 0); +assert(__helpers.removeJSComments(code).match(/Math\.random/g).length >= 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md index 10454b4c815..0b257d9c345 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md @@ -46,22 +46,22 @@ assert( 应该使用 `Math.random` 生成一个随机数字。 ```js -assert(code.match(/Math.random/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.random/g).length >= 1); ``` 应该将 `Math.random` 的结果乘以 10,以生成 0 到 9 之间的随机数。 ```js assert( - code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || - code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) + __helpers.removeJSComments(code).match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || + __helpers.removeJSComments(code).match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) ); ``` 应该使用 `Math.floor` 来删除数字的十进制部分。 ```js -assert(code.match(/Math.floor/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.floor/g).length >= 1); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md index 6e9fedf717c..a8677f085bf 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md @@ -49,10 +49,10 @@ assert(randomRange(0, 1) % 1 === 0); assert( (function () { if ( - code.match(/myMax/g).length > 1 && - code.match(/myMin/g).length > 2 && - code.match(/Math.floor/g) && - code.match(/Math.random/g) + __helpers.removeJSComments(code).match(/myMax/g).length > 1 && + __helpers.removeJSComments(code).match(/myMin/g).length > 2 && + __helpers.removeJSComments(code).match(/Math.floor/g) && + __helpers.removeJSComments(code).match(/Math.random/g) ) { return true; } else { diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md index 1b884c58517..e7f44e5155c 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md @@ -36,7 +36,7 @@ assert(myGlobal === 10); `myGlobal` 应该使用 `let` 或 `const` 关键字声明 ```js -assert(/(let|const)\s+myGlobal/.test(code)); +assert(/(let|const)\s+myGlobal/.test(__helpers.removeJSComments(code))); ``` `oopsGlobal` 应为全局变量,值为 `5`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md index 01af4403ed2..e3fcb397ac1 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md @@ -45,7 +45,7 @@ assert(myOutfit() === 'sweater'); 不要修改 return 语句。 ```js -assert(/return outerWear/.test(code)); +assert(/return outerWear/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md index da6d4ab55d9..8e19c4de189 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md @@ -39,20 +39,20 @@ assert(myVar === 88); ```js assert( - /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(code) + /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(__helpers.removeJSComments(code)) ); ``` 应该使用 `++` 运算符。 ```js -assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code)); +assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(__helpers.removeJSComments(code))); ``` 不应该修改注释上面的代码。 ```js -assert(/let myVar = 87;/.test(code)); +assert(/let myVar = 87;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md index 588c689c7aa..3c932fdfe95 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md @@ -26,7 +26,7 @@ var myVar = 0; 应该初始化 `a` 的值为 `9`。 ```js -assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code)); +assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md index 72669d86336..f5f929d5b67 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md @@ -30,20 +30,20 @@ if (num > 15) { 你应该至少有两个 `else` 表达式。 ```js -assert(code.match(/else/g).length > 1); +assert(__helpers.removeJSComments(code).match(/else/g).length > 1); ``` 你应该至少有两个 `if` 表达式。 ```js -assert(code.match(/if/g).length > 1); +assert(__helpers.removeJSComments(code).match(/if/g).length > 1); ``` 应该关闭每一个 `if else` 代码块。 ```js assert( - code.match( + __helpers.removeJSComments(code).match( /if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/ ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md index db610a9cfff..76702c3ca5f 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md @@ -28,13 +28,13 @@ if (num > 10) { 应该只有一个 `if` 语句。 ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` 应该使用一个 `else` 语句。 ```js -assert(/else/g.test(code)); +assert(/else/g.test(__helpers.removeJSComments(code))); ``` `testElse(4)` 应该返回字符串 `5 or Smaller` @@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5'); 不要修改相应注释的上面或下面的代码。 ```js -assert(/let result = "";/.test(code) && /return result;/.test(code)); +assert(/let result = "";/.test(__helpers.removeJSComments(code)) && /return result;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md index 5191bcee1b7..29e7d7e13ad 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md @@ -32,7 +32,7 @@ for (let i = 0; i < 10; i += 2) { 应该使用 `for` 循环。 ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` 应该等于 `[1, 3, 5, 7, 9]`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md index f01f2b48eaa..add2397c72e 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md @@ -30,7 +30,7 @@ for (let i = 0; i < arr.length; i++) { `total` 应该被声明, 并且初始化值为 0。 ```js -assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); ``` `total` 应该等于 20。 @@ -42,13 +42,13 @@ assert(total === 20); 你应该使用 `for` 循环在 `myArr` 中遍历。 ```js -assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code)); +assert(/for\s*\(/g.test(__helpers.removeJSComments(code)) && /myArr\s*\[/g.test(__helpers.removeJSComments(code))); ``` 不能直接把 `total` 设置成 20。 ```js -assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm)); +assert(!__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/total[=+-]0*[1-9]+/gm)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md index 3fcbfeb0807..d953b337ce3 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md @@ -56,7 +56,7 @@ do { 你应该使用 `do...while` 循环。 ```js -assert(code.match(/do/g)); +assert(__helpers.removeJSComments(code).match(/do/g)); ``` `myArray` 应该等于 `[10]`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md index 9573075882b..4b6b5b9d5d0 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md @@ -44,7 +44,7 @@ for (let i = 0; i < 5; i++) { 你应该使用 `for` 循环。 ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` 应该等于 `[1, 2, 3, 4, 5]`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md index 2998f793f70..03bf3313489 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md @@ -36,7 +36,7 @@ while (i < 5) { 你应该使用 `while` 循环。 ```js -assert(code.match(/while/g)); +assert(__helpers.removeJSComments(code).match(/while/g)); ``` `myArray` 应该等于 `[5, 4, 3, 2, 1, 0]`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index ef9bc82e3d3..9476f944499 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -48,7 +48,7 @@ assert.throws(declared, ReferenceError); ```js assert( /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( - __helpers.removeWhiteSpace(code) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)) ) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md index 87dd625d8a5..df0010f24b5 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md @@ -47,7 +47,7 @@ assert( 对 `myArray` 使用 `pop()` 函数。 ```js -assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code)); +assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(__helpers.removeJSComments(code))); ``` `removedFromMyArray` 应该只包含 `["cat", 2]`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md index 44781e36f24..09082099ef9 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md @@ -52,7 +52,7 @@ assert( ```js assert( (function () { - if (code.match(/myArray\[0\]\s*=\s*/g)) { + if (__helpers.removeJSComments(code).match(/myArray\[0\]\s*=\s*/g)) { return true; } else { return false; diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md index 8ee79a51507..1722d69419e 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md @@ -94,13 +94,13 @@ assert(sequentialSizes(9) === 'High'); 你不应使用 `if` 或 `else` 语句。 ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` 你应该编写 9 个`case`语句。 ```js -assert(code.match(/case/g).length === 9); +assert(__helpers.removeJSComments(code).match(/case/g).length === 9); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md index a1f6eb7d959..e1f7456cb04 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md @@ -28,7 +28,7 @@ assert(product === 5.0); 要使用 `*` 运算符。 ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md index eff8e132266..2d264d54fcc 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md @@ -36,7 +36,7 @@ assert(product === 80); 使用 `*` 运算符。 ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md index fd90e86b084..686728e7c62 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md @@ -60,7 +60,7 @@ assert(logOutput == 16); ```js assert( /functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test( - code.replace(/\s/g, '') + __helpers.removeJSComments(code).replace(/\s/g, '') ) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md index 46fa9f4f9d7..e35cccdddb3 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md @@ -47,7 +47,7 @@ assert(compareEquality('20', 20) === 'Not Equal'); 你应该使用 `===` 运算符 ```js -assert(code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index fee0ae114df..c8d38cbfba1 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -47,7 +47,7 @@ const badStr = 'Finn responds, "Let's go!"'; ```js assert( - !/\\/g.test(code) && + !/\\/g.test(__helpers.removeJSComments(code)) && myStr.match( '\\s*\\s*Link\\s*\\s*' ) @@ -57,7 +57,7 @@ assert( 应该要有两个单引号 `'` 和四个双引号 `"`。 ```js -assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2); +assert(__helpers.removeJSComments(code).match(/"/g).length === 4 && __helpers.removeJSComments(code).match(/'/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index 141e5c20002..0f7f614ed73 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,7 +66,7 @@ assert.equal(sum([2, 3, 4, 5], 3), 9); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md index d24a20079c8..8503a78a0a0 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md @@ -45,19 +45,19 @@ switch (val) { 不要使用 `else` 表达式 ```js -assert(!/else/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code))); ``` 不要使用 `if` 表达式 ```js -assert(!/if/g.test(code)); +assert(!/if/g.test(__helpers.removeJSComments(code))); ``` 你应该有至少 4 个 `break` 表达式 ```js -assert(code.match(/break/g).length >= 4); +assert(__helpers.removeJSComments(code).match(/break/g).length >= 4); ``` `chainToSwitch("bob")` 应该返回字符串 `Marley` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md index ef6b4dfa71f..5769438f152 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md @@ -52,7 +52,7 @@ assert(isLess(15, 10) === false); 不应该使用 `if` 或者 `else` 语句 ```js -assert(!/if|else/g.test(code)); +assert(!/if|else/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md index 0fb30fe44c2..fca4ea4b3d5 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md @@ -63,13 +63,13 @@ assert(caseInSwitch(4) === 'delta'); 不能使用任何 `if` 或 `else` 表达式 ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` 你应该有至少 3 个 `break` 表达式 ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md index b4c82d28144..c6bdedc1f32 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md @@ -35,7 +35,7 @@ myVar = 5; 不应该修改注释上面的代码。 ```js -assert(/var a;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code))); ``` `a` 的值应该为 7。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md index 4f9dd2acb96..e82d4f5a0a1 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md @@ -35,7 +35,7 @@ assert(difference === 12); 你只能从 `45` 中减去一个数。 ```js -assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code))); +assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md index 7997d4bfe0e..0cf7e2eddcf 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md @@ -40,7 +40,7 @@ assert(myStr === 'Hello World'); 不要修改注释上面的代码。 ```js -assert(/myStr = "Jello World"/.test(code)); +assert(/myStr = "Jello World"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md index 38b463a132a..5173daf5545 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md @@ -56,19 +56,19 @@ assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000); `studlyCapVar` 在声明和赋值时都应该使用驼峰命名法。 ```js -assert(code.match(/studlyCapVar/g).length === 2); +assert(__helpers.removeJSComments(code).match(/studlyCapVar/g).length === 2); ``` `properCamelCase` 在声明和赋值时都应该使用驼峰命名法。 ```js -assert(code.match(/properCamelCase/g).length === 2); +assert(__helpers.removeJSComments(code).match(/properCamelCase/g).length === 2); ``` `titleCaseOver` 在声明和赋值时都应该使用驼峰命名法。 ```js -assert(code.match(/titleCaseOver/g).length === 2); +assert(__helpers.removeJSComments(code).match(/titleCaseOver/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index 02a04432700..5a2951b4745 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -39,9 +39,9 @@ assert(!/undefined/.test(c) && c === 'I am a String!'); ```js assert( - /a = a \+ 1;/.test(code) && - /b = b \+ 5;/.test(code) && - /c = c \+ " String!";/.test(code) + /a = a \+ 1;/.test(__helpers.removeJSComments(code)) && + /b = b \+ 5;/.test(__helpers.removeJSComments(code)) && + /c = c \+ " String!";/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md index 696dadb9130..e4e9424b4c3 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md @@ -39,7 +39,7 @@ assert(/happy coder/gi.test(myDog.name)); 不要修改 `myDog` 的定义。 ```js -assert(/"name": "Coder"/.test(code)); +assert(/"name": "Coder"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md index 36a782192f8..df6cb220935 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md @@ -41,7 +41,7 @@ assert(firstLetterOfLastName === 'L'); 应该使用方括号表示法。 ```js -assert(code.match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md index f8d9185d5fb..680dffe8cfd 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(lastLetterOfLastName === 'e'); 您应该使用 `.length` 获取最后一个字母。 ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md index 3685598220a..5c33add9fdb 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md @@ -39,7 +39,7 @@ assert(thirdLetterOfLastName === 'v'); 应该使用方括号表示法。 ```js -assert(code.match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md index 4031b79b7fb..074705c912a 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(secondToLastLetterOfLastName === 'c'); 您应该使用 `.length` 获取倒数第二个字母。 ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md index 32351ccac56..ba0851bde48 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md @@ -54,7 +54,7 @@ function findGreaterOrEqual(a, b) { `checkSign` 应该使用多个三元运算符。 ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(__helpers.removeJSComments(code))); ``` `checkSign(10)` 应该返回字符串 `positive`。 注意区分大写字母和小写字母。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index 4fed5dcabaa..4849dee9e62 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,7 +59,7 @@ assert.deepStrictEqual(countdown(5), [5, 4, 3, 2, 1]); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index fb77b355997..029a36c9f98 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,7 +26,7 @@ assert(Array.isArray(rangeOfNumbers(5, 10))); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index 8339ef2b6b4..ace6017a609 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -42,7 +42,7 @@ function findGreater(a, b) { `checkEqual` 应该使用条件运算符。 ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(__helpers.removeJSComments(code))); ``` `checkEqual(1, 2)` 应该返回字符串 `Not Equal` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md index d270f9f2a99..bff8690667d 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md @@ -34,7 +34,7 @@ const a = parseInt("11", 2); `convertToInteger` 应该使用 `parseInt()` 函数。 ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("10011")` 应该返回一个数字。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md index 76acb0ca61b..9c06716366b 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md @@ -26,7 +26,7 @@ const a = parseInt("007"); `convertToInteger` 中应该使用 `parseInt()` 函数。 ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("56")` 应该返回一个数字。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md index 9a460b5b4ae..d7257828999 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md @@ -83,14 +83,14 @@ assert(typeof phoneticLookup('') === 'undefined'); 请不要修改 `return` 语句 ```js -assert(code.match(/return\sresult;/)); +assert(__helpers.removeJSComments(code).match(/return\sresult;/)); ``` 请不要使用 `case`、`switch`、`if` 语句 ```js assert( - !/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) + !/case|switch|if/g.test(__helpers.removeJSComments(code).replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md index 3f2cc8f93d4..77d6538af8c 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md @@ -53,7 +53,7 @@ assert( 你不应该直接使用 `dog`、`ran`、`big` 或 `quickly` 来创建 `wordBlanks`。 ```js -const newCode = removeAssignments(code); +const newCode = removeAssignments(__helpers.removeJSComments(code)); assert( !/dog/.test(newCode) && !/ran/.test(newCode) && diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md index e75a6c112e2..97769dbd4cd 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md @@ -50,7 +50,7 @@ assert(testConsole()); ```js const functionStr = reusableFunction && __helpers.removeWhiteSpace(reusableFunction.toString()); -const codeWithoutFunction = __helpers.removeWhiteSpace(code).replace(/reusableFunction\(\)\{/g, ''); +const codeWithoutFunction = __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).replace(/reusableFunction\(\)\{/g, ''); assert(/reusableFunction\(\)/.test(codeWithoutFunction)); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md index 8c74c7771c0..1bdfe7e2747 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md @@ -25,7 +25,7 @@ assert(power == 8); 你调用 `raiseToPower` 函数时,传递参数的顺序应正确。 ```js -assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); +assert(__helpers.removeJSComments(code).match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md index 4364de3b8b4..b0e5be4b5ae 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md @@ -37,7 +37,7 @@ assert(result == 9); 你应该调用 `getNine` 函数。 ```js -assert(code.match(/getNine\(\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/getNine\(\)/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md index 3e0bdf2e154..ac68be22fe2 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md @@ -27,25 +27,25 @@ assert(netWorkingCapital === 2); 代码中不应该有拼写错误的变量实例。 ```js -assert(!code.match(/recievables/g)); +assert(!__helpers.removeJSComments(code).match(/recievables/g)); ``` 应在代码中声明并正确使用 `receivables` 变量。 ```js -assert(code.match(/receivables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/receivables/g).length == 2); ``` 代码中不应该有拼写错误的变量实例。 ```js -assert(!code.match(/payable;/g)); +assert(!__helpers.removeJSComments(code).match(/payable;/g)); ``` 应在代码中声明并正确使用 `payables` 变量。 ```js -assert(code.match(/payables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/payables/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index f5c58b41096..7a633525bc4 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -37,13 +37,13 @@ const allSameQuotes = 'I\'ve had a perfectly wonderful evening, but this wasn\'t 你应通过更改或转义来修复 `href` 的值 `#Home` 周围的引号。 ```js -assert(code.match(//g)); +assert(__helpers.removeJSComments(code).match(//g)); ``` 你应该在整个字符串外围保留双引号。 ```js -assert(code.match(/"

.*?<\/p>";/g)); +assert(__helpers.removeJSComments(code).match(/"

.*?<\/p>";/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md index b1049efad14..94566103e15 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md @@ -37,25 +37,25 @@ for (let k = 0; k < len; k++) { 应该设置循环的初始条件,使循环从第一个索引开始。 ```js -assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?=\s*?0\s*?;/g).length == 1); ``` 应修复循环的初始条件,使循环从索引 0 开始。 ```js -assert(!code.match(/i\s?=\s*?1\s*?;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s?=\s*?1\s*?;/g)); ``` 应该设置循环的终止条件,使循环在最后一个索引处停止。 ```js -assert(code.match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); ``` 应该修复循环的终止条件,使循环在索引为字符串长度减 1 的位置停止。 ```js -assert(!code.match(/i\s*?<=\s*?len;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?<=\s*?len;/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md index b0a27ebc3ec..bfaaf75a28f 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md @@ -21,7 +21,7 @@ dashedName: catch-unclosed-parentheses-brackets-braces-and-quotes 应该修复数组缺少的部分。 ```js -assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); +assert(__helpers.removeJSComments(code).match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); ``` 应该修复 `.reduce()` 方法缺少的部分。 控制台应该输出 `Sum of array values is: 6`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md index 20382d231e1..fe1731fbec3 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md @@ -43,7 +43,7 @@ assert(result == 'Not equal!'); 条件语句可以使用 `==` 或 `===` 来测试是否相等。 ```js -assert(code.match(/x\s*?===?\s*?y/g)); +assert(__helpers.removeJSComments(code).match(/x\s*?===?\s*?y/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md index 442bbd6e399..4fb2dc6fddb 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md @@ -31,13 +31,13 @@ function loopy() { 你应该在`for`循环的终止条件(中间部分)中更改比较运算符。 ```js -assert(code.match(/i\s*?<=\s*?4;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?<=\s*?4;/g).length == 1); ``` 你应该修改比较运算符来避免出现死循环。 ```js -assert(!code.match(/i\s*?!=\s*?4;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?!=\s*?4;/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index 02f055a12de..12ba97cd60e 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -23,7 +23,7 @@ dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-c 你应该使用 `console.log()` 来打印 `output` 变量。 ```js -assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/console\.log\(output\)/)); ``` 你应该使用 `console.clear()` 来清除浏览器控制台。 @@ -31,7 +31,7 @@ assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console.clear\(\)/) ); ``` @@ -41,7 +41,7 @@ assert( ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console\.log\(output\)[\s\S]*console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md index c5a143a810c..11f33251da3 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md @@ -29,7 +29,7 @@ console.log('Hello world!'); 应使用 `console.log()` 来检查变量 `a` 的值。 ```js -assert(code.match(/console\.log\(a\)/g)); +assert(__helpers.removeJSComments(code).match(/console\.log\(a\)/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md index 9ccc8cc1343..4b2e48e93e4 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md @@ -32,19 +32,19 @@ JavaScript 有七种原始(不可变)数据类型: `Boolean`,`Null`,`U 应在两个 `console.log()` 语句中使用 `typeof` 来检查变量的类型。 ```js -assert(code.match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); ``` 应使用 `typeof` 来检查变量 `seven` 的类型。 ```js -assert(code.match(/typeof[\( ]seven\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]seven\)?/g)); ``` 应使用 `typeof` 来检查变量 `three` 的类型。 ```js -assert(code.match(/typeof[\( ]three\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]three\)?/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index 4292606ca7f..13740be95fd 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -87,13 +87,13 @@ console.log(i); 代码中不应该出现 `var`。 ```js -assert(!code.match(/var/g)); +assert(!__helpers.removeJSComments(code).match(/var/g)); ``` `if` 语句中声明的变量 `i` 应该等于字符串 `block scope`。 ```js -assert(code.match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); +assert(__helpers.removeJSComments(code).match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); ``` `checkScope()` 应该返回字符串 `function scope`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index 57bf26c0a4d..6095ae21a9d 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,7 +32,7 @@ const myPromise = new Promise((resolve, reject) => { ```js assert( - code.match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) ); ``` @@ -40,7 +40,7 @@ assert( ```js assert( - code.match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md index c8e10ee4099..3f2e937b792 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md @@ -32,7 +32,7 @@ promise 应该接收一个函数做为参数,该函数应该包含 `resolve` ```js assert( - code.match( + __helpers.removeJSComments(code).match( /Promise\s*\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md index 65a908d7b81..d5a96bc20ac 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md @@ -25,14 +25,14 @@ dashedName: create-a-module-script 应该创建一个 `script` 标签。 ```js -assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); +assert(__helpers.removeJSComments(code).match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); ``` `script` 标签应该有一个值为 `module` 的 `type` 属性。 ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g ) ); @@ -42,7 +42,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md index 23bcce98475..3ae38d0178e 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md @@ -38,7 +38,7 @@ export default function(x, y) { ```js assert( - code.match( + __helpers.removeJSComments(code).match( /export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md index 8bd07460f4e..a49ac32accb 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md @@ -75,7 +75,7 @@ assert.match(code, /(`.*\${.*}.*`)/); 应该使用遍历。 ```js -assert(code.match(/for|map|reduce|forEach|while/)); +assert(__helpers.removeJSComments(code).match(/for|map|reduce|forEach|while/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md index 1cbebedaf2a..4c9e883902e 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md @@ -34,7 +34,7 @@ myPromise.then(result => { ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.then\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.then\(/g) ); ``` @@ -50,7 +50,7 @@ assert(resultIsParameter); assert( resultIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.then\(.*?result.*?console.log\(result\).*?\)/) ); ``` @@ -60,7 +60,7 @@ assert( ## --after-user-code-- ```js -const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(code)); +const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md index 78fc588df0f..93c871193da 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md @@ -28,7 +28,7 @@ myPromise.catch(error => { ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.catch\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.catch\(/g) ); ``` @@ -44,7 +44,7 @@ assert(errorIsParameter); assert( errorIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.catch\(.*?error.*?console.log\(error\).*?\)/) ); ``` @@ -54,7 +54,7 @@ assert( ## --after-user-code-- ```js -const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(code)); +const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md index f14498a0bc4..d892a29a8fb 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md @@ -25,7 +25,7 @@ import add from "./math_functions.js"; 应从 `math_functions.js` 中正确导入 `subtract`。 ```js -assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); +assert(__helpers.removeJSComments(code).match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md index 6dd2e62442a..2906a4f23a3 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md @@ -36,19 +36,19 @@ console.log(s); 不要替换 `const` 关键字。 ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `s` 应该是一个常量变量(通过使用 `const`)。 ```js -assert(code.match(/const\s+s/g)); +assert(__helpers.removeJSComments(code).match(/const\s+s/g)); ``` 不要改变原数组的声明。 ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g )); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md index 7d15435b499..15e59d84090 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md @@ -34,19 +34,19 @@ console.log(obj); 不要替换 `const` 关键字。 ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `MATH_CONSTANTS` 应该为一个常量(使用 `const`)。 ```js -assert(code.match(/const\s+MATH_CONSTANTS/g)); +assert(__helpers.removeJSComments(code).match(/const\s+MATH_CONSTANTS/g)); ``` 不要改变 `MATH_CONSTANTS` 的原始声明。 ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g )); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md index 7b68385b124..2904f9147a5 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md @@ -32,7 +32,7 @@ import { add, subtract } from './math_functions.js'; ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); @@ -42,7 +42,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index 078cfc8341e..d937d98c3dc 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -44,7 +44,7 @@ assert(increment(5) === 6); 参数 `value` 的默认值是 `1`。 ```js -assert(code.match(/value\s*=\s*1/g)); +assert(__helpers.removeJSComments(code).match(/value\s*=\s*1/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md index 2a82878d0c3..e67a0ca96ce 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md @@ -31,7 +31,7 @@ myMathModule.subtract(5,3); ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index 378ddb46e6f..c7155d3d5dd 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -66,7 +66,7 @@ assert( 应使用 `class` 关键字。 ```js -assert(code.match(/class/g)); +assert(__helpers.removeJSComments(code).match(/class/g)); ``` `Vegetable` 可以被实例化。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md index 051c5a941b9..5cf8ac767a8 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md @@ -51,7 +51,7 @@ assert(b === 8); 应使用数组解构来交换 `a` 和 `b` 的值。 ```js -assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code)); +assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index 6495c18edaf..f44c80f555f 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -43,8 +43,8 @@ const { johnDoe: { age: userAge, email: userEmail }} = user; ```js assert( - !code.match(/lowToday = LOCAL_FORECAST\.today\.low/g) && - !code.match(/highToday = LOCAL_FORECAST\.today.high/g) + !__helpers.removeJSComments(code).match(/lowToday = LOCAL_FORECAST\.today\.low/g) && + !__helpers.removeJSComments(code).match(/highToday = LOCAL_FORECAST\.today.high/g) ); ``` @@ -52,7 +52,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(low\s*:\s*lowToday[^}]*|[^,]*,\s*low\s*:\s*lowToday\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); @@ -62,7 +62,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday,?\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index eb67e8b6ec5..04c193eea54 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -34,8 +34,8 @@ const { name: userName, age: userAge } = user; ```js assert( - !code.match(/highToday = HIGH_TEMPERATURES\.today/g) && - !code.match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) + !__helpers.removeJSComments(code).match(/highToday = HIGH_TEMPERATURES\.today/g) && + !__helpers.removeJSComments(code).match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) ); ``` @@ -43,7 +43,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(today\s*:\s*highToday[^}]*|[^,]*,\s*today\s*:\s*highToday\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); @@ -53,7 +53,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(tomorrow\s*:\s*highTomorrow[^}]*|[^,]*,\s*tomorrow\s*:\s*highTomorrow\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 6ba3faab2f8..70579dedf47 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,7 +43,7 @@ const { name, age } = user; ```js assert( - !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !__helpers.removeJSComments(code).match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -51,7 +51,7 @@ assert( ```js assert( - code.match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` @@ -59,7 +59,7 @@ assert( ```js assert( - code.match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md index 2b32c69e42b..4c0cb3e8fa9 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md @@ -50,13 +50,13 @@ assert(half(stats) === 28.015); 应该使用解构赋值。 ```js -assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/half=\({\w+,\w+}\)/)); ``` 应该使用解构参数。 ```js -assert(!code.match(/stats\.max|stats\.min/)); +assert(!__helpers.removeJSComments(code).match(/stats\.max|stats\.min/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index a66ce97d6a4..69bde40f900 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -47,7 +47,7 @@ assert.deepEqual(_testArr, [1, 2, 3, 4, 5]) 不应该使用 `Array.slice()`。 ```js -assert(!code.match(/\.\s*slice\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*slice\s*\(/)); ``` You should use the rest syntax. diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md index 17fdb5c0574..7a60ff4127b 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md @@ -42,7 +42,7 @@ export { add, subtract }; ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+uppercaseString|export\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)})/g ) ); @@ -52,7 +52,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+lowercaseString|export\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)})/g ) ); diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md index 79028c6bc47..01e9860a152 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md @@ -57,7 +57,7 @@ assert(sum() === 0); `sum` 应是一个箭头函数,对 `args` 参数使用 rest 操作符语法(`...`)。 ```js -assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/sum=\(\.\.\.args\)=>/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md index 3b9db5bb1cd..8400dd52685 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md @@ -55,7 +55,7 @@ assert(arr2.every((v, i) => v === arr1[i]) && arr2.length); 应使用展开操作符 `...` 来复制 `arr1`。 ```js -assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); +assert(__helpers.removeJSComments(code).match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); ``` 当 `arr1` 改变的时候,`arr2` 应保持不变。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md index 21bcf782ffb..5c5da309bc7 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md @@ -54,7 +54,7 @@ assert.match(code, /const\s+myConcat/g); ```js assert( - /myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) && + /myConcat=\(\w+,\w+\)=>/.test(__helpers.removeJSComments(code).replace(/\s/g, '')) && typeof myConcat === 'function' ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 1644e48135e..db800cd555a 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,14 +39,14 @@ const person = { 不应使用传统的函数定义方法。 ```js -assert(!code.match(/function/)); +assert(!__helpers.removeJSComments(code).match(/function/)); ``` `setGear` 应是一个声明函数。 ```js assert( - typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/) + typeof bicycle.setGear === 'function' && __helpers.removeJSComments(code).match(/setGear\s*\(.+\)\s*\{/) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md index 20e08d93277..3d8a652424c 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md @@ -43,7 +43,7 @@ assert.deepEqual( 不要使用 `key:value`。 ```js -assert(!code.match(/:/g)) +assert(!__helpers.removeJSComments(code).match(/:/g)) ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md index ab7fcc3ca8c..ba3d0036a2d 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md @@ -30,13 +30,13 @@ arr.push(4, 5, 6); 应该使用 `concat` 方法。 ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` 不能使用 `push` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?push/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?push/g)); ``` 不能改变 `first` 数组。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md index 73a8b143f32..0158f35e0c9 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md @@ -31,7 +31,7 @@ dashedName: apply-functional-programming-to-convert-strings-to-url-slugs 不能使用 `replace` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `urlSlug("Winter Is Coming")` 应返回 `winter-is-coming`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md index 06500eb5fa7..975c95fad27 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md @@ -27,13 +27,13 @@ const str = arr.join(" "); 应使用 `join` 方法。 ```js -assert(code.match(/\.join/g)); +assert(__helpers.removeJSComments(code).match(/\.join/g)); ``` 不能使用 `replace` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `sentensify("May-the-force-be-with-you")` 应返回一个字符串。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md index 9c3f6b58acb..0fbddac8dd6 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md @@ -25,7 +25,7 @@ dashedName: combine-two-arrays-using-the-concat-method 应该使用 `concat` 方法。 ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` 不应该改变 `first` 数组。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md index e668e6659b3..c6842512c06 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md @@ -47,7 +47,7 @@ assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_ 你的代码不应该使用 `map` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?map/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?map/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md index 4207c857aa1..208743e7aed 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md @@ -43,7 +43,7 @@ assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFi 你的代码不应该使用 `filter` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?filter/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?filter/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md index 66fbedf4158..32c9dd11365 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md @@ -77,7 +77,7 @@ assert(add(11)(22)(33) === 66); 应返回 `x + y + z` 的最终结果。 ```js -assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); +assert(__helpers.removeJSComments(code).match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md index 9022ea6273f..6e0d26565c8 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md @@ -30,13 +30,13 @@ cities.splice(3, 1); 你的代码中应使用 `slice` 方法。 ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` 不能使用 `splice` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?splice/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?splice/g)); ``` You should not mutate the original array passed to the function. diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md index f8b1e266ab2..f30c7b0162a 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md @@ -28,7 +28,7 @@ const newArray = arr.slice(1, 3); 应该使用 `slice` 方法。 ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` 不能改变 `inputAnim` 变量。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md index 519880bd8fd..0800fd45e9f 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md @@ -47,7 +47,7 @@ JavaScript 的默认排序方法是 Unicode 值顺序排序,有时可能会得 应该使用 `sort` 方法。 ```js -assert(code.match(/\.sort/g)); +assert(__helpers.removeJSComments(code).match(/\.sort/g)); ``` `alphabeticalOrder(["a", "d", "c", "a", "z", "g"])` 应返回 `["a", "a", "c", "d", "g", "z"]`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md index c4cf7eb3e4d..db3d137d474 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md @@ -33,7 +33,7 @@ const byDigits = otherString.split(/\d/); 应该使用 `split` 方法。 ```js -assert(code.match(/\.split/g)); +assert(__helpers.removeJSComments(code).match(/\.split/g)); ``` `splitify("Hello World,I-am code")` 应返回 `["Hello", "World", "I", "am", "code"]`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index f7b3d741416..7c241e1a02c 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), 不应该使用 `for`、`while` 或者 `forEach`。 ```js -assert(!code.match(/for|while|forEach/g)); +assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ``` 应该使用 `map`、`filter` 或者 `reduce`。 @@ -36,7 +36,7 @@ assert(!code.match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md index 381c708edaf..5d3013790f5 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md @@ -31,7 +31,7 @@ numbers.every(function(currentValue) { 应使用`every`方法。 ```js -assert(code.match(/\.every/g)); +assert(__helpers.removeJSComments(code).match(/\.every/g)); ``` `checkPositive([1, 2, 3, -4, 5])` 应返回 `false`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md index 7b61423a711..bea4766912f 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md @@ -46,13 +46,13 @@ assert( 应使用 `filter` 方法。 ```js -assert(code.match(/\s*\.\s*filter/g)); +assert(__helpers.removeJSComments(code).match(/\s*\.\s*filter/g)); ``` 不能使用 `for` 循环。 ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` `filteredList` 应该等于 `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"}, {"title": "Batman Begins", "rating": "8.3"}]`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 5e58193eb52..b43d46cc950 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,13 +52,13 @@ assert( 不能使用 `for` 循环。 ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); ``` 你的代码应使用 `map` 方法。 ```js -assert(code.match(/\.map/g)); +assert(__helpers.removeJSComments(code).match(/\.map/g)); ``` `ratings` 应该等于 `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"},{"title": "Batman Begins", "rating": "8.3"}, {"title": "Avatar", "rating": "7.9"}]`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md index e410efe5e57..bfd1655bd39 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md @@ -66,7 +66,7 @@ assert( 应该使用`reduce`方法。 ```js -assert(code.match(/\.reduce/g)); +assert(__helpers.removeJSComments(code).match(/\.reduce/g)); ``` `getRating(watchList)` 应该等于 8.675。 @@ -78,7 +78,7 @@ assert(getRating(watchList) === 8.675); 不能使用 `for` 循环。 ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` 在修改 `watchList` 对象后应该返回正确的输出。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md index 9ddde647cae..a2a1ace23ae 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md @@ -31,7 +31,7 @@ numbers.some(function(currentValue) { 应该使用 `some` 方法。 ```js -assert(code.match(/\.some/g)); +assert(__helpers.removeJSComments(code).match(/\.some/g)); ``` `checkPositive([1, 2, 3, -4, 5])` 应返回 `true`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md index 8e159b30a66..e9316bbb40d 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md @@ -39,7 +39,7 @@ assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4]); 代码中不应使用 `Array.prototype.flat()` 或 `Array.prototype.flatMap()` 方法。 ```js -assert(!code.match(/\.\s*flat\s*\(/) && !code.match(/\.\s*flatMap\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*flat\s*\(/) && !__helpers.removeJSComments(code).match(/\.\s*flatMap\s*\(/)); ``` 不应使用全局变量。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md index 7503c3edcc2..53347bbd2e7 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md @@ -49,7 +49,7 @@ Bird.prototype = { `Dog.prototype` 应该被设置为一个新对象。 ```js -assert(/Dog\.prototype\s*?=\s*?{/.test(code)); +assert(/Dog\.prototype\s*?=\s*?{/.test(__helpers.removeJSComments(code))); ``` `Dog.prototype` 应该拥有属性 `numLegs`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md index c87cac7b28c..afee79ecf6d 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md @@ -61,7 +61,7 @@ assert(typeof beagle !== 'undefined'); ```js assert( /(let|const|var)\s{1,}duck\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` @@ -71,7 +71,7 @@ assert( ```js assert( /(let|const|var)\s{1,}beagle\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md index 9eed1e00605..163be1d2eb9 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md @@ -61,7 +61,7 @@ assert.deepEqual(prototypeProps, ['numLegs']); 在不使用内置方法 `Object.keys()` 的前提下完成这个挑战。 ```js -assert(!/\Object.keys/.test(code)); +assert(!/\Object.keys/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md index f9112d65b0a..f756f621bf8 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md @@ -43,7 +43,7 @@ assert(dog.sayLegs() === 'This dog has 4 legs.'); 应该使用 `this` 关键字来访问 `dog` 对象的 `numLegs` 属性值。 ```js -assert(code.match(/this\.numLegs/g)); +assert(__helpers.removeJSComments(code).match(/this\.numLegs/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md index f33d850d167..f7f69b90619 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md @@ -51,7 +51,7 @@ assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1); 在不使用内置方法 `Object.keys()` 的前提下完成这个挑战。 ```js -assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); +assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(__helpers.removeJSComments(code))); ``` 你应该解决这个挑战,而不是硬编码 `ownProps` 数组。 @@ -59,7 +59,7 @@ assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); ```js assert( !/\[\s*(?:'|")(?:name|numLegs)|(?:push|concat)\(\s*(?:'|")(?:name|numLegs)/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md index da372bdd14d..cdf47e4ec1e 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md @@ -55,7 +55,7 @@ assert(joinDogFraternity(new Dog('')) === true); `joinDogFraternity` 中应该用到 `constructor` 属性。 ```js -assert(/\.constructor/.test(code) && !/instanceof/.test(code)); +assert(/\.constructor/.test(__helpers.removeJSComments(code)) && !/instanceof/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md index d0b9a8b55f4..c0afbe574cc 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md @@ -29,13 +29,13 @@ JavaScript 中的一个常见模式就是,函数在声明后立刻执行: 该函数应该是匿名的。 ```js -assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, ''))); +assert(/\((function|\(\))(=>|\(\)){?/.test(__helpers.removeJSComments(code).replace(/\s/g, ''))); ``` 函数应该在表达式的末尾有括号,以便立即调用它。 ```js -assert(/\(.*(\)\(|\}\(\))\)/.test(code.replace(/[\s;]/g, ''))); +assert(/\(.*(\)\(|\}\(\))\)/.test(__helpers.removeJSComments(code).replace(/[\s;]/g, ''))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md index 01a95e01aca..53a84addb1a 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md @@ -42,7 +42,7 @@ duck.hasOwnProperty("name"); 你的代码应该展示 `Object.prototype` 是 `Dog.prototype` 的原型。 ```js -assert(/Object\.prototype\.isPrototypeOf/.test(code)); +assert(/Object\.prototype\.isPrototypeOf/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md index 6b255e9a6bb..c7c3548ea79 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md @@ -35,7 +35,7 @@ Bird.prototype.isPrototypeOf(duck); `Dog.prototype` 应该是 `beagle` 的 `prototype`。 ```js -assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code)); +assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md index 4991334b9fa..625776c3f45 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md @@ -52,7 +52,7 @@ assert(hound instanceof Dog); 你的代码中应该使用 `new` 操作符来创建 `Dog` 构造函数的新实例。 ```js -assert(code.match(/new/g)); +assert(__helpers.removeJSComments(code).match(/new/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md index 0d034290755..0e1ef1c85fc 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md @@ -43,7 +43,7 @@ ducky.getHatchedEggCount(); `weight` 属性应该是一个私有变量,值应该是 `15`。 ```js -assert(code.match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); ``` 你的代码应该在 `Bird` 中创建一个名为 `getWeight` 方法,该方法返回私有变量 `weight`。 @@ -55,7 +55,7 @@ assert(new Bird().getWeight() === 15); 你的 `getWeight` 函数应该返回私有变量 `weight`。 ```js -assert(code.match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); +assert(__helpers.removeJSComments(code).match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md index 556713d9010..d0ff4e35f1e 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md @@ -29,13 +29,13 @@ console.log(duck.name); 你应该使用 `console.log` 来将 `dog` 对象的 `name` 属性值输出到控制台。 ```js -assert(/console.log\(.*dog\.name.*\)/g.test(code)); +assert(/console.log\(.*dog\.name.*\)/g.test(__helpers.removeJSComments(code))); ``` 你应该使用 `console.log` 来将 `dog` 对象的 `numLegs` 属性值输出到控制台。 ```js -assert(/console.log\(.*dog\.numLegs.*\)/g.test(code)); +assert(/console.log\(.*dog\.numLegs.*\)/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md index c3bf68fe234..b9459b77e06 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md @@ -53,7 +53,7 @@ assert(typeof myHouse.numBedrooms === 'number'); 应该使用 `instanceof` 操作符验证 `myHouse` 这个对象是 `House` 构造函数的一个实例。 ```js -assert(/myHouse\s*instanceof\s*House/.test(code)); +assert(/myHouse\s*instanceof\s*House/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md index b034bed043e..fbfacab8510 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md @@ -75,7 +75,7 @@ assert(!myRegex.test('EleanorRoosevelt')); 你应该使用 `.test()` 方法来检测正则表达式。 ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` 你的返回结果应该为 `true`。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md index c74f6153d19..2d7356cdcdd 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md @@ -51,7 +51,7 @@ assert(codingRegex.source === 'coding'); 您应该使用 `.match()` 方法。 ```js -assert(code.match(/\.match\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.match\(.*\)/)); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md index 1ae4d507daf..e0f8364ed06 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md @@ -31,7 +31,7 @@ huRegex.test(hugStr); 你应该使用 `.test()` 方法。 ```js -assert(code.match(/\.test\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.test\(.*\)/)); ``` 你应该在你的正则表达式 `unRegex` 中使用通配符。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index a7334120cda..8378bf2286d 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -52,7 +52,7 @@ assert(!waldoRegex.test('Somewhere is hiding in this text.')); 你应该使用你的正则表达式对字符串执行文字匹配。 ```js -assert(!/\/.*\/i/.test(code)); +assert(!/\/.*\/i/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md index 2a43999162b..a60e72fc416 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md @@ -27,13 +27,13 @@ assert(result === 'Hello, World!'); 你不应该使用 `String.prototype.trim()` 方法。 ```js -assert(!code.match(/\.?[\s\S]*?trim/)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?trim/)); ``` `result` 变量的值不应该是一个字符串。 ```js -assert(!code.match(/result\s*=\s*["'`].*?["'`]/)); +assert(!__helpers.removeJSComments(code).match(/result\s*=\s*["'`].*?["'`]/)); ``` `hello` 变量的值不应更改。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md index 27b8bcb924d..53d944185a8 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md @@ -37,7 +37,7 @@ wrongText.replace(silverRegex, "blue"); 你应该使用 `.replace()` 搜索并替换。 ```js -assert(code.match(/\.replace\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.replace\(.*\)/)); ``` 你的正则表达式应该将字符串 `one two three` 更改为字符串 `three two one` @@ -49,7 +49,7 @@ assert(result === 'three two one'); 你不应该改变最后一行。 ```js -assert(code.match(/result\s*=\s*str\.replace\(.*?\)/)); +assert(__helpers.removeJSComments(code).match(/result\s*=\s*str\.replace\(.*?\)/)); ``` `fixRegex` 应该至少使用三个抓取组。 diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md index f4f4f510297..d1d40016099 100644 --- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md +++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md @@ -31,7 +31,7 @@ testRegex.test(testStr); 你应该使用 `.test()` 方法来检测正则表达式。 ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` 你的返回结果应该为 `true`。 diff --git a/curriculum/challenges/chinese/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md b/curriculum/challenges/chinese/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md index 902ce0958b1..1fe65eb112a 100644 --- a/curriculum/challenges/chinese/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md +++ b/curriculum/challenges/chinese/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md @@ -15,12 +15,9 @@ You should have `if number >= 10:` within the `for` loop. ```js ({ - test: () => { - const transformedCode = code.replace(/\r/g, ""); - const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); - const { function_body } = verify_card_number; - - assert.match(function_body, /if +number +>= +10:/); + test: () => + { + assert(runPython(`_Node(_code).find_function("verify_card_number").find_for_loops()[1].find_ifs()[0].find_conditions()[0].is_equivalent("number >= 10")`)); } }) ``` diff --git a/curriculum/challenges/chinese/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md b/curriculum/challenges/chinese/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md index 8e93b253d9c..23214a6b2cc 100644 --- a/curriculum/challenges/chinese/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md +++ b/curriculum/challenges/chinese/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md @@ -115,7 +115,10 @@ from importlib import reload reload(probability_calculator) probability_calculator.random.seed(95) -def test_hat_draw(self): + +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw(self): hat = probability_calculator.Hat(red=5,blue=2) actual = hat.draw(2) expected = ['blue', 'red'] @@ -140,6 +143,49 @@ t.result.wasSuccessful() }); ``` +The `draw` method should behave correctly when the number of balls to extract is bigger than the number of balls in the hat. + +```js +({ + test: () => { + pyodide.FS.writeFile("/home/pyodide/probability_calculator.py", code); + pyodide.FS.writeFile( + "/home/pyodide/test_module.py", + ` +import unittest +import probability_calculator +from importlib import reload + +reload(probability_calculator) + +probability_calculator.random.seed(95) +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw_2(self): + hat = probability_calculator.Hat(yellow=5,red=1,green=3,blue=9,test=1) + actual = hat.draw(20) + expected = ['yellow', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'green', 'green', 'green', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'test'] + self.assertEqual(actual, expected, 'Expected hat draw to return all items from hat contents.') + actual = len(hat.contents) + expected = 0 + self.assertEqual(actual, expected, 'Expected hat draw to leave no items in contents.') + ` + ); + const testCode = ` +from unittest import main +import test_module +from importlib import reload + +reload(test_module) +t = main(module='test_module', exit=False) +t.result.wasSuccessful() +`; + const out = __pyodide.runPython(testCode); + assert(out); + }, +}); +``` + The `experiment` method should return a different probability. @@ -221,7 +267,8 @@ class Hat: def draw(self, number): drawn = [] if number >= len(self.contents): - return self.contents + drawn.extend(self.contents) + self.contents = [] else: for i in range(number): drawn.append( @@ -229,8 +276,7 @@ class Hat: ) return drawn -def experiment(hat, expected_balls, num_balls_drawn, num_experiments): - +def experiment(hat, expected_balls, num_balls_drawn, num_experiments): expected_balls_list = [] drawn_list = [] success = 0 @@ -248,12 +294,7 @@ def experiment(hat, expected_balls, num_balls_drawn, num_experiments): except: continue if len(exp_ball_list_copy) == 0: - success += 1 - - - - - probability = success/num_experiments - + success += 1 + probability = success/num_experiments return probability ``` diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md b/curriculum/challenges/chinese/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md index 19ea0d3c265..397f8d13d67 100644 --- a/curriculum/challenges/chinese/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md +++ b/curriculum/challenges/chinese/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md @@ -48,9 +48,9 @@ The initial declaration of the `homeworkStack` should not be changed. ```js assert( - code.match(/=/g).length === 1 && + __helpers.removeJSComments(code).match(/=/g).length === 1 && /homeworkStack\s*=\s*\["BIO12"\s*,\s*"HIS80"\s*,\s*"MAT122"\s*,\s*"PSY44"\]/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md index e33202216f2..a5766cb6414 100644 --- a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md @@ -2,7 +2,6 @@ id: 5f356ed60a5decd94ab66986 title: 步骤 22 challengeType: 0 -removeComments: false dashedName: step-22 --- diff --git a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md index 7b9b4048e72..b91559ab6e5 100644 --- a/curriculum/challenges/chinese/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md +++ b/curriculum/challenges/chinese/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md @@ -40,15 +40,15 @@ assert(canvasFilter === 'blur(2px)'); ## --seed-contents-- ```css +--fcc-editable-region-- .canvas { width: 500px; height: 600px; background-color: #4d0f00; overflow: hidden; ---fcc-editable-region-- ---fcc-editable-region-- } +--fcc-editable-region-- .frame { border: 50px solid black; diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md index 3b9b1764f7c..fff383a6fd7 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md @@ -7,7 +7,7 @@ dashedName: step-55 # --description-- -Inside, the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. +Inside the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. Now, you should see a category displayed underneath each post topic. diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md index eca279b42fe..b69803b87d0 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md @@ -7,9 +7,11 @@ dashedName: step-43 # --description-- -Notice how the `10` value is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. +Notice how the number `10` is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the numbers values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. -To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. Leave the function empty for now. +To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. The parameters of `a` and `b` represent the number values in the array that will be sorted. + +Leave the function empty for now. # --hints-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md index d253c95b6c6..ee57c994e55 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md @@ -26,7 +26,7 @@ assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\( Your callback function should return `a - b`. ```js -assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+a\s*-\s*b\s*;?\s*}\s*\)/); +assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+(?:parseInt)?(?:Number)?\(?a\)?\s*-\s*(?:parseInt)?(?:Number)?\(?b\)?\s*;?\s*}\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b514741ae01..b1b54dda895 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -11,6 +11,8 @@ In your `evalFormula`, declare an `idToText` arrow function which takes an `id` Your `idToText` function should return the result of calling `.find()` on the `cells` array with a callback function that takes an `cell` parameter and returns `cell.id === id`. +Both of your functions should use implicit returns. + # --hints-- You should declare an `idToText` variable in your `evalFormula` function. diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md index 57110b715a9..37487b1771c 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md @@ -23,13 +23,7 @@ Open up the console to see the result. # --hints-- -You should call `.repeat()` on your two `" "` strings. - -```js -assert.lengthOf(code.match(/" ".repeat/g), 2); -``` - -Your `" "` strings should be repeated `rowCount - rowNumber` times. +You should call `.repeat()` on your `" "` strings to repeat them `rowCount - rowNumber` times. ```js assert.equal(padRow(1, 3), " # "); diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md index 3306b1a478b..4170d3bd12b 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md @@ -3,7 +3,6 @@ id: 660f3ce51f70571e1c5227c8 title: Step 69 challengeType: 1 dashedName: step-69 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md index ea0a831040f..7a939244a7c 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md @@ -3,7 +3,6 @@ id: 660f3dd626be3a1ffe27e5d1 title: Step 70 challengeType: 1 dashedName: step-70 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md index e30d808ccb6..b676558ec74 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md @@ -3,7 +3,6 @@ id: 660f4f79e2a82a4e92290f44 title: Step 101 challengeType: 1 dashedName: step-101 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md index dc683e61ce5..3f088de2c91 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md @@ -3,7 +3,6 @@ id: 660f53ad3d39175c5d4335ac title: Step 108 challengeType: 1 dashedName: step-108 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md new file mode 100644 index 00000000000..286128cc2cf --- /dev/null +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md @@ -0,0 +1,74 @@ +--- +id: 662693f82c91a66be46c881b +title: Step 1 +challengeType: 1 +dashedName: step-1 +--- + +# --description-- + +A teacher has finished grading their students' tests and needs your help to calculate the average score for the class. + +Complete the `getAverage` function which takes in an array of test scores and returns the average score. + +The average is calculated by adding up all the scores and dividing by the total number of scores. + +```js +average = sum of all scores / total number of scores +``` + +A couple of function calls have been provided for you so you can test out your code. + +**Tips** + +- You can use a loop to iterate over the `scores` array and add up all the scores. +- You can use the `length` property to get the total number of scores. + +# --hints-- + +Your `getAverage` function should return a number. + +```js +assert.strictEqual(typeof getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 'number'); +``` + +`getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])` should return `71.7`. + +```js +assert.strictEqual(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 71.7); +``` + +`getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])` should return `85.4`. + +```js +assert.strictEqual(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]), 85.4); +``` + +`getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100])` should return `92.4`. + +```js +assert.strictEqual(getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100]), 92.4); +``` + +Your `getAverage` function should return the average score of the test scores. + +```js +assert.strictEqual(getAverage([52, 56, 60, 65, 70, 75, 80, 85, 90, 95]), 72.8); +assert.strictEqual(getAverage([45, 50, 55, 60, 65, 70, 75, 80, 85, 90]), 67.5); +assert.strictEqual(getAverage([38, 42, 46, 50, 54, 58, 62, 66, 70, 74]), 56); +``` + +# --seed-- + +## --seed-contents-- + +```js +--fcc-editable-region-- +function getAverage(scores) { + +} + +console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])); +console.log(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md new file mode 100644 index 00000000000..f7e9253a5a5 --- /dev/null +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md @@ -0,0 +1,104 @@ +--- +id: 6626a060c4006f793e10cb33 +title: Step 2 +challengeType: 1 +dashedName: step-2 +--- + +# --description-- + +Now the teacher needs your help converting the student score to a letter grade. + +Complete the `getGrade` function that takes a number `score` as a parameter. Your function should return a string representing a letter grade based on the score. + +Here are the scores and their corresponding letter grades: + +| Score Range | Grade | +| ----------- | ------- | +| `100` | `"A++"` | +| `90 - 99` | `"A"` | +| `80 - 89` | `"B"` | +| `70 - 79` | `"C"` | +| `60 - 69` | `"D"` | +| `0 - 59` | `"F"` | + + +**Tips** + +- Remember that you learned about conditional statements(`if`, `else if`, and `else`). +- Remember that you learned about comparison operators (`>`, `<`, `>=`, `<=`, `===`). + +# --hints-- + +Your `getGrade` function should return `"A++"` if the score is `100`. + +```js +assert.strictEqual(getGrade(100), "A++"); +``` + +Your `getGrade` function should return `"A"` if the score is `94`. + +```js +assert.strictEqual(getGrade(94), "A"); +``` + +Your `getGrade` function should return `"B"` if the score is between `80` and `89`. + +```js +assert.strictEqual(getGrade(80), "B"); +assert.strictEqual(getGrade(83), "B"); +assert.strictEqual(getGrade(88), "B"); +``` + +Your `getGrade` function should return `"C"` if the score is `78`. + +```js +assert.strictEqual(getGrade(75), "C"); +``` + +Your `getGrade` function should return `"D"` if the score is between `60` and `69`. + +```js +assert.strictEqual(getGrade(60), "D"); +assert.strictEqual(getGrade(63), "D"); +assert.strictEqual(getGrade(68), "D"); +``` + +Your `getGrade` function should return `"F"` if the score is `57`. + +```js +assert.strictEqual(getGrade(57), "F"); +``` + +Your `getGrade` function should return `"F"` if the score is between `0` and `59`. + +```js +assert.strictEqual(getGrade(0), "F"); +assert.strictEqual(getGrade(30), "F"); +assert.strictEqual(getGrade(43), "F"); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} +--fcc-editable-region-- +function getGrade(score) { + +} + +console.log(getGrade(96)); +console.log(getGrade(82)); +console.log(getGrade(56)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md new file mode 100644 index 00000000000..b168e1325fc --- /dev/null +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md @@ -0,0 +1,88 @@ +--- +id: 6626b4c58c027d86478ff5eb +title: Step 3 +challengeType: 1 +dashedName: step-3 +--- + +# --description-- + +The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an `"F"`. + +Complete the function `hasPassingGrade` that takes a student score as a parameter. Your function should return `true` if the student has a passing grade and `false` if they do not. + +**Tips** + +- Use the `getGrade` function to get the student's grade. Then check if the grade is passing or not. + +# --hints-- + +Your `hasPassingGrade` function should return a boolean value. + +```js +assert.strictEqual(typeof hasPassingGrade(100), "boolean"); +``` + +Your `hasPassingGrade` function should return `true` if the grade is an `"A"`. + +```js +assert.isTrue(hasPassingGrade(100)); +``` + +Your `hasPassingGrade` function should return `false` if the grade is an `"F"`. + +```js +assert.isFalse(hasPassingGrade(53)); +``` + +Your `hasPassingGrade` function should return `true` for all passing grades. + +```js +assert.isTrue(hasPassingGrade(87)); +assert.isTrue(hasPassingGrade(60)); +assert.isTrue(hasPassingGrade(73)); +assert.isTrue(hasPassingGrade(96)); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +--fcc-editable-region-- +function hasPassingGrade(score) { + +} + + +console.log(hasPassingGrade(100)); +console.log(hasPassingGrade(53)); +console.log(hasPassingGrade(87)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md new file mode 100644 index 00000000000..08ee3cea27b --- /dev/null +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md @@ -0,0 +1,143 @@ +--- +id: 6626b8dcf5057f896f948440 +title: Step 4 +challengeType: 1 +dashedName: step-4 +--- + +# --description-- + +Now that the teacher has all of the information they need, they want to be able to message the student with the results. + +Complete the `studentMsg` function with `totalScores` and `studentScore` for parameters. The function should return a string representing a message to the student. + +If the student passed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You passed the course. +``` + +If the student failed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You failed the course. +``` + +Replace `average-goes-here` with the average of the total scores. Replace `grade-goes-here` with the student's grade. + +**Tips** + +- Use the `getAverage` function to get the class average. +- Use the `getGrade` function to get the student's grade. +- Use string concatenation (`+`) to build the message. +- Be careful with the punctuation and spaces in the message. + +# --hints-- + +Your function call of `studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)` should return the following message: `"Class average: 71.7. Your grade: F. You failed the course."`. + +```js +assert.strictEqual(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37), "Class average: 71.7. Your grade: F. You failed the course."); +``` + +Your function call of `studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)` should return the following message: `"Class average: 50.8. Your grade: A++. You passed the course."`. + +```js +assert.strictEqual(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100), "Class average: 50.8. Your grade: A++. You passed the course."); +``` + +Your `studentMsg` function should return a the correct message based on the student's score and the class average. + +```js +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 92), "Class average: 70.25. Your grade: A. You passed the course."); +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 57), "Class average: 70.25. Your grade: F. You failed the course."); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +--fcc-editable-region-- +function studentMsg(totalScores, studentScore) { + +} +console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)); +--fcc-editable-region-- + +``` + + +# --solutions-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +function studentMsg(totalScores, studentScore) { + let average = getAverage(totalScores); + let grade = getGrade(studentScore); + + return `Class average: ${average}. Your grade: ${grade}. You ${ + hasPassingGrade(studentScore) ? "passed" : "failed" + } the course.`; +} + +``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md index 3306b1a478b..4170d3bd12b 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md @@ -3,7 +3,6 @@ id: 660f3ce51f70571e1c5227c8 title: Step 69 challengeType: 1 dashedName: step-69 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md index ea0a831040f..7a939244a7c 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md @@ -3,7 +3,6 @@ id: 660f3dd626be3a1ffe27e5d1 title: Step 70 challengeType: 1 dashedName: step-70 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md index e30d808ccb6..b676558ec74 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md @@ -3,7 +3,6 @@ id: 660f4f79e2a82a4e92290f44 title: Step 101 challengeType: 1 dashedName: step-101 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md index dc683e61ce5..3f088de2c91 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md @@ -3,7 +3,6 @@ id: 660f53ad3d39175c5d4335ac title: Step 108 challengeType: 1 dashedName: step-108 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md index fb2547fe52b..881328a896a 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md @@ -87,7 +87,7 @@ assert(confirmEnding('Abstraction', 'action') === true); Tu código no debe usar el método incorporado `.endsWith()` para resolver el desafío. ```js -assert(!/\.endsWith\(.*?\)\s*?;?/.test(code) && !/\['endsWith'\]/.test(code)); +assert(!/\.endsWith\(.*?\)\s*?;?/.test(__helpers.removeJSComments(code)) && !/\['endsWith'\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md index 80e00342ed9..3fae7dd6c15 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md @@ -51,7 +51,7 @@ assert(repeatStringNumTimes('abc', -2) === ''); El método incorporado `repeat()` no debe ser utilizado. ```js -assert(!/\.repeat/g.test(code)); +assert(!/\.repeat/g.test(__helpers.removeJSComments(code))); ``` `repeatStringNumTimes("abc", 0)` debe devolver `""`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md index d4e935809a7..54378846e8a 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md @@ -53,19 +53,19 @@ assert.deepEqual( La función `htmlColorNames` debe utilizar el método `splice()` ```js -assert(/.splice/.test(code)); +assert(/.splice/.test(__helpers.removeJSComments(code))); ``` No debes usar `shift()` o `unshift()`. ```js -assert(!/shift|unshift/.test(code)); +assert(!/shift|unshift/.test(__helpers.removeJSComments(code))); ``` No debes usar notación de corchetes. ```js -assert(!/\[\d\]\s*=/.test(code)); +assert(!/\[\d\]\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md index 5f7752f3e8f..8e0e31b422a 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md @@ -85,8 +85,8 @@ La definición del objeto `foods` no debe modificarse. ```js assert( - code.search(/let foods/) === -1 && - code.search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ + __helpers.removeJSComments(code).search(/let foods/) === -1 && + __helpers.removeJSComments(code).search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ ) !== -1 ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md index e4bf6b48373..d8822226493 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md @@ -27,7 +27,7 @@ No se debe acceder directamente al objeto `users` ```js -assert(code.match(/users/gm).length <= 2) +assert(__helpers.removeJSComments(code).match(/users/gm).length <= 2) ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index a2228a2102f..9ccaf9ac480 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ La función `copyMachine` debe utilizar el `spread operator` (operador de propagación) con el arreglo `arr` ```js -assert(code.match(/\.\.\.\s*arr/)); +assert(__helpers.removeJSComments(__helpers.removeJSComments(code)).match(/\.\.\.\s*arr/)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md index cdf4aa2184c..e422c3a9d02 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md @@ -38,7 +38,7 @@ assert.deepEqual( La función `forecast` debe utilizar el método `slice()` ```js -assert(/\.slice\(/.test(code)); +assert(/\.slice\(/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index 7d5d5ff9450..ee4b8ec6887 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -51,7 +51,7 @@ La función `countOnline` debe utilizar una sentencia `for in` para iterar por l ```js assert( - code.match( + __helpers.removeJSComments(code).match( /for\s*\(\s*(var|let|const)\s+[a-zA-Z_$]\w*\s+in\s+[a-zA-Z_$]\w*\s*\)/ ) ); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md index a26ea9fde77..7ac281b7fb0 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md @@ -61,7 +61,7 @@ assert(userActivity.data.online === 45); La propiedad `online` debe establecerse utilizando la notación de puntos o corchetes. ```js -assert.strictEqual(code.search(/online: 45/), -1); +assert.strictEqual(__helpers.removeJSComments(code).search(/online: 45/), -1); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md index c39f7349f84..ca6e11e85f1 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md @@ -40,7 +40,7 @@ No debes cambiar la línea original de `const arr = [2, 4, 5, 1, 7, 5, 2, 1];`. ```js assert( - __helpers.removeWhiteSpace(code).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) ); ``` @@ -56,14 +56,14 @@ assert.strictEqual( Tu código debe utilizar el método `splice()` en `arr`. ```js -assert(__helpers.removeWhiteSpace(code).match(/arr\.splice\(/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(/)); ``` La división (splice) sólo debe eliminar elementos de `arr` y no agregar ningún elemento adicional a `arr`. ```js assert( - !__helpers.removeWhiteSpace(code).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) + !__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md index ba1f1c1038e..c4bf955e978 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md @@ -39,9 +39,9 @@ Las claves `oranges`, `plums` y `strawberries` deben ser eliminadas usando `dele ```js assert( - code.search(/oranges:/) !== -1 && - code.search(/plums:/) !== -1 && - code.search(/strawberries:/) !== -1 + __helpers.removeJSComments(code).search(/oranges:/) !== -1 && + __helpers.removeJSComments(code).search(/plums:/) !== -1 && + __helpers.removeJSComments(code).search(/strawberries:/) !== -1 ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md index e1c9d1ae4b9..f2a0a9b0d61 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md @@ -54,7 +54,7 @@ Los datos en la variable `myArray` deben ser accedidos utilizando notación de c ```js assert( (function () { - if (code.match(/\s*=\s*myArray\[0\]/g)) { + if (__helpers.removeJSComments(code).match(/\s*=\s*myArray\[0\]/g)) { return true; } else { return false; diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md index dfec200aa06..b21272fbe78 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md @@ -45,7 +45,7 @@ assert(myData === 8); Debes usar notación de corchetes para leer el valor correcto de `myArray`. ```js -assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code))); +assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md index 9c495423b14..c220ab12716 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md @@ -54,7 +54,7 @@ assert(secondTree === 'pine'); Tu código debe usar las notaciones de puntos y de corchetes para acceder a `myPlants`. ```js -assert(/=\s*myPlants\[1\].list\[1\]/.test(code)); +assert(/=\s*myPlants\[1\].list\[1\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md index c81d4c88a3f..6d659effa2d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md @@ -64,7 +64,7 @@ assert(drinkValue === 'water'); Debes usar la notación de corchetes dos veces ```js -assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md index cdd4993d854..50cb40cd6e6 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md @@ -60,7 +60,7 @@ assert(shirtValue === 'jersey'); Debes usar la notación de puntos dos veces ```js -assert(code.match(/testObj\.\w+/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\.\w+/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md index aa99545fb81..a7db71f8ba6 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md @@ -56,19 +56,19 @@ assert(player === 'Montana'); Debes usar la notación de corchetes para acceder a `testObj` ```js -assert(/testObj\s*?\[.*?\]/.test(code)); +assert(/testObj\s*?\[.*?\]/.test(__helpers.removeJSComments(code))); ``` No debes asignar el valor de `Montana` a la variable `player` directamente. ```js -assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); +assert(!__helpers.removeJSComments(code).match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); ``` Debes usar la variable `playerNumber` en tu notación de corchetes ```js -assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code)); +assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md index 2ca9f4d2e55..4ca9ecb79aa 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md @@ -53,7 +53,7 @@ assert(myDog.bark !== undefined); No debes agregar `bark` a la inicialización de `myDog`. ```js -assert(!/bark[^\n]:/.test(code)); +assert(!/bark[^\n]:/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md index 42482299294..6df6af8e6c4 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md @@ -38,7 +38,7 @@ assert(sum === 20); Debes usar el operador `+`. ```js -assert(/\+/.test(code)); +assert(/\+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md index 385ce1e84cb..c4847254541 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md @@ -71,7 +71,7 @@ assert(switchOfStuff(4) === 'stuff'); No debes usar ninguna sentencia `if` o `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Debes utilizar una declaración `default` @@ -83,7 +83,7 @@ assert(switchOfStuff('string-to-trigger-default-case') === 'stuff'); Debes tener al menos 3 declaraciones de ruptura (`break`) ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md index 70e2664e200..5dcfdbbb75d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md @@ -36,7 +36,7 @@ assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2); Debes añadir `someAdjective` a `myStr` usando el operador `+=`. ```js -assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md index 06b548dfb61..f037a839d7c 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md @@ -29,7 +29,7 @@ Asigna el contenido de `a` a la variable `b`. No debes cambiar el código por encima del comentario especificado. ```js -assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code))); ``` `b` debe tener un valor de `7`. @@ -41,7 +41,7 @@ assert(typeof b === 'number' && b === 7); `a` debe ser asignado a `b` utilizando `=`. ```js -assert(/b\s*=\s*a\s*/g.test(code)); +assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md index f8cc92d49a3..0bfe527b272 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md @@ -34,7 +34,7 @@ assert(processed === 2); Debes asignar `processArg` para `processed` ```js -assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code)); +assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md index 3b8523ecf74..38bf81a1d8a 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md @@ -39,19 +39,19 @@ Escribe sentencias `if` / `else if` encadenadas para cumplir con las siguientes Debes tener al menos cuatro sentencias `else` ```js -assert(code.match(/else/g).length > 3); +assert(__helpers.removeJSComments(code).match(/else/g).length > 3); ``` Debes tener al menos cuatro sentencias `if` ```js -assert(code.match(/if/g).length > 3); +assert(__helpers.removeJSComments(code).match(/if/g).length > 3); ``` Debes tener al menos una sentencia `return` ```js -assert(code.match(/return/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/return/g).length >= 1); ``` `testSize(0)` debe devolver la cadena `Tiny` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index 3b6a11ec18a..f9a854d947b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -2,7 +2,6 @@ id: bd7123c9c441eddfaeb4bdef title: Comenta tu código de JavaScript challengeType: 1 -removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' forumTopicId: 16783 dashedName: comment-your-javascript-code diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index 4120b31902a..6af068917ba 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -58,7 +58,7 @@ assert(testEqual('12') === 'Equal'); Debes usar el operador `==` ```js -assert(code.match(/==/g) && !code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/==/g) && !__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index 2d8144e28ff..18b72b6bb3d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -73,7 +73,7 @@ assert(testGreaterThan(150) === 'Over 100'); Debes usar el operador `>` por lo menos dos veces ```js -assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index c5e3368d781..e67ab5cc114 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -73,7 +73,7 @@ assert(testGreaterOrEqual(21) === '20 or Over'); Debes utilizar el operador `>=` al menos dos veces ```js -assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index cb9d1d393d5..6c167213fd1 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -60,7 +60,7 @@ assert(testNotEqual('bob') === 'Not Equal'); Debes utilizar el operador `!=` ```js -assert(code.match(/(?!!==)!=/)); +assert(__helpers.removeJSComments(code).match(/(?!!==)!=/)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index 8a5e32d121f..3c327eaadc2 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -66,7 +66,7 @@ assert(testLessThan(99) === '55 or Over'); Debes usar el operador `<` por lo menos dos veces ```js -assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index e8e436d5909..f3b908fa9ef 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -72,7 +72,7 @@ assert(testLessOrEqual(55) === 'More Than 24'); Debes utilizar el operador `<=` al menos dos veces ```js -assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index 98e42054259..5371d1225a3 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -49,7 +49,7 @@ assert(testStrict('7') === 'Not Equal'); Debes usar el operador `===` ```js -assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index 21677b55138..bb30e273d27 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -52,7 +52,7 @@ assert(testStrictNotEqual('bob') === 'Not Equal'); Debes usar el operador `!==` ```js -assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md index 7d46fcf656f..6cf83f2e251 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md @@ -40,13 +40,13 @@ Reemplaza las dos sentencias if por una sola, usando el operador `&&`, el cual d Debes usar el operador `&&` una vez ```js -assert(code.match(/&&/g).length === 1); +assert(__helpers.removeJSComments(code).match(/&&/g).length === 1); ``` Debes tener una sola sentencia `if` ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalAnd(0)` debe devolver la cadena `No` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md index da2403cc52c..34cb73a0479 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md @@ -43,13 +43,13 @@ Combina las dos sentencias `if` en una sola sentencia que devuelva la cadena `Ou Debes usar el operador `||` una vez ```js -assert(code.match(/\|\|/g).length === 1); +assert(__helpers.removeJSComments(code).match(/\|\|/g).length === 1); ``` Debes tener una sola sentencia `if` ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalOr(0)` debe devolver la cadena `Outside` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md index da94c45a7c8..5d112bc1dc8 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md @@ -54,16 +54,16 @@ assert(c === 19); Debes usar el operador `+=` para cada variable. ```js -assert(code.match(/\+=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\+=/g).length === 3); ``` No debes modificar el código por encima del comentario especificado. ```js assert( - /let a = 3;/.test(code) && - /let b = 17;/.test(code) && - /let c = 12;/.test(code) + /let a = 3;/.test(__helpers.removeJSComments(code)) && + /let b = 17;/.test(__helpers.removeJSComments(code)) && + /let c = 12;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md index 25757dc71a3..7ceb44ca796 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md @@ -48,16 +48,16 @@ assert(c === 3); Debes usar el operador `/=` para cada variable. ```js -assert(code.match(/\/=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\/=/g).length === 3); ``` No debes modificar el código sobre el comentario especificado. ```js assert( - /let a = 48;/.test(code) && - /let b = 108;/.test(code) && - /let c = 33;/.test(code) + /let a = 48;/.test(__helpers.removeJSComments(code)) && + /let b = 108;/.test(__helpers.removeJSComments(code)) && + /let c = 33;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md index 1a75a65e83e..70baaaaa925 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md @@ -48,16 +48,16 @@ assert(c === 46); Debes usar el operador `*=` para cada variable. ```js -assert(code.match(/\*=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\*=/g).length === 3); ``` No debes modificar el código sobre el comentario especificado. ```js assert( - /let a = 5;/.test(code) && - /let b = 12;/.test(code) && - /let c = 4\.6;/.test(code) + /let a = 5;/.test(__helpers.removeJSComments(code)) && + /let b = 12;/.test(__helpers.removeJSComments(code)) && + /let c = 4\.6;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md index 38429d7c6ad..6c8d0691fab 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md @@ -48,14 +48,14 @@ assert(c === 2); Debes usar el operador `-=` para cada variable. ```js -assert(code.match(/-=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/-=/g).length === 3); ``` No debes modificar el código sobre el comentario especificado. ```js assert( - /let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code) + /let a = 11;/.test(__helpers.removeJSComments(code)) && /let b = 9;/.test(__helpers.removeJSComments(code)) && /let c = 3;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md index aad95864f85..947df1f164c 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md @@ -47,19 +47,19 @@ assert(myStr === 'This is the start. This is the end.'); Deberías usar el operador `+` para construir `myStr`. ```js -assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g)); +assert(__helpers.removeJSComments(code).match(/(["']).*\1\s*\+\s*(["']).*\2/g)); ``` `myStr` Debe crearse una variable con la palabra reservada `const`. ```js -assert(/const\s+myStr/.test(code)); +assert(/const\s+myStr/.test(__helpers.removeJSComments(code))); ``` Debes asignar el resultado a la variable `myStr`. ```js -assert(/myStr\s*=/.test(code)); +assert(/myStr\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index ae6eb1acbb1..0a0dfc6c936 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -43,7 +43,7 @@ assert(myStr === 'This is the first sentence. This is the second sentence.'); Deberías usar el operador `+=` para construir `myStr`. ```js -assert(code.match(/myStr\s*\+=\s*(["']).*\1/g)); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*(["']).*\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md index 5e96ba7468c..c3cd9ce7713 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md @@ -35,7 +35,7 @@ assert(typeof myName !== 'undefined' && myName.length > 2); Debes usar dos operadores `+` para construir `myStr` con `myName` dentro de él. ```js -assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); +assert(__helpers.removeJSComments(code).match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md index 27923617d61..be31de550b9 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md @@ -34,13 +34,13 @@ Inserta los números impares desde el 9 hasta el 1 en `myArray` utilizando un bu Debes utilizar un bucle `for` para esto. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` Debes utilizar el método de arreglo `push`. ```js -assert(code.match(/myArray.push/)); +assert(__helpers.removeJSComments(code).match(/myArray.push/)); ``` `myArray` debe ser igual a `[9, 7, 5, 3, 1]`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md index a58e6054596..e44d643551a 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md @@ -37,7 +37,7 @@ Mira el ejemplo `ourName` de arriba si te quedas atascado. Debes declarar `myName` con la palabra clave `var`, terminando con un punto y coma ```js -assert(/var\s+myName\s*;/.test(code)); +assert(/var\s+myName\s*;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md index e1b2bdc16f7..d73802ecc0c 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md @@ -38,25 +38,25 @@ assert(myVar === 10); `myVar = myVar - 1;` debe cambiarse. ```js -assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); ``` No debes asignar `myVar` con `10`. ```js -assert(!code.match(/myVar\s*=\s*10.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*10.*?;?/)); ``` Debes usar el operador `--` en `myVar`. ```js -assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code)); +assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(__helpers.removeJSComments(code))); ``` No debes cambiar el código por encima del comentario especificado. ```js -assert(/let myVar = 11;/.test(code)); +assert(/let myVar = 11;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md index 0c4f33bb912..c3f9ea5541e 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md @@ -55,7 +55,7 @@ assert(typeof myDog === 'object' && myDog.tails === undefined); No debes modificar la disposición de `myDog`. ```js -assert(code.match(/"tails": 1/g).length > 0); +assert(__helpers.removeJSComments(code).match(/"tails": 1/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md index d34c8d2105a..7218c892bd6 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md @@ -26,13 +26,13 @@ assert(quotient === 2.2); Debes usar el operador `/` para dividir 4.4 entre 2 ```js -assert(/4\.40*\s*\/\s*2\.*0*/.test(code)); +assert(/4\.40*\s*\/\s*2\.*0*/.test(__helpers.removeJSComments(code))); ``` La variable quotient debe ser asignada solo una vez ```js -assert(code.match(/quotient\s*=/g).length === 1); +assert(__helpers.removeJSComments(code).match(/quotient\s*=/g).length === 1); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md index b8cc296acad..0dae296f540 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md @@ -35,7 +35,7 @@ assert(quotient === 2); Debes usar el operador `/`. ```js -assert(/\d+\s*\/\s*\d+/.test(code)); +assert(/\d+\s*\/\s*\d+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md index 25c378b2e5e..dd6af92b33f 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md @@ -36,7 +36,7 @@ I am a "double quoted" string inside "double quotes". Debes usar dos comillas dobles (`"`) y cuatro comillas dobles escapadas (`\"`). ```js -assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2); +assert(__helpers.removeJSComments(code).match(/\\"/g).length === 4 && __helpers.removeJSComments(code).match(/[^\\]"/g).length === 2); ``` La variable `myStr` debe contener la cadena: `I am a "double quoted" string inside "double quotes".` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md index 939c2a1c9ac..f2d7d57bba5 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md @@ -29,8 +29,8 @@ No debes cambiar las declaraciones de variables en la sección `// Setup`. ```js assert( - code.match(/let lastNameLength = 0;/) && - code.match(/const lastName = "Lovelace";/) + __helpers.removeJSComments(code).match(/let lastNameLength = 0;/) && + __helpers.removeJSComments(code).match(/const lastName = "Lovelace";/) ); ``` @@ -43,7 +43,7 @@ assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8); Debes obtener la longitud de `lastName` usando `.length` de esta forma: `lastName.length`. ```js -assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/)); +assert(__helpers.removeJSComments(code).match(/=\s*lastName\.length/g) && !__helpers.removeJSComments(code).match(/lastName\s*=\s*8/)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md index af1db16809b..f46377ff5cd 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md @@ -39,7 +39,7 @@ Establece `remainder` igual al resto de `11` dividido entre `3` usando el operad La variable `remainder` debe inicializarse ```js -assert(/(const|let|var)\s+?remainder/.test(code)); +assert(/(const|let|var)\s+?remainder/.test(__helpers.removeJSComments(code))); ``` El valor de `remainder` debe ser `2` @@ -51,7 +51,7 @@ assert(remainder === 2); Debes usar el operador `%` ```js -assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code)); +assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md index a5e13cd8883..e928e48b154 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md @@ -36,7 +36,7 @@ assert((randomFraction() + '').match(/\./g)); Debes usar `Math.random` para generar el número decimal aleatorio. ```js -assert(code.match(/Math\.random/g).length >= 0); +assert(__helpers.removeJSComments(code).match(/Math\.random/g).length >= 0); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md index a8a0d05b1d7..8c077c3262e 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md @@ -46,22 +46,22 @@ assert( Debes usar `Math.random` para generar un número aleatorio. ```js -assert(code.match(/Math.random/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.random/g).length >= 1); ``` Debes haber multiplicado el resultado de `Math.random` por 10 para convertirlo en un número en el rango de cero a nueve. ```js assert( - code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || - code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) + __helpers.removeJSComments(code).match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || + __helpers.removeJSComments(code).match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) ); ``` Debes usar `Math.floor` para eliminar la parte decimal del número. ```js -assert(code.match(/Math.floor/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.floor/g).length >= 1); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md index 63368724002..6e0db4762a9 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md @@ -49,10 +49,10 @@ assert(randomRange(0, 1) % 1 === 0); assert( (function () { if ( - code.match(/myMax/g).length > 1 && - code.match(/myMin/g).length > 2 && - code.match(/Math.floor/g) && - code.match(/Math.random/g) + __helpers.removeJSComments(code).match(/myMax/g).length > 1 && + __helpers.removeJSComments(code).match(/myMin/g).length > 2 && + __helpers.removeJSComments(code).match(/Math.floor/g) && + __helpers.removeJSComments(code).match(/Math.random/g) ) { return true; } else { diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md index 37574a7cf5d..d948bcde30d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md @@ -36,7 +36,7 @@ assert(myGlobal === 10); `myGlobal` debe declararse usando las palabras clave `let` o `const` ```js -assert(/(let|const)\s+myGlobal/.test(code)); +assert(/(let|const)\s+myGlobal/.test(__helpers.removeJSComments(code))); ``` `oopsGlobal` debe ser una variable global y tener un valor de `5` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md index 8567f1098d3..7b6075c243e 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md @@ -45,7 +45,7 @@ assert(myOutfit() === 'sweater'); No debes cambiar la declaración de devolución. ```js -assert(/return outerWear/.test(code)); +assert(/return outerWear/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md index a6ccf7e45d0..4963a0d75fe 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md @@ -39,20 +39,20 @@ No debes utilizar el operador de asignación. ```js assert( - /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(code) + /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(__helpers.removeJSComments(code)) ); ``` Debes usar el operador `++`. ```js -assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code)); +assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(__helpers.removeJSComments(code))); ``` No debes cambiar el código por encima del comentario especificado. ```js -assert(/let myVar = 87;/.test(code)); +assert(/let myVar = 87;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md index 65b18efb7c1..4a5a96e90e7 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md @@ -26,7 +26,7 @@ Define una variable `a` con `var` e inicialízala con un valor de `9`. Debes inicializar `a` con un valor de `9`. ```js -assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code)); +assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md index e5b6cee691c..6b7a034d020 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md @@ -30,20 +30,20 @@ Transforma la lógica para utilizar la sentencia `else if`. Debes tener al menos dos sentencias `else` ```js -assert(code.match(/else/g).length > 1); +assert(__helpers.removeJSComments(code).match(/else/g).length > 1); ``` Debes tener al menos dos sentencias `if` ```js -assert(code.match(/if/g).length > 1); +assert(__helpers.removeJSComments(code).match(/if/g).length > 1); ``` Debes utilizar llaves de apertura y cierre para cada bloque de código `if else`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/ ) ); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md index 700f84c2a76..b9caaea5782 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md @@ -28,13 +28,13 @@ Combina la sentencia `if` en una sola sentencia `if/else`. Sólo debes tener una sentencia `if` en el editor ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` Debes usar una sentencia `else` ```js -assert(/else/g.test(code)); +assert(/else/g.test(__helpers.removeJSComments(code))); ``` `testElse(4)` debe devolver la cadena `5 or Smaller` @@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5'); No debes cambiar el código por encima o por debajo de los comentarios especificados. ```js -assert(/let result = "";/.test(code) && /return result;/.test(code)); +assert(/let result = "";/.test(__helpers.removeJSComments(code)) && /return result;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md index 261fbf0e192..615d4764335 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md @@ -32,7 +32,7 @@ Inserta los números impares desde 1 hasta 9 en `myArray` utilizando un bucle `f Debes utilizar un bucle `for` para esto. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` debe ser igual a `[1, 3, 5, 7, 9]`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md index 0afa922388e..fe4afeacb0d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md @@ -30,7 +30,7 @@ Declara e inicializa una variable `total` a `0`. Usa un bucle `for` para sumar e `total` debe declararse e inicializarse a 0. ```js -assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); ``` `total` debe ser igual a 20. @@ -42,13 +42,13 @@ assert(total === 20); Debes usar un bucle `for` para iterar a través de `myArr`. ```js -assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code)); +assert(/for\s*\(/g.test(__helpers.removeJSComments(code)) && /myArr\s*\[/g.test(__helpers.removeJSComments(code))); ``` No debes intentar asignar directamente el valor 20 al `total`. ```js -assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm)); +assert(!__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/total[=+-]0*[1-9]+/gm)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md index 9cde8169f16..9fb6fae0801 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md @@ -56,7 +56,7 @@ Cambia el bucle `while` en el código por un bucle `do...while`. El bucle solo e Debes utilizar el bucle `do...while` para este ejercicio. ```js -assert(code.match(/do/g)); +assert(__helpers.removeJSComments(code).match(/do/g)); ``` `myArray` debe ser igual a `[10]`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md index 43468541447..7736f246b05 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md @@ -44,7 +44,7 @@ Usa un bucle `for` para empujar los valores desde el 1 al 5 en `myArray`. Debes usar un bucle `for` para esto. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` debe ser igual a `[1, 2, 3, 4, 5]`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md index 304be9cc5ea..ffa64c9bc28 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md @@ -36,7 +36,7 @@ Agrega los números de 5 a 0 (inclusivo) en orden descendente a `myArray` usando Debes utilizar un bucle `while` para esto. ```js -assert(code.match(/while/g)); +assert(__helpers.removeJSComments(code).match(/while/g)); ``` `myArray` debe ser igual a `[5, 4, 3, 2, 1, 0]`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index 3f694becbda..e87888882f4 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -48,7 +48,7 @@ Debes agregar una variable local `myVar`. ```js assert( /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( - __helpers.removeWhiteSpace(code) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)) ) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md index c7690fe0e4a..71cf3aafa2e 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md @@ -47,7 +47,7 @@ assert( Debes usar `pop()` en `myArray`. ```js -assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code)); +assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(__helpers.removeJSComments(code))); ``` `removedFromMyArray` sólo debe contener `["cat", 2]`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md index c7911540f28..568801f8bd0 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md @@ -52,7 +52,7 @@ Debes usar el índice correcto para modificar el valor en `myArray`. ```js assert( (function () { - if (code.match(/myArray\[0\]\s*=\s*/g)) { + if (__helpers.removeJSComments(code).match(/myArray\[0\]\s*=\s*/g)) { return true; } else { return false; diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md index 0f002d81832..a331c4bfd22 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md @@ -94,13 +94,13 @@ assert(sequentialSizes(9) === 'High'); No debes utilizar las sentencias `if` o `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Debes tener nueve sentencias `case` ```js -assert(code.match(/case/g).length === 9); +assert(__helpers.removeJSComments(code).match(/case/g).length === 9); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md index 6682d8f7602..837066948ac 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md @@ -28,7 +28,7 @@ assert(product === 5.0); Debes utilizar el operador `*` ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md index 7dae3ad752c..23114d4d5d9 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md @@ -36,7 +36,7 @@ assert(product === 80); Debes usar el operador `*`. ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md index 5aff0fde18e..52270af992b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md @@ -60,7 +60,7 @@ Debes llamar `functionWithArgs` con dos números después de definirla. ```js assert( /functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test( - code.replace(/\s/g, '') + __helpers.removeJSComments(code).replace(/\s/g, '') ) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md index 6e0f79f008b..1c063e4befe 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md @@ -47,7 +47,7 @@ assert(compareEquality('20', 20) === 'Not Equal'); Debes usar el operador `===` ```js -assert(code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index 6c462626a2c..3690926cc56 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -47,7 +47,7 @@ Debes eliminar todas las barras invertidas (`\`). ```js assert( - !/\\/g.test(code) && + !/\\/g.test(__helpers.removeJSComments(code)) && myStr.match( '\\s*\\s*Link\\s*\\s*' ) @@ -57,7 +57,7 @@ assert( Debes tener dos comillas simples `'` y cuatro comillas dobles `"`. ```js -assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2); +assert(__helpers.removeJSComments(code).match(/"/g).length === 4 && __helpers.removeJSComments(code).match(/'/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index 891a471e0c3..5947d7092ac 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,7 +66,7 @@ Tu código no debe depender de ningún tipo de bluces (`for` o `while`) o funcio ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md index 3094af5b926..137e6020c53 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md @@ -45,19 +45,19 @@ Cambia la cadena de sentencias `if`/`else if` por una sentencia `switch`. No debes utilizar sentencias `else` en ningún lugar en el editor ```js -assert(!/else/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code))); ``` No debes utilizar sentencias `if` en ningún lugar en el editor ```js -assert(!/if/g.test(code)); +assert(!/if/g.test(__helpers.removeJSComments(code))); ``` Debes tener al menos cuatro sentencias `break` ```js -assert(code.match(/break/g).length >= 4); +assert(__helpers.removeJSComments(code).match(/break/g).length >= 4); ``` `chainToSwitch("bob")` debe devolver una cadena `Marley` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md index 92009939929..cf97ba06fd2 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md @@ -52,7 +52,7 @@ assert(isLess(15, 10) === false); No debes utilizar las sentencias `if` o `else` ```js -assert(!/if|else/g.test(code)); +assert(!/if|else/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md index 692c19679a0..32e56124847 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md @@ -63,13 +63,13 @@ assert(caseInSwitch(4) === 'delta'); No debes usar ninguna sentencia `if` o `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Debes tener al menos 3 declaraciones `break` ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md index 38e4883b7f8..6ff0fb65574 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md @@ -35,7 +35,7 @@ Asigna el valor `7` a la variable `a`. No debes cambiar el código por encima del comentario especificado. ```js -assert(/var a;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code))); ``` `a` debe tener un valor de 7. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md index 9781ed90a5a..0a46ecf3d80 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md @@ -35,7 +35,7 @@ assert(difference === 12); Solo debes restar un número de `45`. ```js -assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code))); +assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md index 295144207d9..e55b4b1bca7 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md @@ -40,7 +40,7 @@ assert(myStr === 'Hello World'); No debes cambiar el código por encima del comentario especificado. ```js -assert(/myStr = "Jello World"/.test(code)); +assert(/myStr = "Jello World"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md index 70d7938d8f1..f1e627d616b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md @@ -56,19 +56,19 @@ assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000); `studlyCapVar` debe usar camelCase tanto en las secciones de declaración como de asignación. ```js -assert(code.match(/studlyCapVar/g).length === 2); +assert(__helpers.removeJSComments(code).match(/studlyCapVar/g).length === 2); ``` `properCamelCase` debe usar camelCase tanto en las secciones de declaración como de asignación. ```js -assert(code.match(/properCamelCase/g).length === 2); +assert(__helpers.removeJSComments(code).match(/properCamelCase/g).length === 2); ``` `titleCaseOver` debe usar camelCase tanto en las secciones de declaración como de asignación. ```js -assert(code.match(/titleCaseOver/g).length === 2); +assert(__helpers.removeJSComments(code).match(/titleCaseOver/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index dad4084c8b4..18d55b654b8 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -39,9 +39,9 @@ No debes cambiar el código debajo del comentario especificado. ```js assert( - /a = a \+ 1;/.test(code) && - /b = b \+ 5;/.test(code) && - /c = c \+ " String!";/.test(code) + /a = a \+ 1;/.test(__helpers.removeJSComments(code)) && + /b = b \+ 5;/.test(__helpers.removeJSComments(code)) && + /c = c \+ " String!";/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md index b72ddf979cc..1f921bd5d15 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md @@ -39,7 +39,7 @@ assert(/happy coder/gi.test(myDog.name)); No debes editar la definición de `myDog`. ```js -assert(/"name": "Coder"/.test(code)); +assert(/"name": "Coder"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md index 0da67d79d65..73fc5c66fcb 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md @@ -41,7 +41,7 @@ assert(firstLetterOfLastName === 'L'); Debes usar la notación de corchetes. ```js -assert(code.match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md index cbd72ed8530..3159100429a 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(lastLetterOfLastName === 'e'); Debes usar `.length` para obtener la última letra. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md index ca9a4139dd0..7a3c7998210 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md @@ -39,7 +39,7 @@ assert(thirdLetterOfLastName === 'v'); Debes usar la notación de corchetes. ```js -assert(code.match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md index e8a7788cfe4..4de73b852bd 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(secondToLastLetterOfLastName === 'c'); Debes usar `.length` para obtener la penúltima letra. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md index ffd48934b02..4aeae3a8cdd 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md @@ -54,7 +54,7 @@ En la función `checkSign`, usa múltiples operadores condicionales (siguiendo e `checkSign` debe utilizar múltiples operadores condicionales ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(__helpers.removeJSComments(code))); ``` `checkSign(10)` debe devolver la cadena `positive`. Ten en cuenta que la capitalización importa diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index 53fc78c4eac..7db8a62ebd5 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,7 +59,7 @@ Tu código no debe depender de ningún tipo de bucles (`for`, `while` o funcione ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index 1cd7d40d742..59b467cc735 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,7 +26,7 @@ Tu código no debe utilizar bucles (`for`, `while` o funciones de orden superior ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index 4de81e17e8e..4e3a1f997c6 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -42,7 +42,7 @@ Utiliza el operador condicional en la función `checkEqual` para comprobar si do `checkEqual` debe usar el operador condicional ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(__helpers.removeJSComments(code))); ``` `checkEqual(1, 2)` debe devolver la cadena `Not Equal` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md index d90574d1e9a..80ef00fee41 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md @@ -34,7 +34,7 @@ Utiliza `parseInt()` en la función `convertToInteger` para convertir un número `convertToInteger` debe utilizar la función `parseInt()` ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("10011")` debe devolver un número diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md index 0af05486470..22ff9d5e42a 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md @@ -26,7 +26,7 @@ Utiliza `parseInt()` en la función `convertToInteger` para convertir la cadena `convertToInteger` debe utilizar la función `parseInt()` ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("56")` debe devolver un número diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md index 5beff7fc082..b5c65892821 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md @@ -83,14 +83,14 @@ assert(typeof phoneticLookup('') === 'undefined'); No debes modificar la sentencia `return` ```js -assert(code.match(/return\sresult;/)); +assert(__helpers.removeJSComments(code).match(/return\sresult;/)); ``` No debes usar sentencias `case`, `switch`o `if` ```js assert( - !/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) + !/case|switch|if/g.test(__helpers.removeJSComments(code).replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md index 929b5c4c378..490d47a9f4a 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md @@ -53,7 +53,7 @@ assert( No debes utilizar directamente los valores `dog`, `ran`, `big` o `quickly` para crear `wordBlanks`. ```js -const newCode = removeAssignments(code); +const newCode = removeAssignments(__helpers.removeJSComments(code)); assert( !/dog/.test(newCode) && !/ran/.test(newCode) && diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md index 56d56126f27..c614f85a73c 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md @@ -50,7 +50,7 @@ Debes llamar `reusableFunction` después de definirla. ```js const functionStr = reusableFunction && __helpers.removeWhiteSpace(reusableFunction.toString()); -const codeWithoutFunction = __helpers.removeWhiteSpace(code).replace(/reusableFunction\(\)\{/g, ''); +const codeWithoutFunction = __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).replace(/reusableFunction\(\)\{/g, ''); assert(/reusableFunction\(\)/.test(codeWithoutFunction)); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md index 6fef37db011..beb79ec6289 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md @@ -25,7 +25,7 @@ assert(power == 8); Tu código debe utilizar el orden correcto de los argumentos para la llamada a la función `raiseToPower`. ```js -assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); +assert(__helpers.removeJSComments(code).match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md index 5ca7eb7330c..c0c9f09ab01 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md @@ -37,7 +37,7 @@ assert(result == 9); Tu código debe llamar a la función `getNine`. ```js -assert(code.match(/getNine\(\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/getNine\(\)/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md index 4a3f8b8f1da..656f8eaf389 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md @@ -27,25 +27,25 @@ assert(netWorkingCapital === 2); No debe haber casos de variables mal escritas en el código. ```js -assert(!code.match(/recievables/g)); +assert(!__helpers.removeJSComments(code).match(/recievables/g)); ``` La variable `receivables` debe ser declarada y utilizada correctamente en el código. ```js -assert(code.match(/receivables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/receivables/g).length == 2); ``` No debe haber casos de variables mal escritas en el código. ```js -assert(!code.match(/payable;/g)); +assert(!__helpers.removeJSComments(code).match(/payable;/g)); ``` La variable `payables` debe ser declarada y utilizada correctamente en el código. ```js -assert(code.match(/payables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/payables/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index 2faab47cf7b..2ec8020e937 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -37,13 +37,13 @@ Corrige la cadena para que use comillas diferentes para el valor de `href`, o re Tu código debe corregir las comillas alrededor del valor `href` `#Home` cambiándolas o escapándolas. ```js -assert(code.match(//g)); +assert(__helpers.removeJSComments(code).match(//g)); ``` Tu código debe mantener las comillas dobles alrededor de toda la cadena. ```js -assert(code.match(/"

.*?<\/p>";/g)); +assert(__helpers.removeJSComments(code).match(/"

.*?<\/p>";/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md index 0a5cc8966f6..3bc0b773a8b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md @@ -37,25 +37,25 @@ Corrige los dos errores de indexación en la siguiente función para que todos l Tu código debe establecer la condición inicial del bucle para que comience en el primer índice. ```js -assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?=\s*?0\s*?;/g).length == 1); ``` Tu código debe corregir la condición inicial del bucle para que el índice comience en 0. ```js -assert(!code.match(/i\s?=\s*?1\s*?;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s?=\s*?1\s*?;/g)); ``` Tu código debe establecer la condición terminal del bucle para que se detenga en el último índice. ```js -assert(code.match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); ``` Tu código debe corregir la condición terminal del bucle para que se detenga en 1 antes de la longitud. ```js -assert(!code.match(/i\s*?<=\s*?len;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?<=\s*?len;/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md index a4f71c11c07..bc1bfbae50c 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md @@ -21,7 +21,7 @@ Corrige los dos errores de par en el código. Tu código debe arreglar la pieza que falta en el arreglo. ```js -assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); +assert(__helpers.removeJSComments(code).match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); ``` Tu código debe arreglar la pieza que falta del método `.reduce()`. La salida de la consola debe mostrar `Sum of array values is: 6`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md index 8f2780e32de..34498596486 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md @@ -43,7 +43,7 @@ assert(result == 'Not equal!'); La condición debe utilizar `==` o `===` para comprobar igualdad. ```js -assert(code.match(/x\s*?===?\s*?y/g)); +assert(__helpers.removeJSComments(code).match(/x\s*?===?\s*?y/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md index 05b594f5973..b986778de70 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md @@ -31,13 +31,13 @@ La función `myFunc()` contiene un bucle infinito porque la condición terminal Tu código debe cambiar el operador de comparación en la condición terminal (la parte central) del bucle `for`. ```js -assert(code.match(/i\s*?<=\s*?4;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?<=\s*?4;/g).length == 1); ``` Tu código debe corregir el operador de comparación en la condición terminal del bucle. ```js -assert(!code.match(/i\s*?!=\s*?4;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?!=\s*?4;/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index 4b67e2f042d..b1ecfae9590 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -23,7 +23,7 @@ Después, utiliza `console.log` para mostrar la variable `output`. Ve ambas cons Debes utilizar `console.log()` para imprimir la variable `output`. ```js -assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/console\.log\(output\)/)); ``` Debes utilizar `console.clear()` para borrar la consola del navegador. @@ -31,7 +31,7 @@ Debes utilizar `console.clear()` para borrar la consola del navegador. ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console.clear\(\)/) ); ``` @@ -41,7 +41,7 @@ Debes borrar la consola luego de tu registro. ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console\.log\(output\)[\s\S]*console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md index 9ac68fa95ff..5e542495b97 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md @@ -29,7 +29,7 @@ Utiliza el método `console.log()` para imprimir el valor de la variable `a` don Tu código debe utilizar `console.log()` para comprobar el valor de la variable `a`. ```js -assert(code.match(/console\.log\(a\)/g)); +assert(__helpers.removeJSComments(code).match(/console\.log\(a\)/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md index c6dc2709d7d..1bb756aa364 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md @@ -32,19 +32,19 @@ Agrega dos sentencias `console.log()` para comprobar el `typeof` de cada una de Tu código debe utilizar `typeof` en dos sentencias `console.log()` para comprobar el tipo de las variables. ```js -assert(code.match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); ``` Tu código debe utilizar `typeof` para comprobar el tipo de la variable `seven`. ```js -assert(code.match(/typeof[\( ]seven\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]seven\)?/g)); ``` Tu código debe utilizar `typeof` para comprobar el tipo de la variable `three`. ```js -assert(code.match(/typeof[\( ]three\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]three\)?/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index 632e99456f0..4d16dff87f1 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -87,13 +87,13 @@ Este ejercicio está diseñado para ilustrar la diferencia entre como las palabr `var` no debería existir en el código. ```js -assert(!code.match(/var/g)); +assert(!__helpers.removeJSComments(code).match(/var/g)); ``` La variable `i` declarada en la sentencia `if` debe ser igual a la cadena `block scope`. ```js -assert(code.match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); +assert(__helpers.removeJSComments(code).match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); ``` `checkScope()` debe devolver la cadena `function scope` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index 1035ca0678c..766a54702d5 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,7 +32,7 @@ Haz una función promesa que maneje el éxito y el fallo. Si `responseFromServer ```js assert( - code.match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) ); ``` @@ -40,7 +40,7 @@ assert( ```js assert( - code.match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md index f685ae43ad1..808ebdacb0b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md @@ -32,7 +32,7 @@ Tu promesa debe recibir una función con `resolve` y `reject` como parámetros. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /Promise\s*\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g ) ); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md index ec7d0442db1..f828512e1b3 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md @@ -25,14 +25,14 @@ Agrega un script de tipo `module` al documento HTML y asígnale el archivo fuent Debes crear una etiqueta `script`. ```js -assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); +assert(__helpers.removeJSComments(code).match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); ``` Tu etiqueta `script` debe tener un atributo `type` con un valor de `module`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g ) ); @@ -42,7 +42,7 @@ Tu etiqueta `script` debe tener un `src` con el valor `index.js`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g ) ); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md index b74c0d192cb..c9d5cd53b22 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md @@ -38,7 +38,7 @@ Tu código debe utilizar un `export` fallback. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g ) ); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md index 4f0d8df1dba..1da84d7b1bd 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md @@ -75,7 +75,7 @@ assert.match(code, /(`.*\${.*}.*`)/); Debe utilizarse un iterador. ```js -assert(code.match(/for|map|reduce|forEach|while/)); +assert(__helpers.removeJSComments(code).match(/for|map|reduce|forEach|while/)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md index 9ab67d7e949..a7cb95f1e63 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md @@ -34,7 +34,7 @@ Debes llamar al método `then` en la promesa. ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.then\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.then\(/g) ); ``` @@ -50,7 +50,7 @@ Debes imprimir `result` en la consola. assert( resultIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.then\(.*?result.*?console.log\(result\).*?\)/) ); ``` @@ -60,7 +60,7 @@ assert( ## --after-user-code-- ```js -const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(code)); +const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md index 59fb07628a1..08dbe086399 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md @@ -28,7 +28,7 @@ Debes llamar al método `catch` en la promesa. ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.catch\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.catch\(/g) ); ``` @@ -44,7 +44,7 @@ Debes imprimir `error` en la consola. assert( errorIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.catch\(.*?error.*?console.log\(error\).*?\)/) ); ``` @@ -54,7 +54,7 @@ assert( ## --after-user-code-- ```js -const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(code)); +const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md index c7b1c70fda3..cc2b60a10ad 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md @@ -25,7 +25,7 @@ El siguiente código, importa como exportación por defecto, desde el archivo `m Debes importar correctamente `subtract` de `math_functions.js`. ```js -assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); +assert(__helpers.removeJSComments(code).match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md index 79b8f4c20de..23eff2ed072 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md @@ -36,19 +36,19 @@ Un arreglo es declarado como `const s = [5, 7, 2]`. Cambia el arreglo a `[2, 5, No debes reemplazar la palabra clave `const`. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `s` debe ser una variable constante (utilizando `const`). ```js -assert(code.match(/const\s+s/g)); +assert(__helpers.removeJSComments(code).match(/const\s+s/g)); ``` No debes cambiar la declaración original del arreglo. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g )); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md index 7ecbf6ea8df..111614f291b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md @@ -34,19 +34,19 @@ En este desafío vas a utilizar `Object.freeze` para prevenir el cambio de const No debes reemplazar la palabra clave `const`. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `MATH_CONSTANTS` debe ser una variable constante (utilizando `const`). ```js -assert(code.match(/const\s+MATH_CONSTANTS/g)); +assert(__helpers.removeJSComments(code).match(/const\s+MATH_CONSTANTS/g)); ``` No debes modificar la declaración original de `MATH_CONSTANTS`. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g )); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md index 24ac03bf3b5..77dc06a0695 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md @@ -32,7 +32,7 @@ Debes importar `uppercaseString` apropiadamente. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); @@ -42,7 +42,7 @@ Debes importar `lowercaseString` apropiadamente. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index ec374b4f912..dbfeeec82ee 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -44,7 +44,7 @@ assert(increment(5) === 6); Un valor de parámetro por defecto de `1` debe utilizarse para `value`. ```js -assert(code.match(/value\s*=\s*1/g)); +assert(__helpers.removeJSComments(code).match(/value\s*=\s*1/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md index 10248aa0ead..0d62d1067de 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md @@ -31,7 +31,7 @@ Tu código debe utilizar apropiadamente la sintaxis `import * as`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g ) ); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index 977c6f293aa..977d16a6504 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -66,7 +66,7 @@ assert( La palabra clave `class` debe ser utilizada. ```js -assert(code.match(/class/g)); +assert(__helpers.removeJSComments(code).match(/class/g)); ``` `Vegetable` debe ser capaz de ser instanciada. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md index 5d55a85a74e..dcc1d74c33f 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md @@ -51,7 +51,7 @@ assert(b === 8); Debes usar la desestructuración de arreglos para intercambiar `a` y `b`. ```js -assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code)); +assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index ccee86b8f47..20161d64861 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -43,8 +43,8 @@ Debes eliminar la sintaxis de asignación ES5. ```js assert( - !code.match(/lowToday = LOCAL_FORECAST\.today\.low/g) && - !code.match(/highToday = LOCAL_FORECAST\.today.high/g) + !__helpers.removeJSComments(code).match(/lowToday = LOCAL_FORECAST\.today\.low/g) && + !__helpers.removeJSComments(code).match(/highToday = LOCAL_FORECAST\.today.high/g) ); ``` @@ -52,7 +52,7 @@ Debes usar desestructuración para crear la variable `lowToday`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(low\s*:\s*lowToday[^}]*|[^,]*,\s*low\s*:\s*lowToday\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); @@ -62,7 +62,7 @@ Debes usar desestructuración para crear la variable `highToday`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday,?\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index 5dead4cb4bf..05ebaee62d4 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -34,8 +34,8 @@ Debes eliminar la sintaxis de asignación ES5. ```js assert( - !code.match(/highToday = HIGH_TEMPERATURES\.today/g) && - !code.match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) + !__helpers.removeJSComments(code).match(/highToday = HIGH_TEMPERATURES\.today/g) && + !__helpers.removeJSComments(code).match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) ); ``` @@ -43,7 +43,7 @@ Debes usar desestructuración para crear la variable `highToday`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(today\s*:\s*highToday[^}]*|[^,]*,\s*today\s*:\s*highToday\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); @@ -53,7 +53,7 @@ Debes usar desestructuración para crear la variable `highTomorrow`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(tomorrow\s*:\s*highTomorrow[^}]*|[^,]*,\s*tomorrow\s*:\s*highTomorrow\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 165a2825feb..972ddd743db 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,7 +43,7 @@ Debes eliminar la sintaxis de asignación ES5. ```js assert( - !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !__helpers.removeJSComments(code).match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -51,7 +51,7 @@ Debes usar desestructuración para crear la variable `today`. ```js assert( - code.match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` @@ -59,7 +59,7 @@ Debes usar desestructuración para crear la variable `tomorrow`. ```js assert( - code.match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md index b1d2e94ecc8..ac27ebe96ea 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md @@ -50,13 +50,13 @@ assert(half(stats) === 28.015); Se debe utilizar desestructuración. ```js -assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/half=\({\w+,\w+}\)/)); ``` Se debe usar un parámetro desestructurado. ```js -assert(!code.match(/stats\.max|stats\.min/)); +assert(!__helpers.removeJSComments(code).match(/stats\.max|stats\.min/)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index c320759aef3..9214da43673 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -47,7 +47,7 @@ assert.deepEqual(_testArr, [1, 2, 3, 4, 5]) `Array.slice()` no debe ser usado. ```js -assert(!code.match(/\.\s*slice\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*slice\s*\(/)); ``` Debes utilizar el rest sintaxis. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md index aecf3c0610f..edd7d076843 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md @@ -42,7 +42,7 @@ Debes exportar correctamente `uppercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+uppercaseString|export\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)})/g ) ); @@ -52,7 +52,7 @@ Debes exportar correctamente `lowercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+lowercaseString|export\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)})/g ) ); diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md index 4126e81531c..6857431ae21 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md @@ -57,7 +57,7 @@ assert(sum() === 0); `sum` debe ser una función flecha que utilice la sintaxis de parámetro rest (`...`) en el parámetro `args`. ```js -assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/sum=\(\.\.\.args\)=>/)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md index bac9a8184fb..f7a9a7533fa 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md @@ -55,7 +55,7 @@ assert(arr2.every((v, i) => v === arr1[i]) && arr2.length); El operador de propagación `...` debe ser usado para duplicar `arr1`. ```js -assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); +assert(__helpers.removeJSComments(code).match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); ``` `arr2` debe permanecer sin cambios cuando `arr1` cambie. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md index d247fe83f98..bfbf4344eb3 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md @@ -54,7 +54,7 @@ assert.match(code, /const\s+myConcat/g); ```js assert( - /myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) && + /myConcat=\(\w+,\w+\)=>/.test(__helpers.removeJSComments(code).replace(/\s/g, '')) && typeof myConcat === 'function' ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 76e44f6c44d..f8af4026f87 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,14 +39,14 @@ Refactoriza la función `setGear` dentro del objeto `bicycle` para que utilice l La expresión tradicional "function" no debe ser utilizada. ```js -assert(!code.match(/function/)); +assert(!__helpers.removeJSComments(code).match(/function/)); ``` `setGear` debe ser una función declarativa. ```js assert( - typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/) + typeof bicycle.setGear === 'function' && __helpers.removeJSComments(code).match(/setGear\s*\(.+\)\s*\{/) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md index 060ce74d905..14fa8eca66d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md @@ -43,7 +43,7 @@ assert.deepEqual( Tu código no debe usar `key:value`. ```js -assert(!code.match(/:/g)) +assert(!__helpers.removeJSComments(code).match(/:/g)) ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md index d1c4177fdf6..829c66ea67d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md @@ -30,13 +30,13 @@ Cambia la función `nonMutatingPush` de manera que utilice `concat` para unir `n El código debe utilizar el método `concat`. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` El código no debe utilizar el método `push`. ```js -assert(!code.match(/\.?[\s\S]*?push/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?push/g)); ``` El arreglo `first` no debe modificarse. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md index 7a112f2a1d8..ce3fd6a8aa2 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md @@ -31,7 +31,7 @@ El resultado no debe tener espacios Tu código no debe utilizar el método `replace` para este desafío. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `urlSlug("Winter Is Coming")` debe devolver la cadena `winter-is-coming`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md index 259cb36d583..cdf138dd7b7 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md @@ -27,13 +27,13 @@ Utiliza el método `join` (entre otros) dentro de la función `sentensify` para Tu código debe usar el método `join`. ```js -assert(code.match(/\.join/g)); +assert(__helpers.removeJSComments(code).match(/\.join/g)); ``` Tu código no debe utilizar el método `replace`. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `sentensify("May-the-force-be-with-you")` debe devolver una cadena. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md index 093ca3c21bd..25fb76d22b0 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md @@ -25,7 +25,7 @@ Usa el método `concat` en la función `nonMutatingConcat` para concatenar `atta Tu código debe usar el método `concat`. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` El arreglo `first` no debe cambiar. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md index ad2593c96d1..e5141416f99 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md @@ -47,7 +47,7 @@ assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_ Tu código no debe usar el método `map`. ```js -assert(!code.match(/\.?[\s\S]*?map/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?map/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md index 52181abf9c4..17e51069db9 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md @@ -43,7 +43,7 @@ assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFi Tu código no debe usar el método `filter`. ```js -assert(!code.match(/\.?[\s\S]*?filter/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?filter/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md index 16f2d4b5884..1b1a9bfb4bb 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md @@ -77,7 +77,7 @@ assert(add(11)(22)(33) === 66); Tu código deber incluir una declaración final que devuelva `x + y + z`. ```js -assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); +assert(__helpers.removeJSComments(code).match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md index 434ed4feee9..0f76aae9662 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md @@ -30,13 +30,13 @@ No modifiques el arreglo original proporcionado en la función. Tu código debe usar el método `slice`. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` Tu código no debe usar el método `splice`. ```js -assert(!code.match(/\.?[\s\S]*?splice/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?splice/g)); ``` No debes mutar el array original pasado a la función. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md index c64fccc1623..23f6c512483 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md @@ -28,7 +28,7 @@ Utiliza el método `slice` en la función `sliceArray` para retornar parte del a Tu código debe usar el método `slice`. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` La variable `inputAnim` no debe cambiar. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md index 169a9c8a3dd..9b5d0cccab6 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md @@ -47,7 +47,7 @@ Utiliza el método `sort` en la función `alphabeticalOrder` para ordenar los el Tu código debe usar el método `sort`. ```js -assert(code.match(/\.sort/g)); +assert(__helpers.removeJSComments(code).match(/\.sort/g)); ``` `alphabeticalOrder(["a", "d", "c", "a", "z", "g"])` debe devolver `["a", "a", "c", "d", "g", "z"]`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md index c701217f92f..7b848eaa309 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md @@ -33,7 +33,7 @@ Utiliza el método `split` dentro de la función `splitify` para dividir `str` e Tu código debe usar el método `split`. ```js -assert(code.match(/\.split/g)); +assert(__helpers.removeJSComments(code).match(/\.split/g)); ``` `splitify("Hello World,I-am code")` debe devolver `["Hello", "World", "I", "am", "code"]`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index 9f6a7940307..c80d0a78891 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), `for`, `while`, y `forEach` no deben ser usados. ```js -assert(!code.match(/for|while|forEach/g)); +assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ``` `map`, `filter`, o `reduce` deben ser usados. @@ -36,7 +36,7 @@ assert(!code.match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md index a4bbb2bd692..59c4a3ab938 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md @@ -31,7 +31,7 @@ Utiliza el método `every` dentro de la función `checkPositive` para comprobar Tu código debe usar el método `every`. ```js -assert(code.match(/\.every/g)); +assert(__helpers.removeJSComments(code).match(/\.every/g)); ``` `checkPositive([1, 2, 3, -4, 5])` debe devolver `false`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md index 3647da8e742..f64bf321b26 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md @@ -46,13 +46,13 @@ assert( Tu código debe usar el método `filter`. ```js -assert(code.match(/\s*\.\s*filter/g)); +assert(__helpers.removeJSComments(code).match(/\s*\.\s*filter/g)); ``` El código no debe utilizar el bucle `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` `filteredList` debe ser igual a `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"}, {"title": "Batman Begins", "rating": "8.3"}]`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index df993a4be34..b61057a8e9c 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,13 +52,13 @@ assert( Tu código no debe usar un bucle `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); ``` Tu código debe usar el método `map`. ```js -assert(code.match(/\.map/g)); +assert(__helpers.removeJSComments(code).match(/\.map/g)); ``` `ratings` debe ser igual a `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"},{"title": "Batman Begins", "rating": "8.3"}, {"title": "Avatar", "rating": "7.9"}]`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md index f3d3aac7bcd..58f7e7a1f91 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md @@ -66,7 +66,7 @@ assert( Tu código debe utilizar el método `reduce`. ```js -assert(code.match(/\.reduce/g)); +assert(__helpers.removeJSComments(code).match(/\.reduce/g)); ``` `getRating(watchList)` debe ser igual a 8.675. @@ -78,7 +78,7 @@ assert(getRating(watchList) === 8.675); Tu código no debe usar un bucle `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` Tu código debe devolver el resultado correcto después de modificar el objeto `watchList`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md index 3673e4b4d53..f7a2947f9f4 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md @@ -31,7 +31,7 @@ Utiliza el método `some` dentro de la función `checkPositive` para comprobar s Tu código debe usar el método `some`. ```js -assert(code.match(/\.some/g)); +assert(__helpers.removeJSComments(code).match(/\.some/g)); ``` `checkPositive([1, 2, 3, -4, 5])` debe devolver `true`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md index 9fb66cc6175..f4719bdd0e6 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md @@ -39,7 +39,7 @@ assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4]); Tu solución no debe utilizar los métodos `Array.prototype.flat()` o `Array.prototype.flatMap()`. ```js -assert(!code.match(/\.\s*flat\s*\(/) && !code.match(/\.\s*flatMap\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*flat\s*\(/) && !__helpers.removeJSComments(code).match(/\.\s*flatMap\s*\(/)); ``` Las variables globales no deben ser usadas. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md index e76fe8125a2..517175355fc 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md @@ -49,7 +49,7 @@ Agrega la propiedad `numLegs`, y los dos métodos `eat()` y `describe()` al `pro `Dog.prototype` debe establecerse a un nuevo objeto. ```js -assert(/Dog\.prototype\s*?=\s*?{/.test(code)); +assert(/Dog\.prototype\s*?=\s*?{/.test(__helpers.removeJSComments(code))); ``` `Dog.prototype` debe tener la propiedad `numLegs`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md index d8a30a83af7..dbeaf5738a5 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md @@ -61,7 +61,7 @@ La variable `duck` debe inicializarse con `Object.create`. ```js assert( /(let|const|var)\s{1,}duck\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` @@ -71,7 +71,7 @@ La variable `beagle` debe inicializarse con `Object.create`. ```js assert( /(let|const|var)\s{1,}beagle\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md index 801351115c9..b5a8280cd85 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md @@ -61,7 +61,7 @@ assert.deepEqual(prototypeProps, ['numLegs']); Debes resolver este desafío sin usar el método incorporado `Object.keys()`. ```js -assert(!/\Object.keys/.test(code)); +assert(!/\Object.keys/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md index 08e6f32e8c0..ab50c06a7b5 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md @@ -43,7 +43,7 @@ assert(dog.sayLegs() === 'This dog has 4 legs.'); Tu código debe usar la palabra clave `this` para acceder a la propiedad `numLegs` de `dog`. ```js -assert(code.match(/this\.numLegs/g)); +assert(__helpers.removeJSComments(code).match(/this\.numLegs/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md index 6757c73104a..ca9e9e0bf13 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md @@ -51,7 +51,7 @@ assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1); Debes resolver este desafío sin usar el método `Object.keys()`. ```js -assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); +assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(__helpers.removeJSComments(code))); ``` Debes resolver este desafío sin hacer una programación fija (hardcoding) del arreglo `ownProps`. @@ -59,7 +59,7 @@ Debes resolver este desafío sin hacer una programación fija (hardcoding) del a ```js assert( !/\[\s*(?:'|")(?:name|numLegs)|(?:push|concat)\(\s*(?:'|")(?:name|numLegs)/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md index abb7d4e341f..c6046ed83df 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md @@ -55,7 +55,7 @@ assert(joinDogFraternity(new Dog('')) === true); `joinDogFraternity` debe utilizar la propiedad `constructor`. ```js -assert(/\.constructor/.test(code) && !/instanceof/.test(code)); +assert(/\.constructor/.test(__helpers.removeJSComments(code)) && !/instanceof/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md index 4ba3f4a1e5c..cbddb1e3eba 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md @@ -29,13 +29,13 @@ Reescribe la función `makeNest` y elimina su llamada, por lo que es una expresi La función debe ser anónima. ```js -assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, ''))); +assert(/\((function|\(\))(=>|\(\)){?/.test(__helpers.removeJSComments(code).replace(/\s/g, ''))); ``` Tu función debe tener paréntesis al final de la expresión para llamarle de inmediato. ```js -assert(/\(.*(\)\(|\}\(\))\)/.test(code.replace(/[\s;]/g, ''))); +assert(/\(.*(\)\(|\}\(\))\)/.test(__helpers.removeJSComments(code).replace(/[\s;]/g, ''))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md index 4056fd88a5d..f9afa24a875 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md @@ -42,7 +42,7 @@ Modifica el código para mostrar la cadena de prototipos correcta. El código debe mostrar que `Object.prototype` es el prototipo de `Dog.prototype` ```js -assert(/Object\.prototype\.isPrototypeOf/.test(code)); +assert(/Object\.prototype\.isPrototypeOf/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md index 005391cf26a..b5fd1c31f73 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md @@ -35,7 +35,7 @@ Utiliza `isPrototypeOf` para comprobar el `prototype` de `beagle`. Debes mostrar que `Dog.prototype` es el `prototype` de `beagle` ```js -assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code)); +assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md index 2229cb68ea6..a6cb8bdcc5b 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md @@ -52,7 +52,7 @@ assert(hound instanceof Dog); Tu código debe usar el operador `new` para crear una instancia de `Dog`. ```js -assert(code.match(/new/g)); +assert(__helpers.removeJSComments(code).match(/new/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md index 6de613d51d1..f013f60e1d0 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md @@ -43,7 +43,7 @@ Cambia como `weight` es declarada en la función `Bird` para que sea una variabl La propiedad `weight` debe ser una variable privada y debe asignársele el valor `15`. ```js -assert(code.match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); ``` Tu código debe crear un método llamado `getWeight` en `Bird` que devuelva el valor de la variable privada `weight`. @@ -55,7 +55,7 @@ assert(new Bird().getWeight() === 15); Tu función `getWeight` debe devolver la variable privada `weight`. ```js -assert(code.match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); +assert(__helpers.removeJSComments(code).match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md index 40c90984f97..6e19dbfd14d 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md @@ -29,13 +29,13 @@ Imprime ambas propiedades del objeto `dog` en tu consola. Tu código debe usar `console.log` para imprimir el valor de la propiedad `name` del objeto `dog`. ```js -assert(/console.log\(.*dog\.name.*\)/g.test(code)); +assert(/console.log\(.*dog\.name.*\)/g.test(__helpers.removeJSComments(code))); ``` Tu código debe usar `console.log` para imprimir el valor de la propiedad `numLegs` del objeto `dog`. ```js -assert(/console.log\(.*dog\.numLegs.*\)/g.test(code)); +assert(/console.log\(.*dog\.numLegs.*\)/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md index 28c359022a1..79e5a49fa60 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md @@ -53,7 +53,7 @@ assert(typeof myHouse.numBedrooms === 'number'); Debes verificar que `myHouse` es una instancia de `House` usando el operador `instanceof`. ```js -assert(/myHouse\s*instanceof\s*House/.test(code)); +assert(/myHouse\s*instanceof\s*House/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md index e62fd495ad1..db72b037fcf 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md @@ -75,7 +75,7 @@ assert(!myRegex.test('EleanorRoosevelt')); Debes usar `.test()` para probar la expresión regular. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` Tu resultado debe devolver `true`. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md index 8837298820a..7f9b07cada3 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md @@ -51,7 +51,7 @@ assert(codingRegex.source === 'coding'); Debes utilizar el método `.match()`. ```js -assert(code.match(/\.match\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.match\(.*\)/)); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md index 332dcc0ef8c..18953a9e05c 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md @@ -31,7 +31,7 @@ Completa la expresión regular `unRegex` para que coincida con las cadenas `run` Debes usar el método `.test()`. ```js -assert(code.match(/\.test\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.test\(.*\)/)); ``` Debes usar el carácter de comodín en tu expresión regular `unRegex` diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index e6424b27f5e..1fe4b5a5d77 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -52,7 +52,7 @@ assert(!waldoRegex.test('Somewhere is hiding in this text.')); Debes realizar una coincidencia de cadena literal con tu expresión regular. ```js -assert(!/\/.*\/i/.test(code)); +assert(!/\/.*\/i/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md index 4677a36ebe1..2c010f14c77 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md @@ -27,13 +27,13 @@ assert(result === 'Hello, World!'); Tu solución no debe usar el método `String.prototype.trim()`. ```js -assert(!code.match(/\.?[\s\S]*?trim/)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?trim/)); ``` La variable `result` no debe ser igual a una cadena ```js -assert(!code.match(/result\s*=\s*["'`].*?["'`]/)); +assert(!__helpers.removeJSComments(code).match(/result\s*=\s*["'`].*?["'`]/)); ``` El valor de la variable `hello` no debe modificarse. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md index 837884f3a6d..51a446ea92f 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md @@ -37,7 +37,7 @@ Escribe una expresión regular `fixRegex` utilizando tres grupos de captura que Debes utilizar `.replace()` para buscar y reemplazar. ```js -assert(code.match(/\.replace\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.replace\(.*\)/)); ``` Tu expresión regular debe cambiar la cadena `one two three` a la cadena `three two one` @@ -49,7 +49,7 @@ assert(result === 'three two one'); No debes cambiar la última línea. ```js -assert(code.match(/result\s*=\s*str\.replace\(.*?\)/)); +assert(__helpers.removeJSComments(code).match(/result\s*=\s*str\.replace\(.*?\)/)); ``` `fixRegex` debe usar al menos tres grupos de captura. diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md index fb00ffca4f4..497e8a8d5ba 100644 --- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md +++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md @@ -31,7 +31,7 @@ Aplica la expresión regular `myRegex` en la cadena `myString` usando el método Debes usar `.test()` para probar la expresión regular. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` Tu resultado debe devolver `true`. diff --git a/curriculum/challenges/espanol/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md b/curriculum/challenges/espanol/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md index 2c2b6116c53..408117e8813 100644 --- a/curriculum/challenges/espanol/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md +++ b/curriculum/challenges/espanol/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md @@ -15,12 +15,9 @@ You should have `if number >= 10:` within the `for` loop. ```js ({ - test: () => { - const transformedCode = code.replace(/\r/g, ""); - const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); - const { function_body } = verify_card_number; - - assert.match(function_body, /if +number +>= +10:/); + test: () => + { + assert(runPython(`_Node(_code).find_function("verify_card_number").find_for_loops()[1].find_ifs()[0].find_conditions()[0].is_equivalent("number >= 10")`)); } }) ``` diff --git a/curriculum/challenges/espanol/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md b/curriculum/challenges/espanol/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md index 0b0fad62e36..23872374457 100644 --- a/curriculum/challenges/espanol/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md +++ b/curriculum/challenges/espanol/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md @@ -115,7 +115,10 @@ from importlib import reload reload(probability_calculator) probability_calculator.random.seed(95) -def test_hat_draw(self): + +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw(self): hat = probability_calculator.Hat(red=5,blue=2) actual = hat.draw(2) expected = ['blue', 'red'] @@ -140,6 +143,49 @@ t.result.wasSuccessful() }); ``` +The `draw` method should behave correctly when the number of balls to extract is bigger than the number of balls in the hat. + +```js +({ + test: () => { + pyodide.FS.writeFile("/home/pyodide/probability_calculator.py", code); + pyodide.FS.writeFile( + "/home/pyodide/test_module.py", + ` +import unittest +import probability_calculator +from importlib import reload + +reload(probability_calculator) + +probability_calculator.random.seed(95) +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw_2(self): + hat = probability_calculator.Hat(yellow=5,red=1,green=3,blue=9,test=1) + actual = hat.draw(20) + expected = ['yellow', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'green', 'green', 'green', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'test'] + self.assertEqual(actual, expected, 'Expected hat draw to return all items from hat contents.') + actual = len(hat.contents) + expected = 0 + self.assertEqual(actual, expected, 'Expected hat draw to leave no items in contents.') + ` + ); + const testCode = ` +from unittest import main +import test_module +from importlib import reload + +reload(test_module) +t = main(module='test_module', exit=False) +t.result.wasSuccessful() +`; + const out = __pyodide.runPython(testCode); + assert(out); + }, +}); +``` + The `experiment` method should return a different probability. @@ -221,7 +267,8 @@ class Hat: def draw(self, number): drawn = [] if number >= len(self.contents): - return self.contents + drawn.extend(self.contents) + self.contents = [] else: for i in range(number): drawn.append( @@ -229,8 +276,7 @@ class Hat: ) return drawn -def experiment(hat, expected_balls, num_balls_drawn, num_experiments): - +def experiment(hat, expected_balls, num_balls_drawn, num_experiments): expected_balls_list = [] drawn_list = [] success = 0 @@ -248,12 +294,7 @@ def experiment(hat, expected_balls, num_balls_drawn, num_experiments): except: continue if len(exp_ball_list_copy) == 0: - success += 1 - - - - - probability = success/num_experiments - + success += 1 + probability = success/num_experiments return probability ``` diff --git a/curriculum/challenges/espanol/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md b/curriculum/challenges/espanol/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md index bbf2528bafa..ea0ce0ed1c7 100644 --- a/curriculum/challenges/espanol/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md +++ b/curriculum/challenges/espanol/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md @@ -48,9 +48,9 @@ La declaración inicial de `homeworkStack` no debe ser cambiada. ```js assert( - code.match(/=/g).length === 1 && + __helpers.removeJSComments(code).match(/=/g).length === 1 && /homeworkStack\s*=\s*\["BIO12"\s*,\s*"HIS80"\s*,\s*"MAT122"\s*,\s*"PSY44"\]/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/espanol/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md b/curriculum/challenges/espanol/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md index 873cdddaaaf..711432b3d85 100644 --- a/curriculum/challenges/espanol/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md +++ b/curriculum/challenges/espanol/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md @@ -2,7 +2,6 @@ id: 5f356ed60a5decd94ab66986 title: Paso 22 challengeType: 0 -removeComments: false dashedName: step-22 --- diff --git a/curriculum/challenges/espanol/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md b/curriculum/challenges/espanol/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md index 15001915e6f..3a211472575 100644 --- a/curriculum/challenges/espanol/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md +++ b/curriculum/challenges/espanol/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md @@ -40,15 +40,15 @@ assert(canvasFilter === 'blur(2px)'); ## --seed-contents-- ```css +--fcc-editable-region-- .canvas { width: 500px; height: 600px; background-color: #4d0f00; overflow: hidden; ---fcc-editable-region-- ---fcc-editable-region-- } +--fcc-editable-region-- .frame { border: 50px solid black; diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md index 43e03cf21ac..c6c7627d04f 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md @@ -7,7 +7,7 @@ dashedName: step-55 # --description-- -Inside, the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. +Inside the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. Now, you should see a category displayed underneath each post topic. diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md index eca279b42fe..b69803b87d0 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md @@ -7,9 +7,11 @@ dashedName: step-43 # --description-- -Notice how the `10` value is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. +Notice how the number `10` is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the numbers values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. -To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. Leave the function empty for now. +To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. The parameters of `a` and `b` represent the number values in the array that will be sorted. + +Leave the function empty for now. # --hints-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md index d253c95b6c6..ee57c994e55 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md @@ -26,7 +26,7 @@ assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\( Your callback function should return `a - b`. ```js -assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+a\s*-\s*b\s*;?\s*}\s*\)/); +assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+(?:parseInt)?(?:Number)?\(?a\)?\s*-\s*(?:parseInt)?(?:Number)?\(?b\)?\s*;?\s*}\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b514741ae01..b1b54dda895 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -11,6 +11,8 @@ In your `evalFormula`, declare an `idToText` arrow function which takes an `id` Your `idToText` function should return the result of calling `.find()` on the `cells` array with a callback function that takes an `cell` parameter and returns `cell.id === id`. +Both of your functions should use implicit returns. + # --hints-- You should declare an `idToText` variable in your `evalFormula` function. diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md index 57110b715a9..37487b1771c 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md @@ -23,13 +23,7 @@ Open up the console to see the result. # --hints-- -You should call `.repeat()` on your two `" "` strings. - -```js -assert.lengthOf(code.match(/" ".repeat/g), 2); -``` - -Your `" "` strings should be repeated `rowCount - rowNumber` times. +You should call `.repeat()` on your `" "` strings to repeat them `rowCount - rowNumber` times. ```js assert.equal(padRow(1, 3), " # "); diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md index 3306b1a478b..4170d3bd12b 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md @@ -3,7 +3,6 @@ id: 660f3ce51f70571e1c5227c8 title: Step 69 challengeType: 1 dashedName: step-69 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md index ea0a831040f..7a939244a7c 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md @@ -3,7 +3,6 @@ id: 660f3dd626be3a1ffe27e5d1 title: Step 70 challengeType: 1 dashedName: step-70 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md index e30d808ccb6..b676558ec74 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md @@ -3,7 +3,6 @@ id: 660f4f79e2a82a4e92290f44 title: Step 101 challengeType: 1 dashedName: step-101 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md index dc683e61ce5..3f088de2c91 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md @@ -3,7 +3,6 @@ id: 660f53ad3d39175c5d4335ac title: Step 108 challengeType: 1 dashedName: step-108 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md new file mode 100644 index 00000000000..286128cc2cf --- /dev/null +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md @@ -0,0 +1,74 @@ +--- +id: 662693f82c91a66be46c881b +title: Step 1 +challengeType: 1 +dashedName: step-1 +--- + +# --description-- + +A teacher has finished grading their students' tests and needs your help to calculate the average score for the class. + +Complete the `getAverage` function which takes in an array of test scores and returns the average score. + +The average is calculated by adding up all the scores and dividing by the total number of scores. + +```js +average = sum of all scores / total number of scores +``` + +A couple of function calls have been provided for you so you can test out your code. + +**Tips** + +- You can use a loop to iterate over the `scores` array and add up all the scores. +- You can use the `length` property to get the total number of scores. + +# --hints-- + +Your `getAverage` function should return a number. + +```js +assert.strictEqual(typeof getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 'number'); +``` + +`getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])` should return `71.7`. + +```js +assert.strictEqual(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 71.7); +``` + +`getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])` should return `85.4`. + +```js +assert.strictEqual(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]), 85.4); +``` + +`getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100])` should return `92.4`. + +```js +assert.strictEqual(getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100]), 92.4); +``` + +Your `getAverage` function should return the average score of the test scores. + +```js +assert.strictEqual(getAverage([52, 56, 60, 65, 70, 75, 80, 85, 90, 95]), 72.8); +assert.strictEqual(getAverage([45, 50, 55, 60, 65, 70, 75, 80, 85, 90]), 67.5); +assert.strictEqual(getAverage([38, 42, 46, 50, 54, 58, 62, 66, 70, 74]), 56); +``` + +# --seed-- + +## --seed-contents-- + +```js +--fcc-editable-region-- +function getAverage(scores) { + +} + +console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])); +console.log(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md new file mode 100644 index 00000000000..f7e9253a5a5 --- /dev/null +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md @@ -0,0 +1,104 @@ +--- +id: 6626a060c4006f793e10cb33 +title: Step 2 +challengeType: 1 +dashedName: step-2 +--- + +# --description-- + +Now the teacher needs your help converting the student score to a letter grade. + +Complete the `getGrade` function that takes a number `score` as a parameter. Your function should return a string representing a letter grade based on the score. + +Here are the scores and their corresponding letter grades: + +| Score Range | Grade | +| ----------- | ------- | +| `100` | `"A++"` | +| `90 - 99` | `"A"` | +| `80 - 89` | `"B"` | +| `70 - 79` | `"C"` | +| `60 - 69` | `"D"` | +| `0 - 59` | `"F"` | + + +**Tips** + +- Remember that you learned about conditional statements(`if`, `else if`, and `else`). +- Remember that you learned about comparison operators (`>`, `<`, `>=`, `<=`, `===`). + +# --hints-- + +Your `getGrade` function should return `"A++"` if the score is `100`. + +```js +assert.strictEqual(getGrade(100), "A++"); +``` + +Your `getGrade` function should return `"A"` if the score is `94`. + +```js +assert.strictEqual(getGrade(94), "A"); +``` + +Your `getGrade` function should return `"B"` if the score is between `80` and `89`. + +```js +assert.strictEqual(getGrade(80), "B"); +assert.strictEqual(getGrade(83), "B"); +assert.strictEqual(getGrade(88), "B"); +``` + +Your `getGrade` function should return `"C"` if the score is `78`. + +```js +assert.strictEqual(getGrade(75), "C"); +``` + +Your `getGrade` function should return `"D"` if the score is between `60` and `69`. + +```js +assert.strictEqual(getGrade(60), "D"); +assert.strictEqual(getGrade(63), "D"); +assert.strictEqual(getGrade(68), "D"); +``` + +Your `getGrade` function should return `"F"` if the score is `57`. + +```js +assert.strictEqual(getGrade(57), "F"); +``` + +Your `getGrade` function should return `"F"` if the score is between `0` and `59`. + +```js +assert.strictEqual(getGrade(0), "F"); +assert.strictEqual(getGrade(30), "F"); +assert.strictEqual(getGrade(43), "F"); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} +--fcc-editable-region-- +function getGrade(score) { + +} + +console.log(getGrade(96)); +console.log(getGrade(82)); +console.log(getGrade(56)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md new file mode 100644 index 00000000000..b168e1325fc --- /dev/null +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md @@ -0,0 +1,88 @@ +--- +id: 6626b4c58c027d86478ff5eb +title: Step 3 +challengeType: 1 +dashedName: step-3 +--- + +# --description-- + +The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an `"F"`. + +Complete the function `hasPassingGrade` that takes a student score as a parameter. Your function should return `true` if the student has a passing grade and `false` if they do not. + +**Tips** + +- Use the `getGrade` function to get the student's grade. Then check if the grade is passing or not. + +# --hints-- + +Your `hasPassingGrade` function should return a boolean value. + +```js +assert.strictEqual(typeof hasPassingGrade(100), "boolean"); +``` + +Your `hasPassingGrade` function should return `true` if the grade is an `"A"`. + +```js +assert.isTrue(hasPassingGrade(100)); +``` + +Your `hasPassingGrade` function should return `false` if the grade is an `"F"`. + +```js +assert.isFalse(hasPassingGrade(53)); +``` + +Your `hasPassingGrade` function should return `true` for all passing grades. + +```js +assert.isTrue(hasPassingGrade(87)); +assert.isTrue(hasPassingGrade(60)); +assert.isTrue(hasPassingGrade(73)); +assert.isTrue(hasPassingGrade(96)); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +--fcc-editable-region-- +function hasPassingGrade(score) { + +} + + +console.log(hasPassingGrade(100)); +console.log(hasPassingGrade(53)); +console.log(hasPassingGrade(87)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md new file mode 100644 index 00000000000..08ee3cea27b --- /dev/null +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md @@ -0,0 +1,143 @@ +--- +id: 6626b8dcf5057f896f948440 +title: Step 4 +challengeType: 1 +dashedName: step-4 +--- + +# --description-- + +Now that the teacher has all of the information they need, they want to be able to message the student with the results. + +Complete the `studentMsg` function with `totalScores` and `studentScore` for parameters. The function should return a string representing a message to the student. + +If the student passed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You passed the course. +``` + +If the student failed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You failed the course. +``` + +Replace `average-goes-here` with the average of the total scores. Replace `grade-goes-here` with the student's grade. + +**Tips** + +- Use the `getAverage` function to get the class average. +- Use the `getGrade` function to get the student's grade. +- Use string concatenation (`+`) to build the message. +- Be careful with the punctuation and spaces in the message. + +# --hints-- + +Your function call of `studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)` should return the following message: `"Class average: 71.7. Your grade: F. You failed the course."`. + +```js +assert.strictEqual(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37), "Class average: 71.7. Your grade: F. You failed the course."); +``` + +Your function call of `studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)` should return the following message: `"Class average: 50.8. Your grade: A++. You passed the course."`. + +```js +assert.strictEqual(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100), "Class average: 50.8. Your grade: A++. You passed the course."); +``` + +Your `studentMsg` function should return a the correct message based on the student's score and the class average. + +```js +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 92), "Class average: 70.25. Your grade: A. You passed the course."); +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 57), "Class average: 70.25. Your grade: F. You failed the course."); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +--fcc-editable-region-- +function studentMsg(totalScores, studentScore) { + +} +console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)); +--fcc-editable-region-- + +``` + + +# --solutions-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +function studentMsg(totalScores, studentScore) { + let average = getAverage(totalScores); + let grade = getGrade(studentScore); + + return `Class average: ${average}. Your grade: ${grade}. You ${ + hasPassingGrade(studentScore) ? "passed" : "failed" + } the course.`; +} + +``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md index 143a21293d3..6946863ad03 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md @@ -87,7 +87,7 @@ assert(confirmEnding('Abstraction', 'action') === true); Dein Code sollte diese Aufgabe ohne die integrierte Methode `.endsWith()` lösen. ```js -assert(!/\.endsWith\(.*?\)\s*?;?/.test(code) && !/\['endsWith'\]/.test(code)); +assert(!/\.endsWith\(.*?\)\s*?;?/.test(__helpers.removeJSComments(code)) && !/\['endsWith'\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md index 7cb2d6059fb..19b2f875605 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md @@ -51,7 +51,7 @@ assert(repeatStringNumTimes('abc', -2) === ''); Die built-in Methode `repeat()` sollte hier nicht verwendet werden. ```js -assert(!/\.repeat/g.test(code)); +assert(!/\.repeat/g.test(__helpers.removeJSComments(code))); ``` `repeatStringNumTimes("abc", 0)` sollte `""` zurückgeben. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md index 634fcbdb5cb..faf80792278 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md @@ -53,19 +53,19 @@ assert.deepEqual( Die Funktion `htmlColorNames` sollte die Methode `splice()` verwenden. ```js -assert(/.splice/.test(code)); +assert(/.splice/.test(__helpers.removeJSComments(code))); ``` Du solltest nicht`shift()` oder `unshift()` verwenden. ```js -assert(!/shift|unshift/.test(code)); +assert(!/shift|unshift/.test(__helpers.removeJSComments(code))); ``` Du solltest keine Array-Klammernotation verwenden. ```js -assert(!/\[\d\]\s*=/.test(code)); +assert(!/\[\d\]\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md index 4df2fe64c78..3706b89b250 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md @@ -85,8 +85,8 @@ The definition of the `foods` object should not be changed. ```js assert( - code.search(/let foods/) === -1 && - code.search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ + __helpers.removeJSComments(code).search(/let foods/) === -1 && + __helpers.removeJSComments(code).search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ ) !== -1 ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md index 071ded997bd..a64fb1613cd 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md @@ -27,7 +27,7 @@ Das Objekt `users` sollte nicht direkt aufgerufen werden ```js -assert(code.match(/users/gm).length <= 2) +assert(__helpers.removeJSComments(code).match(/users/gm).length <= 2) ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index b4cf811dd51..6141258c7f6 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ Die Funktion `copyMachine` sollte den `spread operator` mit einem Array `arr` verwenden ```js -assert(code.match(/\.\.\.\s*arr/)); +assert(__helpers.removeJSComments(__helpers.removeJSComments(code)).match(/\.\.\.\s*arr/)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md index aad146b3638..86045e353ce 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md @@ -38,7 +38,7 @@ assert.deepEqual( Die Funktion `forecast` sollte die `slice()` Methode verwenden ```js -assert(/\.slice\(/.test(code)); +assert(/\.slice\(/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index 7c47b55d10c..de7a72e023c 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -51,7 +51,7 @@ Die Funktion `countOnline` sollte eine `for in` Anweisung verwenden, um die Obje ```js assert( - code.match( + __helpers.removeJSComments(code).match( /for\s*\(\s*(var|let|const)\s+[a-zA-Z_$]\w*\s+in\s+[a-zA-Z_$]\w*\s*\)/ ) ); diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md index df804075520..c5f0bd78f79 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md @@ -61,7 +61,7 @@ assert(userActivity.data.online === 45); Die `online` Eigenschaft sollte mit Punkt- oder Klammernotation gesetzt werden. ```js -assert.strictEqual(code.search(/online: 45/), -1); +assert.strictEqual(__helpers.removeJSComments(code).search(/online: 45/), -1); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md index 851850a4c32..0d34b8fdfcd 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md @@ -40,7 +40,7 @@ Du sollst nicht die ursprüngliche Codezeile `const arr = [2, 4, 5, 1, 7, 5, 2, ```js assert( - __helpers.removeWhiteSpace(code).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) ); ``` @@ -56,14 +56,14 @@ assert.strictEqual( Ihr Code sollte die Methode `splice()` auf `arr` anwenden. ```js -assert(__helpers.removeWhiteSpace(code).match(/arr\.splice\(/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(/)); ``` Splice soll nur Elemente aus `arr` entfernen, aber keine zusätzlichen Elemente zu `arr` hinzufügen. ```js assert( - !__helpers.removeWhiteSpace(code).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) + !__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md index 325ba37203d..3fa4915c623 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md @@ -39,9 +39,9 @@ Die Werte `oranges`, `plums` und `strawberries` sollen mittels `delete` entfernt ```js assert( - code.search(/oranges:/) !== -1 && - code.search(/plums:/) !== -1 && - code.search(/strawberries:/) !== -1 + __helpers.removeJSComments(code).search(/oranges:/) !== -1 && + __helpers.removeJSComments(code).search(/plums:/) !== -1 && + __helpers.removeJSComments(code).search(/strawberries:/) !== -1 ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md index d70fa72440d..30a601b07ac 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md @@ -54,7 +54,7 @@ Die Daten in der Variable `myArray` sollten mit Hilfe von Klammernotation abgeru ```js assert( (function () { - if (code.match(/\s*=\s*myArray\[0\]/g)) { + if (__helpers.removeJSComments(code).match(/\s*=\s*myArray\[0\]/g)) { return true; } else { return false; diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md index 7b7d3c0585f..df72c416360 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md @@ -45,7 +45,7 @@ assert(myData === 8); Du solltest die Klammernotation verwenden, um den richtigen Wert aus `myArray` zu lesen. ```js -assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code))); +assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md index 3ccf8a6fcf4..5552c85d7ac 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md @@ -54,7 +54,7 @@ assert(secondTree === 'pine'); Dein Code sollte die Punkt- und Klammerschreibweise verwenden, um auf `myPlants` zuzugreifen. ```js -assert(/=\s*myPlants\[1\].list\[1\]/.test(code)); +assert(/=\s*myPlants\[1\].list\[1\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md index d0c8e5e8666..1f933bdbcb9 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md @@ -64,7 +64,7 @@ assert(drinkValue === 'water'); Du solltest die Klammerschreibweise zweimal verwenden ```js -assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md index 4d01c5159f6..80131787e55 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md @@ -60,7 +60,7 @@ assert(shirtValue === 'jersey'); Du solltest die Punktschreibweise zweimal verwenden ```js -assert(code.match(/testObj\.\w+/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\.\w+/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md index e0fe93f071a..cd7a2aad60b 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md @@ -56,19 +56,19 @@ assert(player === 'Montana'); Du solltest die Klammerschreibweise verwenden, um auf `testObj` zuzugreifen ```js -assert(/testObj\s*?\[.*?\]/.test(code)); +assert(/testObj\s*?\[.*?\]/.test(__helpers.removeJSComments(code))); ``` Du solltest den Wert `Montana` nicht direkt der Variable `player` zuweisen. ```js -assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); +assert(!__helpers.removeJSComments(code).match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); ``` Du solltest die Variable `playerNumber` in deiner Klammerschreibweise verwenden ```js -assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code)); +assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md index aec634d4706..cd406a9ab23 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md @@ -53,7 +53,7 @@ assert(myDog.bark !== undefined); Du solltest `bark` nicht zur Initialisierung von `myDog` hinzufügen. ```js -assert(!/bark[^\n]:/.test(code)); +assert(!/bark[^\n]:/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md index 00e522fec52..c7c86fe0ae3 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md @@ -38,7 +38,7 @@ assert(sum === 20); Du solltest den Operator `+` verwenden. ```js -assert(/\+/.test(code)); +assert(/\+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md index 55b0196cfa2..82d00b06c18 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md @@ -71,7 +71,7 @@ assert(switchOfStuff(4) === 'stuff'); Du solltest keine `if` oder `else`-Anweisungen verwenden ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Du solltest eine `default`-Anweisung verwenden @@ -83,7 +83,7 @@ assert(switchOfStuff('string-to-trigger-default-case') === 'stuff'); Du solltest mindestens 3 `break`-Anweisungen verwenden ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md index 9f202367b61..1ed06d65124 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md @@ -36,7 +36,7 @@ assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2); Du solltest `someAdjective` an `myStr` mit dem Operator `+=` anhängen. ```js -assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md index 6a7e8bfe3b3..9dd7dc2d894 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md @@ -29,7 +29,7 @@ Weise der Variablen `b` den Inhalt von `a` zu. Du solltest den Code oberhalb des vorgegebenen Kommentars nicht ändern. ```js -assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code))); ``` `b` sollte einen Wert von `7` besitzen. @@ -41,7 +41,7 @@ assert(typeof b === 'number' && b === 7); `a` sollte `b` mit `=` zugewiesen werden. ```js -assert(/b\s*=\s*a\s*/g.test(code)); +assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md index e16009db4a8..6e6bff980c1 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md @@ -34,7 +34,7 @@ assert(processed === 2); Du solltest `processArg` zu `processed` zuweisen ```js -assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code)); +assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md index 98129a5802e..de501278361 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md @@ -39,19 +39,19 @@ zurück `num < 15` - gibt `Medium` zurück Du solltest mindestens vier `else`-Anweisungen verwenden ```js -assert(code.match(/else/g).length > 3); +assert(__helpers.removeJSComments(code).match(/else/g).length > 3); ``` Du solltest mindestens vier `if`-Anweisungen verwenden ```js -assert(code.match(/if/g).length > 3); +assert(__helpers.removeJSComments(code).match(/if/g).length > 3); ``` Du solltest mindestens eine `return`-Anweisung verwenden ```js -assert(code.match(/return/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/return/g).length >= 1); ``` `testSize(0)` sollte den String `Tiny` zurückgeben diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index bae19cd552d..dd96e12357e 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -2,7 +2,6 @@ id: bd7123c9c441eddfaeb4bdef title: Kommentiere deinen JavaScript-Code challengeType: 1 -removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' forumTopicId: 16783 dashedName: comment-your-javascript-code diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index de3d112e411..cfffe3a174e 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -58,7 +58,7 @@ assert(testEqual('12') === 'Equal'); Du solltest den Operator `==` verwenden ```js -assert(code.match(/==/g) && !code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/==/g) && !__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index 5152fcf30e8..47c2d6316ac 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -73,7 +73,7 @@ assert(testGreaterThan(150) === 'Over 100'); Du solltest den Operator `>` mindestens zweimal verwenden ```js -assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index 03224dd32c8..06adf6149d7 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -73,7 +73,7 @@ assert(testGreaterOrEqual(21) === '20 or Over'); Du solltest den `>=` Operator mindestens zweimal verwenden ```js -assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index 82416ab088f..501b872cf9b 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -60,7 +60,7 @@ assert(testNotEqual('bob') === 'Not Equal'); Du solltest den `!=` Operator verwenden ```js -assert(code.match(/(?!!==)!=/)); +assert(__helpers.removeJSComments(code).match(/(?!!==)!=/)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index 7e0c7380c42..ac4d11b1ca5 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -66,7 +66,7 @@ assert(testLessThan(99) === '55 or Over'); Du solltest den `<` Operator mindestens zweimal verwenden ```js -assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index 2c94279e454..2b6f5184067 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -72,7 +72,7 @@ assert(testLessOrEqual(55) === 'More Than 24'); Du solltest den `<=` Operator mindestens zweimal verwenden ```js -assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index c0c85bd65e3..0bf8019715a 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -49,7 +49,7 @@ assert(testStrict('7') === 'Not Equal'); Du solltest den `===` Operator verwenden ```js -assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index 534e99e6806..1079b6d7aea 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -52,7 +52,7 @@ assert(testStrictNotEqual('bob') === 'Not Equal'); Du solltest den Operator `!==` verwenden ```js -assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md index 371e2b4f74b..7122d7fe9fc 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md @@ -40,13 +40,13 @@ Ersetze die beiden if-Anweisungen durch eine Anweisung mit dem `&&`-Operator, di Du solltest den `&&`-Operator einmal verwenden ```js -assert(code.match(/&&/g).length === 1); +assert(__helpers.removeJSComments(code).match(/&&/g).length === 1); ``` Du solltest nur eine `if`-Anweisung verwenden ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalAnd(0)` sollte den String `No` zurückgeben diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md index 64337587787..f32f374e337 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md @@ -43,13 +43,13 @@ Kombiniere die beiden `if`-Anweisungen zu einer Anweisung, die den String `Outsi Du solltest den Operator `||` einmal verwenden ```js -assert(code.match(/\|\|/g).length === 1); +assert(__helpers.removeJSComments(code).match(/\|\|/g).length === 1); ``` Du solltest nur eine `if`-Anweisung verwenden ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalOr(0)` sollte den String `Outside` zurückgeben diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md index 98560d205c5..d2b1242a8e7 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md @@ -54,16 +54,16 @@ assert(c === 19); Du solltest den Operator `+=` für jede Variable verwenden. ```js -assert(code.match(/\+=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\+=/g).length === 3); ``` Du solltest den Code oberhalb des vorgegebenen Kommentars nicht verändern. ```js assert( - /let a = 3;/.test(code) && - /let b = 17;/.test(code) && - /let c = 12;/.test(code) + /let a = 3;/.test(__helpers.removeJSComments(code)) && + /let b = 17;/.test(__helpers.removeJSComments(code)) && + /let c = 12;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md index c2acee82a4e..def014e9163 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md @@ -48,16 +48,16 @@ assert(c === 3); Du solltest für jede Variable den Operator `/=` verwenden. ```js -assert(code.match(/\/=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\/=/g).length === 3); ``` Du solltest den Code oberhalb des vorgegebenen Kommentars nicht verändern. ```js assert( - /let a = 48;/.test(code) && - /let b = 108;/.test(code) && - /let c = 33;/.test(code) + /let a = 48;/.test(__helpers.removeJSComments(code)) && + /let b = 108;/.test(__helpers.removeJSComments(code)) && + /let c = 33;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md index a63816942f4..1fe7c1551da 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md @@ -48,16 +48,16 @@ assert(c === 46); Du solltest den Operator `*=` für jede Variable verwenden. ```js -assert(code.match(/\*=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\*=/g).length === 3); ``` Du solltest den Code oberhalb des vorgegebenen Kommentars nicht verändern. ```js assert( - /let a = 5;/.test(code) && - /let b = 12;/.test(code) && - /let c = 4\.6;/.test(code) + /let a = 5;/.test(__helpers.removeJSComments(code)) && + /let b = 12;/.test(__helpers.removeJSComments(code)) && + /let c = 4\.6;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md index fa833d88dd3..3c44c0398ce 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md @@ -48,14 +48,14 @@ assert(c === 2); Du solltest den Operator `-=` für jede Variable verwenden. ```js -assert(code.match(/-=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/-=/g).length === 3); ``` Du solltest den Code oberhalb des vorgegebenen Kommentars nicht verändern. ```js assert( - /let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code) + /let a = 11;/.test(__helpers.removeJSComments(code)) && /let b = 9;/.test(__helpers.removeJSComments(code)) && /let c = 3;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md index 5c71bb2d973..1b5b238cd4f 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md @@ -47,19 +47,19 @@ assert(myStr === 'This is the start. This is the end.'); Du solltest den Operator `+` zur Kreierung von `myStr` verwenden. ```js -assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g)); +assert(__helpers.removeJSComments(code).match(/(["']).*\1\s*\+\s*(["']).*\2/g)); ``` `myStr` sollte mit dem Schlüsselwort `const` erstellt werden. ```js -assert(/const\s+myStr/.test(code)); +assert(/const\s+myStr/.test(__helpers.removeJSComments(code))); ``` Das Ergebnis solltest du der Variable `myStr` zuweisen. ```js -assert(/myStr\s*=/.test(code)); +assert(/myStr\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index 28a8070607a..76a43d3f269 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -43,7 +43,7 @@ assert(myStr === 'This is the first sentence. This is the second sentence.'); Du solltest den Operator `+=` zur Kreierung von `myStr` verwenden. ```js -assert(code.match(/myStr\s*\+=\s*(["']).*\1/g)); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*(["']).*\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md index de29040a340..5d5b6b5ed62 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md @@ -35,7 +35,7 @@ assert(typeof myName !== 'undefined' && myName.length > 2); Du solltest zwei Operatoren `+` verwenden, um `myStr` mit `myName` darin zu bilden. ```js -assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); +assert(__helpers.removeJSComments(code).match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md index bef2e5af253..f35e6428a0a 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md @@ -34,13 +34,13 @@ Füge die ungeraden Zahlen von 9 bis 1 in `myArray` ein und verwende dazu eine ` Du solltest dafür eine `for`-Schleife verwenden. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` Du solltest die Array-Methode `push` verwenden. ```js -assert(code.match(/myArray.push/)); +assert(__helpers.removeJSComments(code).match(/myArray.push/)); ``` `myArray` sollte gleich `[9, 7, 5, 3, 1]` sein. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md index 42177c32c9f..89edd7b3b41 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md @@ -37,7 +37,7 @@ Schaue dir das `ourName`-Beispiel oben an, wenn du nicht weiterkommst. Du solltest `myName` mit dem Schlüsselwort `var` deklarieren und mit einem Semikolon abschließen ```js -assert(/var\s+myName\s*;/.test(code)); +assert(/var\s+myName\s*;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md index df144dbe521..ab0e9d37089 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md @@ -38,25 +38,25 @@ assert(myVar === 10); `myVar = myVar - 1;` sollte geändert werden. ```js -assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); ``` Du solltest `myVar` keine `10` zuordnen. ```js -assert(!code.match(/myVar\s*=\s*10.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*10.*?;?/)); ``` Du solltest den `--` Operator auf `myVar` anwenden. ```js -assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code)); +assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(__helpers.removeJSComments(code))); ``` Du solltest den Code oberhalb des vorgegebenen Kommentars nicht ändern. ```js -assert(/let myVar = 11;/.test(code)); +assert(/let myVar = 11;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md index 1e1cb464540..274b2e3332e 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md @@ -55,7 +55,7 @@ assert(typeof myDog === 'object' && myDog.tails === undefined); Du solltest die Einstellungen von `myDog` nicht verändern. ```js -assert(code.match(/"tails": 1/g).length > 0); +assert(__helpers.removeJSComments(code).match(/"tails": 1/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md index 52576b96279..f57cd3811ce 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md @@ -26,13 +26,13 @@ assert(quotient === 2.2); Verwende den Operator `/`, um 4,4 durch 2 zu teilen. ```js -assert(/4\.40*\s*\/\s*2\.*0*/.test(code)); +assert(/4\.40*\s*\/\s*2\.*0*/.test(__helpers.removeJSComments(code))); ``` Die Quotientenvariable sollte nur einmal zugewiesen werden ```js -assert(code.match(/quotient\s*=/g).length === 1); +assert(__helpers.removeJSComments(code).match(/quotient\s*=/g).length === 1); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md index ea9e0313ff3..9a0dcbdf559 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md @@ -35,7 +35,7 @@ assert(quotient === 2); Du solltest den Operator `/` verwenden. ```js -assert(/\d+\s*\/\s*\d+/.test(code)); +assert(/\d+\s*\/\s*\d+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md index 484fb56706b..72040ba5c28 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md @@ -36,7 +36,7 @@ I am a "double quoted" string inside "double quotes". Du solltest zwei doppelte Anführungszeichen (`"`) und vier versteckte doppelte Anführungszeichen (`\"`) verwenden. ```js -assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2); +assert(__helpers.removeJSComments(code).match(/\\"/g).length === 4 && __helpers.removeJSComments(code).match(/[^\\]"/g).length === 2); ``` Die Variable `myStr` sollte den folgenden String enthalten: `I am a "double quoted" string inside "double quotes".` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md index 8f3113a1387..8a1d04f5404 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md @@ -29,8 +29,8 @@ Du solltest die Variablendeklarationen im Abschnitt `// Setup` nicht ändern. ```js assert( - code.match(/let lastNameLength = 0;/) && - code.match(/const lastName = "Lovelace";/) + __helpers.removeJSComments(code).match(/let lastNameLength = 0;/) && + __helpers.removeJSComments(code).match(/const lastName = "Lovelace";/) ); ``` @@ -43,7 +43,7 @@ assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8); Du solltest die Länge von `lastName` erhalten, indem du `.length` wie folgt benutzt: `lastName.length`. ```js -assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/)); +assert(__helpers.removeJSComments(code).match(/=\s*lastName\.length/g) && !__helpers.removeJSComments(code).match(/lastName\s*=\s*8/)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md index 162a025d98e..2662ed6635b 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md @@ -39,7 +39,7 @@ Setze `remainder` gleich dem Rest von `11` geteilt durch `3` mit dem Rest= 0); +assert(__helpers.removeJSComments(code).match(/Math\.random/g).length >= 0); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md index 1cd86b2c681..b9d883af57a 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md @@ -46,22 +46,22 @@ assert( Du solltest `Math.random` verwenden, um eine Zufallszahl zu erzeugen. ```js -assert(code.match(/Math.random/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.random/g).length >= 1); ``` Du solltest das Ergebnis von `Math.random` mit 10 multiplizieren, damit es eine Zahl im Bereich von null bis neun ergibt. ```js assert( - code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || - code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) + __helpers.removeJSComments(code).match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || + __helpers.removeJSComments(code).match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) ); ``` Du solltest `Math.floor` verwenden, um den Dezimalteil der Zahl zu entfernen. ```js -assert(code.match(/Math.floor/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.floor/g).length >= 1); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md index a0a5597f115..17f520b50f4 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md @@ -49,10 +49,10 @@ assert(randomRange(0, 1) % 1 === 0); assert( (function () { if ( - code.match(/myMax/g).length > 1 && - code.match(/myMin/g).length > 2 && - code.match(/Math.floor/g) && - code.match(/Math.random/g) + __helpers.removeJSComments(code).match(/myMax/g).length > 1 && + __helpers.removeJSComments(code).match(/myMin/g).length > 2 && + __helpers.removeJSComments(code).match(/Math.floor/g) && + __helpers.removeJSComments(code).match(/Math.random/g) ) { return true; } else { diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md index ae105fa0ed2..fdb3faa2f44 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md @@ -36,7 +36,7 @@ assert(myGlobal === 10); `myGlobal` sollte mit dem Schlüsselwort `let` oder `const` deklariert werden ```js -assert(/(let|const)\s+myGlobal/.test(code)); +assert(/(let|const)\s+myGlobal/.test(__helpers.removeJSComments(code))); ``` `oopsGlobal` sollte eine globale Variable sein und einen Wert von `5` haben diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md index 131d7571cee..cbaa67bcee5 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md @@ -45,7 +45,7 @@ assert(myOutfit() === 'sweater'); Du solltest die Rückgabeanweisung nicht ändern. ```js -assert(/return outerWear/.test(code)); +assert(/return outerWear/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md index 8ec746552bc..fcec160ca07 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md @@ -39,20 +39,20 @@ Du solltest den Zuweisungsoperator nicht verwenden. ```js assert( - /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(code) + /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(__helpers.removeJSComments(code)) ); ``` Du solltest den `++` Operator verwenden. ```js -assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code)); +assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(__helpers.removeJSComments(code))); ``` Du solltest den Code oberhalb des vorgegebenen Kommentars nicht ändern. ```js -assert(/let myVar = 87;/.test(code)); +assert(/let myVar = 87;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md index 5d67748eded..d04a8ef87a4 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md @@ -26,7 +26,7 @@ Definiere eine Variable `a` mit `var` und initialisiere sie mit einem Wert von ` Du solltest `a` mit einem Wert von `9` initialisieren. ```js -assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code)); +assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md index 0107e47745f..90611d893cc 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md @@ -30,20 +30,20 @@ if (num > 15) { Du solltest mindestens zwei `else`-Anweisungen verwenden ```js -assert(code.match(/else/g).length > 1); +assert(__helpers.removeJSComments(code).match(/else/g).length > 1); ``` Du solltest mindestens zwei `if`-Anweisungen verwenden ```js -assert(code.match(/if/g).length > 1); +assert(__helpers.removeJSComments(code).match(/if/g).length > 1); ``` Du solltest für jeden `if else`-Codeblock öffnende und schließende geschweifte Klammern verwenden. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/ ) ); diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md index 320941c4697..f27327ba534 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md @@ -28,13 +28,13 @@ Kombiniere die `if`-Anweisungen zu einer einzigen `if/else`-Anweisung. Du solltest nur eine `if`-Anweisung im Editor verwenden ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` Du solltest eine `else`-Anweisung verwenden ```js -assert(/else/g.test(code)); +assert(/else/g.test(__helpers.removeJSComments(code))); ``` `testElse(4)` sollte den String `5 or Smaller` zurückgeben @@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5'); Du solltest den Code nicht oberhalb oder unterhalb der angegebenen Kommentare ändern. ```js -assert(/let result = "";/.test(code) && /return result;/.test(code)); +assert(/let result = "";/.test(__helpers.removeJSComments(code)) && /return result;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md index 1f463aac9de..d5455c10455 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md @@ -32,7 +32,7 @@ Füge die ungeraden Zahlen von 1 bis 9 in `myArray` ein und verwende dazu eine ` Du solltest dafür eine `for`-Schleife verwenden. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` sollte gleich `[1, 3, 5, 7, 9]` sein. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md index 3f03a743d3a..007d462b799 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md @@ -30,7 +30,7 @@ Deklariere und initialisiere eine Variable `total` auf `0`. Verwende eine `for`- `total` sollte deklariert und auf 0 initialisiert werden. ```js -assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); ``` `total` sollte gleich 20 sein. @@ -42,13 +42,13 @@ assert(total === 20); Du solltest eine `for`-Schleife verwenden, um durch `myArr` zu iterieren. ```js -assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code)); +assert(/for\s*\(/g.test(__helpers.removeJSComments(code)) && /myArr\s*\[/g.test(__helpers.removeJSComments(code))); ``` Du solltest nicht versuchen, `total` direkt den Wert 20 zuzuweisen. ```js -assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm)); +assert(!__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/total[=+-]0*[1-9]+/gm)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md index cd98f3d9cc9..64465643c33 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md @@ -56,7 +56,7 @@ In diesem Fall initialisieren wir den Wert von `i` auf 5, genau wie in der `whil Du solltest für diese Übung eine `do...while`-Schleife verwenden. ```js -assert(code.match(/do/g)); +assert(__helpers.removeJSComments(code).match(/do/g)); ``` `myArray` sollte gleich `[10]` sein. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md index 4b71cb58f11..f4ccb9d0f69 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md @@ -44,7 +44,7 @@ Verwende eine `for`-Schleife, um die Werte 1 bis 5 in `myArray` zu übertragen. Du solltest dafür eine `for`-Schleife verwenden. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` sollte gleich `[1, 2, 3, 4, 5]` sein. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md index 1e48478ac83..54eeffeba3a 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md @@ -36,7 +36,7 @@ Füge die Zahlen 5 bis 0 (einschließlich) in absteigender Reihenfolge zu `myArr Du solltest dafür eine `while`-Schleife verwenden. ```js -assert(code.match(/while/g)); +assert(__helpers.removeJSComments(code).match(/while/g)); ``` `myArray` sollte gleich `[5, 4, 3, 2, 1, 0]` sein. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index a2561f2b799..56bb0cd9455 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -48,7 +48,7 @@ Du solltest eine lokale Variable `myVar` hinzufügen. ```js assert( /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( - __helpers.removeWhiteSpace(code) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)) ) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md index ed1354e9d3a..48fc16a29bb 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md @@ -47,7 +47,7 @@ assert( Du solltest `pop()` auf `myArray` anwenden. ```js -assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code)); +assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(__helpers.removeJSComments(code))); ``` `removedFromMyArray` sollte nur `["cat", 2]` enthalten. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md index 9719b081458..f7d99c93849 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md @@ -52,7 +52,7 @@ Du solltest den richtigen Index verwenden, um den Wert in `myArray` zu ändern. ```js assert( (function () { - if (code.match(/myArray\[0\]\s*=\s*/g)) { + if (__helpers.removeJSComments(code).match(/myArray\[0\]\s*=\s*/g)) { return true; } else { return false; diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md index 6b43ff2680f..66c9d93563e 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md @@ -94,13 +94,13 @@ assert(sequentialSizes(9) === 'High'); Du solltest keine `if` oder `else`-Anweisungen verwenden ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Du solltest neun `case`-Anweisungen verwenden ```js -assert(code.match(/case/g).length === 9); +assert(__helpers.removeJSComments(code).match(/case/g).length === 9); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md index bf86f37cfc3..d4d6946a096 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md @@ -28,7 +28,7 @@ assert(product === 5.0); Du solltest den Operator `*` verwenden ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md index 3528dd58b40..1c82526c5b7 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md @@ -36,7 +36,7 @@ assert(product === 80); Du solltest den Operator `*` verwenden. ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md index f78cbfe5933..9437edd63bd 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md @@ -60,7 +60,7 @@ Du solltest die `functionWithArgs` mit zwei Zahlen aufrufen, nachdem du sie defi ```js assert( /functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test( - code.replace(/\s/g, '') + __helpers.removeJSComments(code).replace(/\s/g, '') ) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md index 3cd8d0a3412..438f8908242 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md @@ -47,7 +47,7 @@ assert(compareEquality('20', 20) === 'Not Equal'); Du solltest den Operator `===` verwenden ```js -assert(code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index 80c5587e912..991158498c8 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -47,7 +47,7 @@ Du solltest alle Backslashes (`\`) entfernen. ```js assert( - !/\\/g.test(code) && + !/\\/g.test(__helpers.removeJSComments(code)) && myStr.match( '\\s*\\s*Link\\s*\\s*' ) @@ -57,7 +57,7 @@ assert( Du solltest zwei einfache Anführungszeichen `'` und vier doppelte Anführungszeichen `"` verwenden. ```js -assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2); +assert(__helpers.removeJSComments(code).match(/"/g).length === 4 && __helpers.removeJSComments(code).match(/'/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index c296be36ef6..18594b614b2 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,7 +66,7 @@ Dein Code sollte keine Schleifen enthalten (`for` oder `while` oder Funktionen h ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md index 29db0f100ce..d8c897b7e95 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md @@ -45,19 +45,19 @@ switch (val) { Du solltest nirgendwo im Editor `else`-Anweisungen verwenden ```js -assert(!/else/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code))); ``` Du solltest nirgendwo im Editor `if`-Anweisungen verwenden ```js -assert(!/if/g.test(code)); +assert(!/if/g.test(__helpers.removeJSComments(code))); ``` Du solltest mindestens vier `break`-Anweisungen verwenden ```js -assert(code.match(/break/g).length >= 4); +assert(__helpers.removeJSComments(code).match(/break/g).length >= 4); ``` `chainToSwitch("bob")` sollte den String `Marley` zurückgeben diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md index 8a0d7eac4de..73990fc1db9 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md @@ -52,7 +52,7 @@ assert(isLess(15, 10) === false); Du solltest keine `if` oder `else`-Anweisungen verwenden ```js -assert(!/if|else/g.test(code)); +assert(!/if|else/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md index 838eedfecbd..c9ec7b38020 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md @@ -63,13 +63,13 @@ assert(caseInSwitch(4) === 'delta'); Du solltest keine `if` oder `else`-Anweisungen verwenden ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Du solltest mindestens 3 `break`-Anweisungen verwenden ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md index 97f34ba8f44..22075c1a0af 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md @@ -35,7 +35,7 @@ Weise den Wert `7` der Variablen `a` zu. Du solltest den Code oberhalb des vorgegebenen Kommentars nicht ändern. ```js -assert(/var a;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code))); ``` `a` sollte einen Wert von 7 haben. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md index bdb92b7636b..5da2d996d5a 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md @@ -35,7 +35,7 @@ assert(difference === 12); Du solltest nur eine Zahl von `45` abziehen. ```js -assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code))); +assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md index d908c5316bf..d8d9f7428f2 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md @@ -40,7 +40,7 @@ assert(myStr === 'Hello World'); Du solltest den Code oberhalb des vorgegebenen Kommentars nicht ändern. ```js -assert(/myStr = "Jello World"/.test(code)); +assert(/myStr = "Jello World"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md index c24e1cad7f1..1f316c4240c 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md @@ -56,19 +56,19 @@ assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000); `studlyCapVar` sollte sowohl im Deklarations- als auch im Zuweisungsabschnitt camelCase verwenden. ```js -assert(code.match(/studlyCapVar/g).length === 2); +assert(__helpers.removeJSComments(code).match(/studlyCapVar/g).length === 2); ``` `properCamelCase` sollte sowohl im Deklarations- als auch im Zuweisungsabschnitt camelCase verwenden. ```js -assert(code.match(/properCamelCase/g).length === 2); +assert(__helpers.removeJSComments(code).match(/properCamelCase/g).length === 2); ``` `titleCaseOver` sollte sowohl im Deklarations- als auch im Zuweisungsabschnitt camelCase verwenden. ```js -assert(code.match(/titleCaseOver/g).length === 2); +assert(__helpers.removeJSComments(code).match(/titleCaseOver/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index 7a46533812f..335f19d6ed7 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -39,9 +39,9 @@ Du solltest den Code unterhalb des vorgegebenen Kommentars nicht ändern. ```js assert( - /a = a \+ 1;/.test(code) && - /b = b \+ 5;/.test(code) && - /c = c \+ " String!";/.test(code) + /a = a \+ 1;/.test(__helpers.removeJSComments(code)) && + /b = b \+ 5;/.test(__helpers.removeJSComments(code)) && + /c = c \+ " String!";/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md index f796ae0b6bd..96af6a11922 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md @@ -39,7 +39,7 @@ assert(/happy coder/gi.test(myDog.name)); Du solltest die Definition von `myDog` nicht bearbeiten. ```js -assert(/"name": "Coder"/.test(code)); +assert(/"name": "Coder"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md index 97d30169e5f..c10b65d196a 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md @@ -41,7 +41,7 @@ assert(firstLetterOfLastName === 'L'); Du solltest die Klammer-Notation verwenden. ```js -assert(code.match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md index 34223b8895c..d31668acbee 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(lastLetterOfLastName === 'e'); Du solltest `.length` verwenden, um den letzten Buchstaben zu erhalten. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md index 500e457ee0f..938b7e02f35 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md @@ -39,7 +39,7 @@ assert(thirdLetterOfLastName === 'v'); Du solltest die Klammer-Notation verwenden. ```js -assert(code.match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md index 0965c4e7457..88a376d84d1 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(secondToLastLetterOfLastName === 'c'); Du solltest `.length` verwenden, um den vorletzten Buchstaben zu erhalten. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md index c2a17578b0d..2c3fa204ca5 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md @@ -54,7 +54,7 @@ In der Funktion `checkSign` verwendest du mehrere bedingte Operatoren - in Anleh `checkSign` sollte mehrere bedingte Operatoren verwenden ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(__helpers.removeJSComments(code))); ``` `checkSign(10)` sollte den String `positive` zurückgeben. Beachte, dass die Großschreibung wichtig ist diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index 3dccacccda5..36d82af32d4 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,7 +59,7 @@ Dein Code sollte keine Schleifen enthalten (`for`, `while` oder Funktionen höhe ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index d2febcd3dc1..50e025f68b7 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,7 +26,7 @@ Dein Code sollte keine Schleifensyntax verwenden (`for` oder `while` oder Funkti ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index 3712410207b..6f80bf97a14 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -42,7 +42,7 @@ Verwende den bedingten Operator in der Funktion `checkEqual`, um zu prüfen, ob `checkEqual` sollte den bedingten Operator verwenden ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(__helpers.removeJSComments(code))); ``` `checkEqual(1, 2)` sollte den String `Not Equal` zurückgeben diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md index 7a1ad059b8c..96f97f51e8e 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md @@ -34,7 +34,7 @@ Verwende `parseInt()` in der Funktion `convertToInteger`, damit sie eine Binärz `convertToInteger` sollte die Funktion `parseInt()` verwenden ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("10011")` sollte eine Zahl zurückgeben diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md index 2444884c292..56d45a45fa5 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md @@ -26,7 +26,7 @@ Verwende `parseInt()` in der Funktion `convertToInteger`, damit sie den Eingabes `convertToInteger` sollte die Funktion `parseInt()` verwenden ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("56")` sollte eine Zahl zurückgeben diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md index a56285c95f5..88c571736ff 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md @@ -83,14 +83,14 @@ assert(typeof phoneticLookup('') === 'undefined'); Du solltest die `return`-Anweisung nicht ändern ```js -assert(code.match(/return\sresult;/)); +assert(__helpers.removeJSComments(code).match(/return\sresult;/)); ``` Du solltest keine `case`-, `switch`- oder `if`-Anweisungen verwenden ```js assert( - !/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) + !/case|switch|if/g.test(__helpers.removeJSComments(code).replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md index 909763c93bb..39c10199cc1 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md @@ -53,7 +53,7 @@ assert( Du solltest die Werte `dog`, `ran`, `big` oder `quickly` nicht direkt verwenden, um `wordBlanks` zu erstellen. ```js -const newCode = removeAssignments(code); +const newCode = removeAssignments(__helpers.removeJSComments(code)); assert( !/dog/.test(newCode) && !/ran/.test(newCode) && diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md index 684b37bb730..9d76267c902 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md @@ -50,7 +50,7 @@ Du solltest `reusableFunction` aufrufen, sobald sie definiert ist. ```js const functionStr = reusableFunction && __helpers.removeWhiteSpace(reusableFunction.toString()); -const codeWithoutFunction = __helpers.removeWhiteSpace(code).replace(/reusableFunction\(\)\{/g, ''); +const codeWithoutFunction = __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).replace(/reusableFunction\(\)\{/g, ''); assert(/reusableFunction\(\)/.test(codeWithoutFunction)); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md index ff010b37726..16feec7fa15 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md @@ -25,7 +25,7 @@ assert(power == 8); Dein Code sollte die richtige Reihenfolge der Argumente für den Funktionsaufruf von `raiseToPower` verwenden. ```js -assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); +assert(__helpers.removeJSComments(code).match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md index c38d1226ccb..a4260a66872 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md @@ -37,7 +37,7 @@ assert(result == 9); Dein Code sollte die Funktion `getNine` aufrufen. ```js -assert(code.match(/getNine\(\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/getNine\(\)/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md index 3878e5dffe1..ee2520a9410 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md @@ -27,25 +27,25 @@ assert(netWorkingCapital === 2); Es sollten keine falsch geschriebenen Variablen im Code vorkommen. ```js -assert(!code.match(/recievables/g)); +assert(!__helpers.removeJSComments(code).match(/recievables/g)); ``` Die Variable `receivables` sollte im Code richtig deklariert und verwendet werden. ```js -assert(code.match(/receivables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/receivables/g).length == 2); ``` Es sollten keine falsch geschriebenen Variablen im Code vorkommen. ```js -assert(!code.match(/payable;/g)); +assert(!__helpers.removeJSComments(code).match(/payable;/g)); ``` Die Variable `payables` sollte im Code richtig deklariert und verwendet werden. ```js -assert(code.match(/payables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/payables/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index 937cc3d48c1..d4eddc49629 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -37,13 +37,13 @@ Korrigiere den String so, dass er entweder andere Anführungszeichen für den We Dein Code sollte die Anführungszeichen um den Wert `href` `#Home` korrigieren, indem du sie entweder änderst oder umgehst (escaping). ```js -assert(code.match(//g)); +assert(__helpers.removeJSComments(code).match(//g)); ``` Dein Code sollte die doppelten Anführungszeichen um den gesamten String herum beibehalten. ```js -assert(code.match(/"

.*?<\/p>";/g)); +assert(__helpers.removeJSComments(code).match(/"

.*?<\/p>";/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md index 905e2dbbf77..117a0c02a03 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md @@ -37,25 +37,25 @@ Behebe die beiden Indizierungsfehler in der folgenden Funktion, damit alle Zahle Dein Code sollte die Anfangsbedingung der Schleife so setzen, dass sie beim ersten Index beginnt. ```js -assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?=\s*?0\s*?;/g).length == 1); ``` Dein Code sollte die Anfangsbedingung der Schleife so festlegen, dass der Index bei 0 beginnt. ```js -assert(!code.match(/i\s?=\s*?1\s*?;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s?=\s*?1\s*?;/g)); ``` Dein Code sollte die Endbedingung der Schleife so setzen, dass sie beim letzten Index anhält. ```js -assert(code.match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); ``` Dein Code sollte die Endbedingung der Schleife so festlegen, dass sie bei 1 vor der Länge aufhört. ```js -assert(!code.match(/i\s*?<=\s*?len;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?<=\s*?len;/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md index 40d073766d7..a63020ec1ba 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md @@ -21,7 +21,7 @@ Behebe die beiden Paarfehler im Code. Dein Code sollte das fehlende Stück des Arrays reparieren. ```js -assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); +assert(__helpers.removeJSComments(code).match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); ``` Dein Code sollte den fehlenden Teil der Methode `.reduce()` beheben. Die Konsolenausgabe sollte Folgendes anzeigen: `Sum of array values is: 6`. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md index 3b828b01ced..3c6fe47beba 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md @@ -43,7 +43,7 @@ assert(result == 'Not equal!'); Die Bedingung sollte entweder `==` oder `===` verwenden, um auf Gleichheit zu testen. ```js -assert(code.match(/x\s*?===?\s*?y/g)); +assert(__helpers.removeJSComments(code).match(/x\s*?===?\s*?y/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md index 5920717e4b7..f0e569cacb2 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md @@ -31,13 +31,13 @@ Die Funktion `myFunc()` enthält eine Endlosschleife, weil die Abschlussbedingun Dein Code sollte den Vergleichsoperator in der Abschlussbedingung (dem mittleren Teil) der `for`-Schleife ändern. ```js -assert(code.match(/i\s*?<=\s*?4;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?<=\s*?4;/g).length == 1); ``` Dein Code sollte den Vergleichsoperator in der Abschlussbedingung der Schleife korrigieren. ```js -assert(!code.match(/i\s*?!=\s*?4;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?!=\s*?4;/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index 11d4c2a14da..38d1bd6f4dd 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -23,7 +23,7 @@ Verwende danach `console.log`, um die Variable `output` zu protokollieren. Sieh Du solltest `console.log()` verwenden, um die Variable `output` auszugeben. ```js -assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/console\.log\(output\)/)); ``` Du solltest `console.clear()` verwenden, um die Browserkonsole zu löschen. @@ -31,7 +31,7 @@ Du solltest `console.clear()` verwenden, um die Browserkonsole zu löschen. ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console.clear\(\)/) ); ``` @@ -41,7 +41,7 @@ Du solltest die Konsole nach deinem Log löschen. ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console\.log\(output\)[\s\S]*console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md index 593a15904f0..52ceb80dfd0 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md @@ -29,7 +29,7 @@ Verwende die Methode `console.log()`, um den Wert der Variable `a` an den Stelle Dein Code sollte `console.log()` verwenden, um den Wert der Variable `a` zu überprüfen. ```js -assert(code.match(/console\.log\(a\)/g)); +assert(__helpers.removeJSComments(code).match(/console\.log\(a\)/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md index 943611ac160..02abdae8f49 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md @@ -32,19 +32,19 @@ Füge zwei `console.log()` Anweisungen hinzu, um den Typ (`typeof`) jeder der be Dein Code sollte `typeof` in zwei `console.log()` Anweisungen verwenden, um den Typ der Variablen zu überprüfen. ```js -assert(code.match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); ``` Dein Code sollte `typeof` verwenden, um den Typ der Variablen `seven` zu überprüfen. ```js -assert(code.match(/typeof[\( ]seven\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]seven\)?/g)); ``` Dein Code sollte `typeof` verwenden, um den Typ der Variablen `three` zu überprüfen. ```js -assert(code.match(/typeof[\( ]three\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]three\)?/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index 3ad528ecaa1..beb611e00c3 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -87,13 +87,13 @@ Diese Übung soll den Unterschied zwischen den Schlüsselwörtern `var` und `let `var` sollte nicht im Code vorhanden sein. ```js -assert(!code.match(/var/g)); +assert(!__helpers.removeJSComments(code).match(/var/g)); ``` Die Variable `i`, die in der `if`-Anweisung deklariert wird, sollte gleich dem String `block scope` sein. ```js -assert(code.match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); +assert(__helpers.removeJSComments(code).match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); ``` `checkScope()` sollte den String `function scope` zurückgeben. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index 539e5e44181..ed76295b828 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,7 +32,7 @@ Sorge dafür, dass das Promise mit Erfolg und Misserfolg umgeht. Wenn `responseF ```js assert( - code.match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) ); ``` @@ -40,7 +40,7 @@ assert( ```js assert( - code.match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md index 7ac8b9409ce..0672b6580c8 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md @@ -32,7 +32,7 @@ Dein Promise sollte eine Funktion mit `resolve` und `reject` als Parameter erhal ```js assert( - code.match( + __helpers.removeJSComments(code).match( /Promise\s*\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g ) ); diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md index ff5e2c5cc66..afe1f90a853 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md @@ -25,14 +25,14 @@ Füge dem HTML-Dokument ein Skript vom Typ Modul (`module`) hinzu und gib ihm di Du solltest ein `script`-Tag erstellen. ```js -assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); +assert(__helpers.removeJSComments(code).match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); ``` Dein `script`-Tag sollte das Attribut `type` mit dem Wert `module` besitzen. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g ) ); @@ -42,7 +42,7 @@ Dein `script`-Tag sollte die Quelle (`src`) von `index.js` haben. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g ) ); diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md index df6eccdbea7..4963fcc3405 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md @@ -38,7 +38,7 @@ Dein Code sollte einen `export` Fallback verwenden. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g ) ); diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md index 71e55485935..3401cc5ab6f 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md @@ -75,7 +75,7 @@ assert.match(code, /(`.*\${.*}.*`)/); Es sollte ein Iterator verwendet werden. ```js -assert(code.match(/for|map|reduce|forEach|while/)); +assert(__helpers.removeJSComments(code).match(/for|map|reduce|forEach|while/)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md index e2ccf3f6a71..22f0f17b8c6 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md @@ -34,7 +34,7 @@ Du solltest die Methode `then` für das Versprechen aufrufen. ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.then\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.then\(/g) ); ``` @@ -50,7 +50,7 @@ Du solltest `result` auf der Konsole loggen. assert( resultIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.then\(.*?result.*?console.log\(result\).*?\)/) ); ``` @@ -60,7 +60,7 @@ assert( ## --after-user-code-- ```js -const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(code)); +const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md index e292c513643..0deab6463cc 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md @@ -28,7 +28,7 @@ Du solltest die Methode `catch` für das Promise aufrufen. ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.catch\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.catch\(/g) ); ``` @@ -44,7 +44,7 @@ Du solltest `error` auf der Konsole loggen. assert( errorIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.catch\(.*?error.*?console.log\(error\).*?\)/) ); ``` @@ -54,7 +54,7 @@ assert( ## --after-user-code-- ```js -const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(code)); +const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md index c89821c5116..9928a87f996 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md @@ -25,7 +25,7 @@ Im folgenden Code importierst du den Standard-Export aus der Datei `math_functio Du solltest `subtract` aus `math_functions.js` korrekt importieren. ```js -assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); +assert(__helpers.removeJSComments(code).match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md index bdb5062bc84..bbb41ce01b7 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md @@ -36,19 +36,19 @@ Ein Array wird als `const s = [5, 7, 2]` deklariert. Ändere das Array zu `[2, 5 Du solltest das Schlüsselwort `const` nicht ersetzen. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `s` sollte eine konstante Variable sein (indem du `const` verwendest). ```js -assert(code.match(/const\s+s/g)); +assert(__helpers.removeJSComments(code).match(/const\s+s/g)); ``` Du solltest die ursprüngliche Array-Deklaration nicht ändern. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g )); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md index ffaeb39369a..66ae9a47cd3 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md @@ -34,19 +34,19 @@ In dieser Aufgabe wirst du `Object.freeze` verwenden, um zu verhindern, dass sic Du solltest das Schlüsselwort `const` nicht ersetzen. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `MATH_CONSTANTS` sollte eine konstante Variable sein (indem du `const` verwendest). ```js -assert(code.match(/const\s+MATH_CONSTANTS/g)); +assert(__helpers.removeJSComments(code).match(/const\s+MATH_CONSTANTS/g)); ``` Du solltest die ursprüngliche Deklaration von `MATH_CONSTANTS` nicht ändern. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g )); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md index ae3ed436ee2..2bd98f56761 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md @@ -32,7 +32,7 @@ Du solltest `uppercaseString` korrekt importieren. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); @@ -42,7 +42,7 @@ Du solltest `lowercaseString` korrekt importieren. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index 38e1d678c5e..0421cc10cb3 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -44,7 +44,7 @@ assert(increment(5) === 6); Für `value` sollte ein Standardparameterwert von `1` verwendet werden. ```js -assert(code.match(/value\s*=\s*1/g)); +assert(__helpers.removeJSComments(code).match(/value\s*=\s*1/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md index 37118bee113..f5ea0b46dd1 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md @@ -31,7 +31,7 @@ Dein Code sollte die Syntax `import * as` korrekt verwenden. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g ) ); diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index 752de18153f..83ad0100841 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -66,7 +66,7 @@ assert( Das `class`-Schlüsselwort sollte verwendet werden. ```js -assert(code.match(/class/g)); +assert(__helpers.removeJSComments(code).match(/class/g)); ``` `Vegetable` sollte instanziiert werden können. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md index 464252d3680..0ccb53e22f8 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md @@ -51,7 +51,7 @@ assert(b === 8); Du solltest die Array-Destrukturierung verwenden, um `a` und `b` zu tauschen. ```js -assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code)); +assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index 2ab00ac1bac..8eb2f61eb3d 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -43,8 +43,8 @@ Du solltest die ES5-Zuweisungssyntax entfernen. ```js assert( - !code.match(/lowToday = LOCAL_FORECAST\.today\.low/g) && - !code.match(/highToday = LOCAL_FORECAST\.today.high/g) + !__helpers.removeJSComments(code).match(/lowToday = LOCAL_FORECAST\.today\.low/g) && + !__helpers.removeJSComments(code).match(/highToday = LOCAL_FORECAST\.today.high/g) ); ``` @@ -52,7 +52,7 @@ Du solltest die Destrukturierung verwenden, um die Variable `lowToday` zu erstel ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(low\s*:\s*lowToday[^}]*|[^,]*,\s*low\s*:\s*lowToday\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); @@ -62,7 +62,7 @@ Du solltest die Destrukturierung verwenden, um die Variable `highToday` zu erste ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday,?\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index adbde5b4cd1..e00de7f4f5b 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -34,8 +34,8 @@ Du solltest die ES5-Zuweisungssyntax entfernen. ```js assert( - !code.match(/highToday = HIGH_TEMPERATURES\.today/g) && - !code.match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) + !__helpers.removeJSComments(code).match(/highToday = HIGH_TEMPERATURES\.today/g) && + !__helpers.removeJSComments(code).match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) ); ``` @@ -43,7 +43,7 @@ Du solltest die Destrukturierung verwenden, um die Variable `highToday` zu erste ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(today\s*:\s*highToday[^}]*|[^,]*,\s*today\s*:\s*highToday\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); @@ -53,7 +53,7 @@ Du solltest die Destrukturierung verwenden, um die Variable `highTomorrow` zu er ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(tomorrow\s*:\s*highTomorrow[^}]*|[^,]*,\s*tomorrow\s*:\s*highTomorrow\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 3731296e58c..be365ec6491 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,7 +43,7 @@ Du solltest die ES5-Zuweisungssyntax entfernen. ```js assert( - !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !__helpers.removeJSComments(code).match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -51,7 +51,7 @@ Du solltest die Destrukturierung verwenden, um die Variable `today` zu erstellen ```js assert( - code.match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` @@ -59,7 +59,7 @@ Du solltest die Destrukturierung verwenden, um die Variable `tomorrow` zu erstel ```js assert( - code.match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md index 05b66a8d10d..29482ce488f 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md @@ -50,13 +50,13 @@ assert(half(stats) === 28.015); Es sollte eine Destrukturierung vorgenommen werden. ```js -assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/half=\({\w+,\w+}\)/)); ``` Es sollten destrukturierte Parameter verwendet werden. ```js -assert(!code.match(/stats\.max|stats\.min/)); +assert(!__helpers.removeJSComments(code).match(/stats\.max|stats\.min/)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index e0139f233f0..64be043290f 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -47,7 +47,7 @@ assert.deepEqual(_testArr, [1, 2, 3, 4, 5]) `Array.slice()` sollte nicht verwendet werden. ```js -assert(!code.match(/\.\s*slice\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*slice\s*\(/)); ``` You should use the rest syntax. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md index ae6cee42382..8b70507b793 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md @@ -42,7 +42,7 @@ Du solltest `uppercaseString` richtig exportieren. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+uppercaseString|export\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)})/g ) ); @@ -52,7 +52,7 @@ Du solltest `lowercaseString` richtig exportieren. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+lowercaseString|export\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)})/g ) ); diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md index d89652f4d61..0f7bf5682e9 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md @@ -57,7 +57,7 @@ assert(sum() === 0); `sum` sollte eine Pfeilfunktion sein, die die Restparametersyntax (`...`) für den `args`-Parameter verwendet. ```js -assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/sum=\(\.\.\.args\)=>/)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md index 030eaee2047..1818e6dcb80 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md @@ -55,7 +55,7 @@ assert(arr2.every((v, i) => v === arr1[i]) && arr2.length); Der Spread-Operator `...` sollte zum Duplizieren von `arr1` verwendet werden. ```js -assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); +assert(__helpers.removeJSComments(code).match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); ``` `arr2` sollte unverändert bleiben, wenn `arr1` geändert wird. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md index 80d42229c84..7ea1402ccce 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md @@ -54,7 +54,7 @@ assert.match(code, /const\s+myConcat/g); ```js assert( - /myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) && + /myConcat=\(\w+,\w+\)=>/.test(__helpers.removeJSComments(code).replace(/\s/g, '')) && typeof myConcat === 'function' ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 5985334f4ef..1082a5e93ad 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,14 +39,14 @@ Refaktoriere die Funktion `setGear` innerhalb des Objekts `bicycle`, um die oben Der traditionelle Funktionsausdruck sollte nicht verwendet werden. ```js -assert(!code.match(/function/)); +assert(!__helpers.removeJSComments(code).match(/function/)); ``` `setGear` sollte eine deklarative Funktion sein. ```js assert( - typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/) + typeof bicycle.setGear === 'function' && __helpers.removeJSComments(code).match(/setGear\s*\(.+\)\s*\{/) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md index 251cf288525..1bd48bbe403 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md @@ -43,7 +43,7 @@ assert.deepEqual( Dein Code sollte nicht `key:value` verwenden. ```js -assert(!code.match(/:/g)) +assert(!__helpers.removeJSComments(code).match(/:/g)) ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md index c143566390b..b4877f3a2ab 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md @@ -30,13 +30,13 @@ arr.push(4, 5, 6); Dein Code sollte die `concat`-Methode verwenden. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` Dein Code sollte nicht die `push`-Methode verwenden. ```js -assert(!code.match(/\.?[\s\S]*?push/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?push/g)); ``` Das `first`-Array sollte sich nicht verändern. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md index 10ee4df94a3..c91365a424c 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md @@ -31,7 +31,7 @@ Die Ausgabe sollte keine Leerzeichen haben Dein Code sollte nicht die `replace` Methode für diese Challenge verwenden. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `urlSlug("Winter Is Coming")` sollte den String `winter-is-coming` zurückgeben. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md index 2668d689d24..73ca52ac701 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md @@ -27,13 +27,13 @@ Benutze (unter anderem) die `join` Methode innerhalb der `sentensify` Funktion, Dein Code sollte die `join` Methode verwenden. ```js -assert(code.match(/\.join/g)); +assert(__helpers.removeJSComments(code).match(/\.join/g)); ``` Dein Code sollte nicht die `replace` Methode verwenden. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `sentensify("May-the-force-be-with-you")` sollte einen String zurückgeben. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md index dea38ef4c98..4278ecb6078 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md @@ -25,7 +25,7 @@ Verwende die `concat` Methode in der `nonMutatingConcat` Funktion, um `attach` a Dein Code sollte die `concat` Methode verwenden. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` Das `first` Array sollte sich nicht ändern. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md index 6fa17ca0f29..33e2601d90d 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md @@ -47,7 +47,7 @@ assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_ Dein Code sollte die Methode `map` nicht verwenden. ```js -assert(!code.match(/\.?[\s\S]*?map/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?map/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md index 2d233290906..5030e041e05 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md @@ -43,7 +43,7 @@ assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFi Dein Code sollte die Methode `filter` nicht verwenden. ```js -assert(!code.match(/\.?[\s\S]*?filter/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?filter/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md index ca7d6875b27..32d5905e46f 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md @@ -77,7 +77,7 @@ assert(add(11)(22)(33) === 66); Dein Code sollte eine abschließende Anweisung enthalten, die `x + y + z` zurückgibt. ```js -assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); +assert(__helpers.removeJSComments(code).match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md index 5ed1904c0a4..9917e71912e 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md @@ -30,13 +30,13 @@ Verändere das ursprüngliche Array, das der Funktion übergeben wird, nicht. Dein Code sollte die Methode `slice` verwenden. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` Dein Code sollte nicht die Methode `splice` verwenden. ```js -assert(!code.match(/\.?[\s\S]*?splice/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?splice/g)); ``` You should not mutate the original array passed to the function. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md index 8d0819f54a9..3dcbe65cdc7 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md @@ -28,7 +28,7 @@ Verwende die Methode `slice` in der Funktion `sliceArray`, um einen Teil des Arr Dein Code sollte die Methode `slice` verwenden. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` Die Variable `inputAnim` sollte sich nicht ändern. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md index d3b639894a4..ca689ab5305 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md @@ -47,7 +47,7 @@ Verwende die Methode `sort` in der Funktion `alphabeticalOrder`, um die Elemente Dein Code sollte die Methode `sort` verwenden. ```js -assert(code.match(/\.sort/g)); +assert(__helpers.removeJSComments(code).match(/\.sort/g)); ``` `alphabeticalOrder(["a", "d", "c", "a", "z", "g"])` sollte `["a", "a", "c", "d", "g", "z"]` zurückgeben. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md index afd6fb750d8..6b3073a9552 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md @@ -33,7 +33,7 @@ Verwende die Methode `split` innerhalb der Funktion `splitify`, um `str` in ein Dein Code sollte die Methode `split` verwenden. ```js -assert(code.match(/\.split/g)); +assert(__helpers.removeJSComments(code).match(/\.split/g)); ``` `splitify("Hello World,I-am code")` sollte `["Hello", "World", "I", "am", "code"]` zurückgeben. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index f8b4d4f074d..862e49bafc7 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), `for`, `while` und `forEach` sollten nicht verwendet werden. ```js -assert(!code.match(/for|while|forEach/g)); +assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ``` `map`, `filter` oder `reduce` sollten verwendet werden. @@ -36,7 +36,7 @@ assert(!code.match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md index 4133a1625ae..d78e35aa58d 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md @@ -31,7 +31,7 @@ Verwende die Methode `every` innerhalb der Funktion `checkPositive`, um zu prüf Dein Code sollte die Methode `every` verwenden. ```js -assert(code.match(/\.every/g)); +assert(__helpers.removeJSComments(code).match(/\.every/g)); ``` `checkPositive([1, 2, 3, -4, 5])` sollte `false` zurückgeben. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md index 59951dfd9bc..a823799029c 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md @@ -46,13 +46,13 @@ assert( Dein Code sollte die Methode `filter` verwenden. ```js -assert(code.match(/\s*\.\s*filter/g)); +assert(__helpers.removeJSComments(code).match(/\s*\.\s*filter/g)); ``` Dein Code sollte keine `for`-Schleife verwenden. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` `filteredList` sollt gleich `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"}, {"title": "Batman Begins", "rating": "8.3"}]` sein. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 2c1f2855785..22447b06779 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,13 +52,13 @@ assert( Dein Code sollte keine `for`-Schleife verwenden. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); ``` Dein Code sollte die Methode `map` verwenden. ```js -assert(code.match(/\.map/g)); +assert(__helpers.removeJSComments(code).match(/\.map/g)); ``` `ratings` sollte gleich `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"},{"title": "Batman Begins", "rating": "8.3"}, {"title": "Avatar", "rating": "7.9"}]` sein. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md index 843e5d04d7d..5cbd736d914 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md @@ -66,7 +66,7 @@ assert( Dein Code sollte die Methode `reduce` verwenden. ```js -assert(code.match(/\.reduce/g)); +assert(__helpers.removeJSComments(code).match(/\.reduce/g)); ``` `getRating(watchList)` sollte gleich 8,675 sein. @@ -78,7 +78,7 @@ assert(getRating(watchList) === 8.675); Dein Code sollte keine `for`-Schleife verwenden. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` Dein Code sollte die richtige Ausgabe zurückgeben, nachdem du das Objekt `watchList` geändert hast. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md index 3bc876f68b2..aebe3ce1ea7 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md @@ -31,7 +31,7 @@ Verwende die Methode `some` innerhalb der Funktion `checkPositive`, um zu prüfe Dein Code sollte die Methode `some` verwenden. ```js -assert(code.match(/\.some/g)); +assert(__helpers.removeJSComments(code).match(/\.some/g)); ``` `checkPositive([1, 2, 3, -4, 5])` sollte `true` zurückgeben. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md index 76080598c33..4397eaa4cf1 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md @@ -39,7 +39,7 @@ assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4]); Deine Lösung sollte nicht `Array.prototype.flat()`- oder `Array.prototype.flatMap()`-Methoden verwenden. ```js -assert(!code.match(/\.\s*flat\s*\(/) && !code.match(/\.\s*flatMap\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*flat\s*\(/) && !__helpers.removeJSComments(code).match(/\.\s*flatMap\s*\(/)); ``` Globale Variablen sollten nicht verwendet werden. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md index 989bc9fcdf2..d07c7b47412 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md @@ -49,7 +49,7 @@ Füge die Eigenschaft `numLegs` und die beiden Methoden `eat()` und `describe()` `Dog.prototype` sollte auf ein neues Objekt gesetzt werden. ```js -assert(/Dog\.prototype\s*?=\s*?{/.test(code)); +assert(/Dog\.prototype\s*?=\s*?{/.test(__helpers.removeJSComments(code))); ``` `Dog.prototype` sollte die Eigenschaft `numLegs` besitzen. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md index 116e91ae1a6..69e7a73832b 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md @@ -61,7 +61,7 @@ Die Variable `duck` sollte mit `Object.create` initialisiert werden. ```js assert( /(let|const|var)\s{1,}duck\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` @@ -71,7 +71,7 @@ Die Variable `beagle` sollte mit `Object.create` initialisiert werden. ```js assert( /(let|const|var)\s{1,}beagle\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md index 0dd0866ffc0..70d771da226 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md @@ -61,7 +61,7 @@ assert.deepEqual(prototypeProps, ['numLegs']); Du solltest diese Aufgabe lösen, ohne die eingebaute Methode `Object.keys()` zu verwenden. ```js -assert(!/\Object.keys/.test(code)); +assert(!/\Object.keys/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md index 5e70ec782d3..755baa81669 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md @@ -43,7 +43,7 @@ assert(dog.sayLegs() === 'This dog has 4 legs.'); Dein Code sollte das Schlüsselwort `this` verwenden, um auf die Eigenschaft `numLegs` von `dog` zuzugreifen. ```js -assert(code.match(/this\.numLegs/g)); +assert(__helpers.removeJSComments(code).match(/this\.numLegs/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md index 3f22c0caab7..e19fe4a9893 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md @@ -51,7 +51,7 @@ assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1); Du solltest diese Aufgabe lösen, ohne die eingebaute Methode `Object.keys()` zu verwenden. ```js -assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); +assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(__helpers.removeJSComments(code))); ``` Du solltest diese Aufgabe lösen, ohne das Array `ownProps` fest zu kodieren. @@ -59,7 +59,7 @@ Du solltest diese Aufgabe lösen, ohne das Array `ownProps` fest zu kodieren. ```js assert( !/\[\s*(?:'|")(?:name|numLegs)|(?:push|concat)\(\s*(?:'|")(?:name|numLegs)/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md index b916da7d439..c77c0ffd34c 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md @@ -55,7 +55,7 @@ assert(joinDogFraternity(new Dog('')) === true); `joinDogFraternity` sollte die `constructor`-Eigenschaft verwenden. ```js -assert(/\.constructor/.test(code) && !/instanceof/.test(code)); +assert(/\.constructor/.test(__helpers.removeJSComments(code)) && !/instanceof/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md index 237898a14ca..b15ba02dbf4 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md @@ -29,13 +29,13 @@ Schreibe die Funktion `makeNest` um und entferne ihren Aufruf, sodass sie stattd Die Funktion sollte anonym sein. ```js -assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, ''))); +assert(/\((function|\(\))(=>|\(\)){?/.test(__helpers.removeJSComments(code).replace(/\s/g, ''))); ``` Deine Funktion sollte am Ende des Ausdrucks Klammern haben, um sie sofort aufrufen zu können. ```js -assert(/\(.*(\)\(|\}\(\))\)/.test(code.replace(/[\s;]/g, ''))); +assert(/\(.*(\)\(|\}\(\))\)/.test(__helpers.removeJSComments(code).replace(/[\s;]/g, ''))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md index cd4f5db2f63..093b34d73f6 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md @@ -42,7 +42,7 @@ Die Methode `hasOwnProperty` ist in `Object.prototype` definiert, auf die `Bird. Dein Code sollte zeigen, dass `Object.prototype` der Prototyp von `Dog.prototype` ist. ```js -assert(/Object\.prototype\.isPrototypeOf/.test(code)); +assert(/Object\.prototype\.isPrototypeOf/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md index 7eb89d36c21..89c05edbe94 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md @@ -35,7 +35,7 @@ Verwende `isPrototypeOf`, um den `prototype` von `beagle` zu ermitteln. Du solltest zeigen, dass `Dog.prototype` der `prototype` von `beagle` ist. ```js -assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code)); +assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md index fd8c3d86e93..01e317efc24 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md @@ -52,7 +52,7 @@ assert(hound instanceof Dog); Dein Code sollte den Operator `new` verwenden, um eine Instanz von `Dog` zu erstellen. ```js -assert(code.match(/new/g)); +assert(__helpers.removeJSComments(code).match(/new/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md index eb74a72bb18..2bef1b7b09d 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md @@ -43,7 +43,7 @@ Hier ist `getHatchedEggCount` eine privilegierte Methode, weil sie Zugriff auf d Die Eigenschaft `weight` sollte eine private Variable sein und den Wert `15` zugewiesen bekommen. ```js -assert(code.match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); ``` Dein Code sollte eine Methode in `Bird` namens `getWeight` erstellen, die den Wert der privaten Variable `weight` zurückgibt. @@ -55,7 +55,7 @@ assert(new Bird().getWeight() === 15); Deine Funktion `getWeight` sollte die private Variable `weight` zurückgeben. ```js -assert(code.match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); +assert(__helpers.removeJSComments(code).match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md index d574c74541f..509509da7ae 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md @@ -29,13 +29,13 @@ Gib beide Eigenschaften des Objekts `dog` auf deiner Konsole aus. Dein Code sollte `console.log` verwenden, um den Wert für die Eigenschaft `name` des Objekts `dog` auszugeben. ```js -assert(/console.log\(.*dog\.name.*\)/g.test(code)); +assert(/console.log\(.*dog\.name.*\)/g.test(__helpers.removeJSComments(code))); ``` Dein Code sollte `console.log` verwenden, um den Wert für die Eigenschaft `numLegs` des Objekts `dog` auszugeben. ```js -assert(/console.log\(.*dog\.numLegs.*\)/g.test(code)); +assert(/console.log\(.*dog\.numLegs.*\)/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md index ec8a5019187..d0b5f3c36b4 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md @@ -53,7 +53,7 @@ assert(typeof myHouse.numBedrooms === 'number'); Du solltest überprüfen, ob `myHouse` eine Instanz von `House` ist, indem du den Operator `instanceof` verwendest. ```js -assert(/myHouse\s*instanceof\s*House/.test(code)); +assert(/myHouse\s*instanceof\s*House/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md index cd9c1ef1034..fd30117abdb 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md @@ -75,7 +75,7 @@ assert(!myRegex.test('EleanorRoosevelt')); Du solltest `.test()` verwenden, um den regulären Ausdruck zu testen. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` Dein Ergebnis sollte `true` zurückgeben. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md index c3af33f8f4c..f33ff932890 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md @@ -51,7 +51,7 @@ assert(codingRegex.source === 'coding'); Du solltest die Methode `.match()` verwenden. ```js -assert(code.match(/\.match\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.match\(.*\)/)); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md index a2675d503cc..cde3058481c 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md @@ -31,7 +31,7 @@ Ergänze den Regex `unRegex` so, dass er auf die Strings `run`, `sun`, `fun`, `p Du solltest die Methode `.test()` verwenden. ```js -assert(code.match(/\.test\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.test\(.*\)/)); ``` Du solltest das Wildcardzeichen in deinem Regex `unRegex` verwenden. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index e8e68e85f73..d76158a4b5e 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -52,7 +52,7 @@ assert(!waldoRegex.test('Somewhere is hiding in this text.')); Du solltest mit deinem Regex einen literalen String-Match durchführen. ```js -assert(!/\/.*\/i/.test(code)); +assert(!/\/.*\/i/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md index 05c2fd4b754..3de08c4c33e 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md @@ -27,13 +27,13 @@ assert(result === 'Hello, World!'); Deine Lösung sollte nicht die Methode `String.prototype.trim()` verwenden. ```js -assert(!code.match(/\.?[\s\S]*?trim/)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?trim/)); ``` Der Variable `result` sollte nicht direkt ein String zugewiesen werden. ```js -assert(!code.match(/result\s*=\s*["'`].*?["'`]/)); +assert(!__helpers.removeJSComments(code).match(/result\s*=\s*["'`].*?["'`]/)); ``` Der Wert der Variable `hello` sollte nicht geändert werden. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md index 32e29591e15..6bb050fe00e 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md @@ -37,7 +37,7 @@ Schreibe einen regulären Ausdruck `fixRegex` mit drei Erfassungsgruppen, der na Du solltest `.replace()` für das Suchen und Ersetzen verwenden. ```js -assert(code.match(/\.replace\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.replace\(.*\)/)); ``` Dein regulärer Ausdruck sollte den String `one two three` in den String `three two one` ändern. @@ -49,7 +49,7 @@ assert(result === 'three two one'); Du solltest die letzte Zeile nicht ändern. ```js -assert(code.match(/result\s*=\s*str\.replace\(.*?\)/)); +assert(__helpers.removeJSComments(code).match(/result\s*=\s*str\.replace\(.*?\)/)); ``` `fixRegex` sollte mindestens drei Erfassungsgruppen verwenden. diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md index 80b6afc6c8d..677aa1c214d 100644 --- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md +++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md @@ -31,7 +31,7 @@ Wende den Regex `myRegex` auf den String `myString` mit der Methode `.test()` an Du solltest `.test()` verwenden, um den Regex zu testen. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` Dein Ergebnis sollte `true` zurückgeben. diff --git a/curriculum/challenges/german/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md b/curriculum/challenges/german/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md index 23adf99dd94..ca550ea6099 100644 --- a/curriculum/challenges/german/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md +++ b/curriculum/challenges/german/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md @@ -15,12 +15,9 @@ You should have `if number >= 10:` within the `for` loop. ```js ({ - test: () => { - const transformedCode = code.replace(/\r/g, ""); - const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); - const { function_body } = verify_card_number; - - assert.match(function_body, /if +number +>= +10:/); + test: () => + { + assert(runPython(`_Node(_code).find_function("verify_card_number").find_for_loops()[1].find_ifs()[0].find_conditions()[0].is_equivalent("number >= 10")`)); } }) ``` diff --git a/curriculum/challenges/german/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md b/curriculum/challenges/german/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md index 835f24c9789..e2a7cc17679 100644 --- a/curriculum/challenges/german/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md +++ b/curriculum/challenges/german/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md @@ -115,7 +115,10 @@ from importlib import reload reload(probability_calculator) probability_calculator.random.seed(95) -def test_hat_draw(self): + +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw(self): hat = probability_calculator.Hat(red=5,blue=2) actual = hat.draw(2) expected = ['blue', 'red'] @@ -140,6 +143,49 @@ t.result.wasSuccessful() }); ``` +The `draw` method should behave correctly when the number of balls to extract is bigger than the number of balls in the hat. + +```js +({ + test: () => { + pyodide.FS.writeFile("/home/pyodide/probability_calculator.py", code); + pyodide.FS.writeFile( + "/home/pyodide/test_module.py", + ` +import unittest +import probability_calculator +from importlib import reload + +reload(probability_calculator) + +probability_calculator.random.seed(95) +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw_2(self): + hat = probability_calculator.Hat(yellow=5,red=1,green=3,blue=9,test=1) + actual = hat.draw(20) + expected = ['yellow', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'green', 'green', 'green', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'test'] + self.assertEqual(actual, expected, 'Expected hat draw to return all items from hat contents.') + actual = len(hat.contents) + expected = 0 + self.assertEqual(actual, expected, 'Expected hat draw to leave no items in contents.') + ` + ); + const testCode = ` +from unittest import main +import test_module +from importlib import reload + +reload(test_module) +t = main(module='test_module', exit=False) +t.result.wasSuccessful() +`; + const out = __pyodide.runPython(testCode); + assert(out); + }, +}); +``` + The `experiment` method should return a different probability. @@ -221,7 +267,8 @@ class Hat: def draw(self, number): drawn = [] if number >= len(self.contents): - return self.contents + drawn.extend(self.contents) + self.contents = [] else: for i in range(number): drawn.append( @@ -229,8 +276,7 @@ class Hat: ) return drawn -def experiment(hat, expected_balls, num_balls_drawn, num_experiments): - +def experiment(hat, expected_balls, num_balls_drawn, num_experiments): expected_balls_list = [] drawn_list = [] success = 0 @@ -248,12 +294,7 @@ def experiment(hat, expected_balls, num_balls_drawn, num_experiments): except: continue if len(exp_ball_list_copy) == 0: - success += 1 - - - - - probability = success/num_experiments - + success += 1 + probability = success/num_experiments return probability ``` diff --git a/curriculum/challenges/german/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md b/curriculum/challenges/german/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md index 19ea0d3c265..397f8d13d67 100644 --- a/curriculum/challenges/german/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md +++ b/curriculum/challenges/german/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md @@ -48,9 +48,9 @@ The initial declaration of the `homeworkStack` should not be changed. ```js assert( - code.match(/=/g).length === 1 && + __helpers.removeJSComments(code).match(/=/g).length === 1 && /homeworkStack\s*=\s*\["BIO12"\s*,\s*"HIS80"\s*,\s*"MAT122"\s*,\s*"PSY44"\]/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/german/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md b/curriculum/challenges/german/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md index 19a645d0d73..574ab3b09a4 100644 --- a/curriculum/challenges/german/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md +++ b/curriculum/challenges/german/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md @@ -2,7 +2,6 @@ id: 5f356ed60a5decd94ab66986 title: Schritt 22 challengeType: 0 -removeComments: false dashedName: step-22 --- diff --git a/curriculum/challenges/german/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md b/curriculum/challenges/german/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md index e92d029c74b..e8c257c1b11 100644 --- a/curriculum/challenges/german/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md +++ b/curriculum/challenges/german/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md @@ -40,15 +40,15 @@ assert(canvasFilter === 'blur(2px)'); ## --seed-contents-- ```css +--fcc-editable-region-- .canvas { width: 500px; height: 600px; background-color: #4d0f00; overflow: hidden; ---fcc-editable-region-- ---fcc-editable-region-- } +--fcc-editable-region-- .frame { border: 50px solid black; diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md index 9cdc69f8e77..f58ef268792 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md @@ -7,7 +7,7 @@ dashedName: step-55 # --description-- -Inside, the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. +Inside the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. Now, you should see a category displayed underneath each post topic. diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md index e8dca429e2c..bf6de970c79 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md @@ -7,9 +7,11 @@ dashedName: step-43 # --description-- -Beachte, dass der Wert `10` am Anfang des Arrays steht. Dies liegt daran, dass das Standardverhalten von `.sort()` bewirkt, dass die Werte in Strings umwandelt und alphabetisch sortiert werden. Und `10` steht alphabetisch vor `2`. +Notice how the number `10` is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the numbers values to strings, and sort them alphabetically. Und `10` steht alphabetisch vor `2`. -Um dies zu beheben, kannst du der `.sort()`-Methode eine Callback-Funktion übergeben. The callback function has two parameters - for yours, use `a` and `b`. Lasse die Funktion vorerst leer. +Um dies zu beheben, kannst du der `.sort()`-Methode eine Callback-Funktion übergeben. The callback function has two parameters - for yours, use `a` and `b`. The parameters of `a` and `b` represent the number values in the array that will be sorted. + +Lasse die Funktion vorerst leer. # --hints-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md index 806cca7e7c8..3e6ff1d3df3 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md @@ -26,7 +26,7 @@ assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\( Deine Callback-Funktion sollte `a - b` zurückgeben. ```js -assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+a\s*-\s*b\s*;?\s*}\s*\)/); +assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+(?:parseInt)?(?:Number)?\(?a\)?\s*-\s*(?:parseInt)?(?:Number)?\(?b\)?\s*;?\s*}\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index ba72359f65d..aa29fe5e958 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -11,6 +11,8 @@ Deklariere in deiner `evalFormula` eine `idToText`-Arrow-Funktion, die einen `id Deine `idToText`-Funktion sollte das Ergebnis des Aufrufs von `.find()` für das `cells`-Array mit der Callback-Funktion zurückgeben, die einen `cell`-Parameter verwendet und `cell.id === id` zurückgibt. +Both of your functions should use implicit returns. + # --hints-- Du solltest eine `idToText`-Variable in deiner `evalFormula`-Funktion deklarieren. diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md index 57110b715a9..37487b1771c 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md @@ -23,13 +23,7 @@ Open up the console to see the result. # --hints-- -You should call `.repeat()` on your two `" "` strings. - -```js -assert.lengthOf(code.match(/" ".repeat/g), 2); -``` - -Your `" "` strings should be repeated `rowCount - rowNumber` times. +You should call `.repeat()` on your `" "` strings to repeat them `rowCount - rowNumber` times. ```js assert.equal(padRow(1, 3), " # "); diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md index 3306b1a478b..4170d3bd12b 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md @@ -3,7 +3,6 @@ id: 660f3ce51f70571e1c5227c8 title: Step 69 challengeType: 1 dashedName: step-69 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md index ea0a831040f..7a939244a7c 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md @@ -3,7 +3,6 @@ id: 660f3dd626be3a1ffe27e5d1 title: Step 70 challengeType: 1 dashedName: step-70 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md index e30d808ccb6..b676558ec74 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md @@ -3,7 +3,6 @@ id: 660f4f79e2a82a4e92290f44 title: Step 101 challengeType: 1 dashedName: step-101 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md index dc683e61ce5..3f088de2c91 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md @@ -3,7 +3,6 @@ id: 660f53ad3d39175c5d4335ac title: Step 108 challengeType: 1 dashedName: step-108 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md new file mode 100644 index 00000000000..286128cc2cf --- /dev/null +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md @@ -0,0 +1,74 @@ +--- +id: 662693f82c91a66be46c881b +title: Step 1 +challengeType: 1 +dashedName: step-1 +--- + +# --description-- + +A teacher has finished grading their students' tests and needs your help to calculate the average score for the class. + +Complete the `getAverage` function which takes in an array of test scores and returns the average score. + +The average is calculated by adding up all the scores and dividing by the total number of scores. + +```js +average = sum of all scores / total number of scores +``` + +A couple of function calls have been provided for you so you can test out your code. + +**Tips** + +- You can use a loop to iterate over the `scores` array and add up all the scores. +- You can use the `length` property to get the total number of scores. + +# --hints-- + +Your `getAverage` function should return a number. + +```js +assert.strictEqual(typeof getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 'number'); +``` + +`getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])` should return `71.7`. + +```js +assert.strictEqual(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 71.7); +``` + +`getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])` should return `85.4`. + +```js +assert.strictEqual(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]), 85.4); +``` + +`getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100])` should return `92.4`. + +```js +assert.strictEqual(getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100]), 92.4); +``` + +Your `getAverage` function should return the average score of the test scores. + +```js +assert.strictEqual(getAverage([52, 56, 60, 65, 70, 75, 80, 85, 90, 95]), 72.8); +assert.strictEqual(getAverage([45, 50, 55, 60, 65, 70, 75, 80, 85, 90]), 67.5); +assert.strictEqual(getAverage([38, 42, 46, 50, 54, 58, 62, 66, 70, 74]), 56); +``` + +# --seed-- + +## --seed-contents-- + +```js +--fcc-editable-region-- +function getAverage(scores) { + +} + +console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])); +console.log(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md new file mode 100644 index 00000000000..f7e9253a5a5 --- /dev/null +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md @@ -0,0 +1,104 @@ +--- +id: 6626a060c4006f793e10cb33 +title: Step 2 +challengeType: 1 +dashedName: step-2 +--- + +# --description-- + +Now the teacher needs your help converting the student score to a letter grade. + +Complete the `getGrade` function that takes a number `score` as a parameter. Your function should return a string representing a letter grade based on the score. + +Here are the scores and their corresponding letter grades: + +| Score Range | Grade | +| ----------- | ------- | +| `100` | `"A++"` | +| `90 - 99` | `"A"` | +| `80 - 89` | `"B"` | +| `70 - 79` | `"C"` | +| `60 - 69` | `"D"` | +| `0 - 59` | `"F"` | + + +**Tips** + +- Remember that you learned about conditional statements(`if`, `else if`, and `else`). +- Remember that you learned about comparison operators (`>`, `<`, `>=`, `<=`, `===`). + +# --hints-- + +Your `getGrade` function should return `"A++"` if the score is `100`. + +```js +assert.strictEqual(getGrade(100), "A++"); +``` + +Your `getGrade` function should return `"A"` if the score is `94`. + +```js +assert.strictEqual(getGrade(94), "A"); +``` + +Your `getGrade` function should return `"B"` if the score is between `80` and `89`. + +```js +assert.strictEqual(getGrade(80), "B"); +assert.strictEqual(getGrade(83), "B"); +assert.strictEqual(getGrade(88), "B"); +``` + +Your `getGrade` function should return `"C"` if the score is `78`. + +```js +assert.strictEqual(getGrade(75), "C"); +``` + +Your `getGrade` function should return `"D"` if the score is between `60` and `69`. + +```js +assert.strictEqual(getGrade(60), "D"); +assert.strictEqual(getGrade(63), "D"); +assert.strictEqual(getGrade(68), "D"); +``` + +Your `getGrade` function should return `"F"` if the score is `57`. + +```js +assert.strictEqual(getGrade(57), "F"); +``` + +Your `getGrade` function should return `"F"` if the score is between `0` and `59`. + +```js +assert.strictEqual(getGrade(0), "F"); +assert.strictEqual(getGrade(30), "F"); +assert.strictEqual(getGrade(43), "F"); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} +--fcc-editable-region-- +function getGrade(score) { + +} + +console.log(getGrade(96)); +console.log(getGrade(82)); +console.log(getGrade(56)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md new file mode 100644 index 00000000000..b168e1325fc --- /dev/null +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md @@ -0,0 +1,88 @@ +--- +id: 6626b4c58c027d86478ff5eb +title: Step 3 +challengeType: 1 +dashedName: step-3 +--- + +# --description-- + +The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an `"F"`. + +Complete the function `hasPassingGrade` that takes a student score as a parameter. Your function should return `true` if the student has a passing grade and `false` if they do not. + +**Tips** + +- Use the `getGrade` function to get the student's grade. Then check if the grade is passing or not. + +# --hints-- + +Your `hasPassingGrade` function should return a boolean value. + +```js +assert.strictEqual(typeof hasPassingGrade(100), "boolean"); +``` + +Your `hasPassingGrade` function should return `true` if the grade is an `"A"`. + +```js +assert.isTrue(hasPassingGrade(100)); +``` + +Your `hasPassingGrade` function should return `false` if the grade is an `"F"`. + +```js +assert.isFalse(hasPassingGrade(53)); +``` + +Your `hasPassingGrade` function should return `true` for all passing grades. + +```js +assert.isTrue(hasPassingGrade(87)); +assert.isTrue(hasPassingGrade(60)); +assert.isTrue(hasPassingGrade(73)); +assert.isTrue(hasPassingGrade(96)); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +--fcc-editable-region-- +function hasPassingGrade(score) { + +} + + +console.log(hasPassingGrade(100)); +console.log(hasPassingGrade(53)); +console.log(hasPassingGrade(87)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md new file mode 100644 index 00000000000..08ee3cea27b --- /dev/null +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md @@ -0,0 +1,143 @@ +--- +id: 6626b8dcf5057f896f948440 +title: Step 4 +challengeType: 1 +dashedName: step-4 +--- + +# --description-- + +Now that the teacher has all of the information they need, they want to be able to message the student with the results. + +Complete the `studentMsg` function with `totalScores` and `studentScore` for parameters. The function should return a string representing a message to the student. + +If the student passed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You passed the course. +``` + +If the student failed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You failed the course. +``` + +Replace `average-goes-here` with the average of the total scores. Replace `grade-goes-here` with the student's grade. + +**Tips** + +- Use the `getAverage` function to get the class average. +- Use the `getGrade` function to get the student's grade. +- Use string concatenation (`+`) to build the message. +- Be careful with the punctuation and spaces in the message. + +# --hints-- + +Your function call of `studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)` should return the following message: `"Class average: 71.7. Your grade: F. You failed the course."`. + +```js +assert.strictEqual(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37), "Class average: 71.7. Your grade: F. You failed the course."); +``` + +Your function call of `studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)` should return the following message: `"Class average: 50.8. Your grade: A++. You passed the course."`. + +```js +assert.strictEqual(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100), "Class average: 50.8. Your grade: A++. You passed the course."); +``` + +Your `studentMsg` function should return a the correct message based on the student's score and the class average. + +```js +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 92), "Class average: 70.25. Your grade: A. You passed the course."); +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 57), "Class average: 70.25. Your grade: F. You failed the course."); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +--fcc-editable-region-- +function studentMsg(totalScores, studentScore) { + +} +console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)); +--fcc-editable-region-- + +``` + + +# --solutions-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +function studentMsg(totalScores, studentScore) { + let average = getAverage(totalScores); + let grade = getGrade(studentScore); + + return `Class average: ${average}. Your grade: ${grade}. You ${ + hasPassingGrade(studentScore) ? "passed" : "failed" + } the course.`; +} + +``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md index 37d189fcd56..2f86cf5716a 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md @@ -87,7 +87,7 @@ assert(confirmEnding('Abstraction', 'action') === true); Il tuo codice non dovrebbe utilizzare il metodo integrato `.endsWith()` per risolvere la sfida. ```js -assert(!/\.endsWith\(.*?\)\s*?;?/.test(code) && !/\['endsWith'\]/.test(code)); +assert(!/\.endsWith\(.*?\)\s*?;?/.test(__helpers.removeJSComments(code)) && !/\['endsWith'\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md index 48cd6ae5187..0532ac520f7 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md @@ -51,7 +51,7 @@ assert(repeatStringNumTimes('abc', -2) === ''); Il metodo integrato `repeat()` non dovrebbe essere usato. ```js -assert(!/\.repeat/g.test(code)); +assert(!/\.repeat/g.test(__helpers.removeJSComments(code))); ``` `repeatStringNumTimes("abc", 0)` dovrebbe restituire `""`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md index 6452118fc0c..b58a2a99521 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md @@ -53,19 +53,19 @@ assert.deepEqual( La funzione `htmlColorNames` dovrebbe utilizzare il metodo `splice()` ```js -assert(/.splice/.test(code)); +assert(/.splice/.test(__helpers.removeJSComments(code))); ``` Non dovresti usare `shift()` o `unshift()`. ```js -assert(!/shift|unshift/.test(code)); +assert(!/shift|unshift/.test(__helpers.removeJSComments(code))); ``` Non dovresti utilizzare la notazione a parentesi. ```js -assert(!/\[\d\]\s*=/.test(code)); +assert(!/\[\d\]\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md index 99c70473a18..d5a7071fa19 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md @@ -85,8 +85,8 @@ The definition of the `foods` object should not be changed. ```js assert( - code.search(/let foods/) === -1 && - code.search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ + __helpers.removeJSComments(code).search(/let foods/) === -1 && + __helpers.removeJSComments(code).search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ ) !== -1 ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md index 322d94ae6d7..3a0b9a60eed 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md @@ -27,7 +27,7 @@ Non dovresti accedere direttamente all'oggetto `users` ```js -assert(code.match(/users/gm).length <= 2) +assert(__helpers.removeJSComments(code).match(/users/gm).length <= 2) ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index 1cdaccd834b..90c054db5b8 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ La funzione `copyMachine` dovrebbe utilizzare lo `spread operator` (operatore di propagazione) con l'array `arr` ```js -assert(code.match(/\.\.\.\s*arr/)); +assert(__helpers.removeJSComments(__helpers.removeJSComments(code)).match(/\.\.\.\s*arr/)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md index 28a95d6686e..9f998ae1f4e 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md @@ -38,7 +38,7 @@ assert.deepEqual( La funzione `forecast` dovrebbe utilizzare il metodo `slice()` ```js -assert(/\.slice\(/.test(code)); +assert(/\.slice\(/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index 4bc572d4c24..662119ed035 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -51,7 +51,7 @@ La funzione `countOnline` dovrebbe utilizzare un'istruzione `for in` per iterare ```js assert( - code.match( + __helpers.removeJSComments(code).match( /for\s*\(\s*(var|let|const)\s+[a-zA-Z_$]\w*\s+in\s+[a-zA-Z_$]\w*\s*\)/ ) ); diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md index 4be929b631e..74b934f7203 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md @@ -61,7 +61,7 @@ assert(userActivity.data.online === 45); La proprietà `online` dovrebbe essere impostata usando la notazione a punti o a parentesi. ```js -assert.strictEqual(code.search(/online: 45/), -1); +assert.strictEqual(__helpers.removeJSComments(code).search(/online: 45/), -1); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md index 3191500b290..e341729635d 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md @@ -40,7 +40,7 @@ Non devi cambiare la riga originale `const arr = [2, 4, 5, 1, 7, 5, 2, 1];`. ```js assert( - __helpers.removeWhiteSpace(code).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) ); ``` @@ -56,14 +56,14 @@ assert.strictEqual( Il tuo codice dovrebbe utilizzare il metodo `splice()` su `arr`. ```js -assert(__helpers.removeWhiteSpace(code).match(/arr\.splice\(/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(/)); ``` Splice dovrebbe solo rimuovere elementi da `arr` e non aggiungere altri elementi a `arr`. ```js assert( - !__helpers.removeWhiteSpace(code).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) + !__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md index 8ee15f0d074..e6b6aac9d68 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md @@ -39,9 +39,9 @@ Le chiavi `oranges`, `plums` e `strawberries` dovrebbero essere rimosse usando ` ```js assert( - code.search(/oranges:/) !== -1 && - code.search(/plums:/) !== -1 && - code.search(/strawberries:/) !== -1 + __helpers.removeJSComments(code).search(/oranges:/) !== -1 && + __helpers.removeJSComments(code).search(/plums:/) !== -1 && + __helpers.removeJSComments(code).search(/strawberries:/) !== -1 ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md index 2aa00ea15db..ba6e6beaaa4 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md @@ -54,7 +54,7 @@ Dovresti accedere ai dati nella variabile `myArray` usando la notazione a parent ```js assert( (function () { - if (code.match(/\s*=\s*myArray\[0\]/g)) { + if (__helpers.removeJSComments(code).match(/\s*=\s*myArray\[0\]/g)) { return true; } else { return false; diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md index 13e8a1e89ad..b5616b3f66e 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md @@ -45,7 +45,7 @@ assert(myData === 8); Dovresti usare la notazione parentesi per leggere il valore corretto da `myArray`. ```js -assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code))); +assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md index a27ebc2efdd..00a995a77d2 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md @@ -54,7 +54,7 @@ assert(secondTree === 'pine'); Il tuo codice dovrebbe utilizzare la notazione a punti e parentesi per accedere a `myPlants`. ```js -assert(/=\s*myPlants\[1\].list\[1\]/.test(code)); +assert(/=\s*myPlants\[1\].list\[1\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md index 447f7067b7f..5f4dc96529a 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md @@ -64,7 +64,7 @@ assert(drinkValue === 'water'); Dovresti usare due volte la notazione a parentesi ```js -assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md index 46633fa24c5..ac63e834370 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md @@ -60,7 +60,7 @@ assert(shirtValue === 'jersey'); Dovresti usare due volte la notazione a punti ```js -assert(code.match(/testObj\.\w+/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\.\w+/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md index a5458ae077e..5a7cb067580 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md @@ -56,19 +56,19 @@ assert(player === 'Montana'); Dovresti usare la notazione a parentesi per accedere a `testObj` ```js -assert(/testObj\s*?\[.*?\]/.test(code)); +assert(/testObj\s*?\[.*?\]/.test(__helpers.removeJSComments(code))); ``` Non dovresti assegnare direttamente il valore `Montana` alla variabile `player`. ```js -assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); +assert(!__helpers.removeJSComments(code).match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); ``` Dovresti usare la variabile `playerNumber` nella notazione a parentesi ```js -assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code)); +assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md index e2c379658ed..ff8e0274631 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md @@ -53,7 +53,7 @@ assert(myDog.bark !== undefined); Non dovresti aggiungere `bark` all'inizializzazione di `myDog`. ```js -assert(!/bark[^\n]:/.test(code)); +assert(!/bark[^\n]:/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md index 5c51addbbfe..b421b6c4ff2 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md @@ -38,7 +38,7 @@ assert(sum === 20); Dovresti usare l'operatore `+`. ```js -assert(/\+/.test(code)); +assert(/\+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md index 601d3e6c715..3e7e33c0de2 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md @@ -71,7 +71,7 @@ assert(switchOfStuff(4) === 'stuff'); Non dovresti usare alcuna dichiarazione `if` o `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Dovresti usare un'istruzione `default` @@ -83,7 +83,7 @@ assert(switchOfStuff('string-to-trigger-default-case') === 'stuff'); Dovresti avere almeno altre 3 `break` istruzioni ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md index 64d7c32aad7..b0039af1139 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md @@ -36,7 +36,7 @@ assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2); Dovresti aggiungere `someAdjective` a `myStr` usando l'operatore `+=`. ```js -assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md index b5b6bb9c278..8bfa241a4ce 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md @@ -29,7 +29,7 @@ Assegna il contenuto di `a` alla variabile `b`. Non dovresti modificare il codice sopra il commento specificato. ```js -assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code))); ``` `b` dovrebbe avere un valore di `7`. @@ -41,7 +41,7 @@ assert(typeof b === 'number' && b === 7); `a` dovrebbe essere assegnato a `b` con `=`. ```js -assert(/b\s*=\s*a\s*/g.test(code)); +assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md index 4d78ce1e4d8..789718da714 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md @@ -34,7 +34,7 @@ assert(processed === 2); Dovresti assegnare `processArg` a `processed` ```js -assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code)); +assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md index baefbadef73..3e997a55199 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md @@ -39,19 +39,19 @@ Scrivi delle istruzioni `if`/`else if` concatenate per soddisfare le seguenti co Dovresti avere almeno quattro istruzioni `else` ```js -assert(code.match(/else/g).length > 3); +assert(__helpers.removeJSComments(code).match(/else/g).length > 3); ``` Dovresti avere almeno quattro istruzioni `if` ```js -assert(code.match(/if/g).length > 3); +assert(__helpers.removeJSComments(code).match(/if/g).length > 3); ``` Dovresti avere almeno un'istruzione `return` ```js -assert(code.match(/return/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/return/g).length >= 1); ``` `testSize(0)` dovrebbe restituire la stringa `Tiny` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index 03049dd1c32..108832b41b4 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -2,7 +2,6 @@ id: bd7123c9c441eddfaeb4bdef title: Commentare il codice JavaScript challengeType: 1 -removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' forumTopicId: 16783 dashedName: comment-your-javascript-code diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index 8cd6b4006b5..68e0a72de8d 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -58,7 +58,7 @@ assert(testEqual('12') === 'Equal'); Dovresti usare l'operatore `==` ```js -assert(code.match(/==/g) && !code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/==/g) && !__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index 0d475942290..abaddfcfd38 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -73,7 +73,7 @@ assert(testGreaterThan(150) === 'Over 100'); Dovresti utilizzare l'operatore `>` almeno due volte ```js -assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index 5b849e2dad7..947d02085cd 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -73,7 +73,7 @@ assert(testGreaterOrEqual(21) === '20 or Over'); Dovresti utilizzare l'operatore `>=` almeno due volte ```js -assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index 5605fd06307..f4d4c6a24f8 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -60,7 +60,7 @@ assert(testNotEqual('bob') === 'Not Equal'); Dovresti utilizzare l'operatore `!=` ```js -assert(code.match(/(?!!==)!=/)); +assert(__helpers.removeJSComments(code).match(/(?!!==)!=/)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index 6d2e1858daa..d2a53bb187d 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -66,7 +66,7 @@ assert(testLessThan(99) === '55 or Over'); Dovresti utilizzare l'operatore `<` almeno due volte ```js -assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index 798bdf9aeb2..8683a740cce 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -72,7 +72,7 @@ assert(testLessOrEqual(55) === 'More Than 24'); Dovresti utilizzare l'operatore `<=` almeno due volte ```js -assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index 154ab69983f..7e26a6e91fc 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -49,7 +49,7 @@ assert(testStrict('7') === 'Not Equal'); Dovresti usare l'operatore `===` ```js -assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index 14425968d87..dd8ea4d343c 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -52,7 +52,7 @@ assert(testStrictNotEqual('bob') === 'Not Equal'); Dovresti usare l'operatore `!==` ```js -assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md index 5cfdd788d3c..ed64835ae37 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md @@ -40,13 +40,13 @@ Sostituisci i due if con una sola istruzione, utilizzando l’operatore `&&`, ch Dovresti utilizzare l'operatore `&&` una sola volta ```js -assert(code.match(/&&/g).length === 1); +assert(__helpers.removeJSComments(code).match(/&&/g).length === 1); ``` Dovresti avere una sola istruzione `if` ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalAnd(0)` dovrebbe restituire la stringa `No` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md index 9843afb1a1c..5050962fd3e 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md @@ -43,13 +43,13 @@ Combina le due istruzioni `if` in un'unica istruzione che restituisca la stringa Dovresti usare l'operatore `||` una sola volta ```js -assert(code.match(/\|\|/g).length === 1); +assert(__helpers.removeJSComments(code).match(/\|\|/g).length === 1); ``` Dovresti avere una sola istruzione `if` ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalOr(0)` dovrebbe restituire la stringa `Outside` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md index 4549ea2628c..073ad5d7eca 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md @@ -54,16 +54,16 @@ assert(c === 19); Dovresti usare l'operatore `+=` per ogni variabile. ```js -assert(code.match(/\+=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\+=/g).length === 3); ``` Non dovresti modificare il codice sopra il commento specificato. ```js assert( - /let a = 3;/.test(code) && - /let b = 17;/.test(code) && - /let c = 12;/.test(code) + /let a = 3;/.test(__helpers.removeJSComments(code)) && + /let b = 17;/.test(__helpers.removeJSComments(code)) && + /let c = 12;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md index 446a9a95641..9dbce7c28d1 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md @@ -48,16 +48,16 @@ assert(c === 3); Dovresti usare l'operatore `/=` per ogni variabile. ```js -assert(code.match(/\/=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\/=/g).length === 3); ``` Non dovresti modificare il codice sopra il commento specificato. ```js assert( - /let a = 48;/.test(code) && - /let b = 108;/.test(code) && - /let c = 33;/.test(code) + /let a = 48;/.test(__helpers.removeJSComments(code)) && + /let b = 108;/.test(__helpers.removeJSComments(code)) && + /let c = 33;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md index 5229214cda7..e76cf8a02b6 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md @@ -48,16 +48,16 @@ assert(c === 46); Dovresti usare l'operatore `*=` per ogni variabile. ```js -assert(code.match(/\*=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\*=/g).length === 3); ``` Non dovresti modificare il codice sopra il commento specificato. ```js assert( - /let a = 5;/.test(code) && - /let b = 12;/.test(code) && - /let c = 4\.6;/.test(code) + /let a = 5;/.test(__helpers.removeJSComments(code)) && + /let b = 12;/.test(__helpers.removeJSComments(code)) && + /let c = 4\.6;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md index 9604a3105b2..8befdc3b76b 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md @@ -48,14 +48,14 @@ assert(c === 2); Dovresti usare l'operatore `-=` per ogni variabile. ```js -assert(code.match(/-=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/-=/g).length === 3); ``` Non dovresti modificare il codice sopra il commento specificato. ```js assert( - /let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code) + /let a = 11;/.test(__helpers.removeJSComments(code)) && /let b = 9;/.test(__helpers.removeJSComments(code)) && /let c = 3;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md index 083c2b2f5cf..72da7cbc0e0 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md @@ -47,19 +47,19 @@ assert(myStr === 'This is the start. This is the end.'); Dovresti usare l'operatore `+` per costruire `myStr`. ```js -assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g)); +assert(__helpers.removeJSComments(code).match(/(["']).*\1\s*\+\s*(["']).*\2/g)); ``` `myStr` dovrebbe essere creato usando la parola chiave `const`. ```js -assert(/const\s+myStr/.test(code)); +assert(/const\s+myStr/.test(__helpers.removeJSComments(code))); ``` Dovresti assegnare il risultato alla variabile `myStr`. ```js -assert(/myStr\s*=/.test(code)); +assert(/myStr\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index 9a9485c55d8..0cf28698188 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -43,7 +43,7 @@ assert(myStr === 'This is the first sentence. This is the second sentence.'); Dovresti usare l'operatore `+=` per costruire `myStr`. ```js -assert(code.match(/myStr\s*\+=\s*(["']).*\1/g)); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*(["']).*\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md index 160c3c32415..73dc4c4b796 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md @@ -35,7 +35,7 @@ assert(typeof myName !== 'undefined' && myName.length > 2); Dovresti usare due operatori `+` per costruire `myStr` con `myName` al suo interno. ```js -assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); +assert(__helpers.removeJSComments(code).match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md index fb9839f6032..d2c4ac6a3d5 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md @@ -34,13 +34,13 @@ Inserisci i numeri dispari da 9 a 1 in `myArray` usando un ciclo `for`. Dovresti usare un ciclo `for` per questo. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` Dovresti usare il metodo array `push`. ```js -assert(code.match(/myArray.push/)); +assert(__helpers.removeJSComments(code).match(/myArray.push/)); ``` `myArray` dovrebbe essere uguale a `[9, 7, 5, 3, 1]`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md index 4f6f90441ac..e49c89aa0dd 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md @@ -37,7 +37,7 @@ Guarda l'esempio `ourName` qui sopra se sei bloccato. Dovresti dichiarare `myName` con la parola chiave `var` terminando con un punto e virgola ```js -assert(/var\s+myName\s*;/.test(code)); +assert(/var\s+myName\s*;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md index 54e13e9bb23..fa999d35386 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md @@ -38,25 +38,25 @@ assert(myVar === 10); `myVar = myVar - 1;` dovrebbe essere modificato. ```js -assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); ``` Non dovresti assegnare `10` a `myVar`. ```js -assert(!code.match(/myVar\s*=\s*10.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*10.*?;?/)); ``` Dovresti usare l'operatore `--` su `myVar`. ```js -assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code)); +assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(__helpers.removeJSComments(code))); ``` Non dovresti modificare il codice sopra il commento specificato. ```js -assert(/let myVar = 11;/.test(code)); +assert(/let myVar = 11;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md index 1ab4e1e7ad1..787c624bbf7 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md @@ -55,7 +55,7 @@ assert(typeof myDog === 'object' && myDog.tails === undefined); Non dovresti modificare il setup di `myDog`. ```js -assert(code.match(/"tails": 1/g).length > 0); +assert(__helpers.removeJSComments(code).match(/"tails": 1/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md index 561b95d1720..a0b5d018e48 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md @@ -26,13 +26,13 @@ assert(quotient === 2.2); Dovresti usare l'operatore `/` per dividere 4.4 per 2 ```js -assert(/4\.40*\s*\/\s*2\.*0*/.test(code)); +assert(/4\.40*\s*\/\s*2\.*0*/.test(__helpers.removeJSComments(code))); ``` La variabile quotient deve essere assegnata solo una volta ```js -assert(code.match(/quotient\s*=/g).length === 1); +assert(__helpers.removeJSComments(code).match(/quotient\s*=/g).length === 1); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md index 0739cc32c25..09d02fb6c57 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md @@ -35,7 +35,7 @@ assert(quotient === 2); Dovresti usare l'operatore `/`. ```js -assert(/\d+\s*\/\s*\d+/.test(code)); +assert(/\d+\s*\/\s*\d+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md index 9f0596847c2..da50b7bb818 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md @@ -36,7 +36,7 @@ I am a "double quoted" string inside "double quotes". Dovresti usare due virgolette doppie (`"`) e quattro virgolette doppie con escape (`\"`). ```js -assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2); +assert(__helpers.removeJSComments(code).match(/\\"/g).length === 4 && __helpers.removeJSComments(code).match(/[^\\]"/g).length === 2); ``` La variabile `myStr` dovrebbe contenere la stringa: `I am a "double quoted" string inside "double quotes".` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md index b77910146d2..58112471e07 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md @@ -29,8 +29,8 @@ Non dovresti cambiare le dichiarazioni della variabile nella sezione `// Setup`. ```js assert( - code.match(/let lastNameLength = 0;/) && - code.match(/const lastName = "Lovelace";/) + __helpers.removeJSComments(code).match(/let lastNameLength = 0;/) && + __helpers.removeJSComments(code).match(/const lastName = "Lovelace";/) ); ``` @@ -43,7 +43,7 @@ assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8); Dovresti ottenere la lunghezza di `lastName` utilizzando `.length` in questo modo: `lastName.length`. ```js -assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/)); +assert(__helpers.removeJSComments(code).match(/=\s*lastName\.length/g) && !__helpers.removeJSComments(code).match(/lastName\s*=\s*8/)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md index 831db975cc9..85c2afbc6f4 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md @@ -39,7 +39,7 @@ Imposta `remainder` pari al resto di `11` diviso per `3` utilizzando l'operatore La variabile `remainder` dovrebbe essere inizializzata ```js -assert(/(const|let|var)\s+?remainder/.test(code)); +assert(/(const|let|var)\s+?remainder/.test(__helpers.removeJSComments(code))); ``` Il valore di `remainder` dovrebbe essere `2` @@ -51,7 +51,7 @@ assert(remainder === 2); Dovresti utilizzare l'operatore `%` ```js -assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code)); +assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md index ef84c1aa3e6..343446e37c7 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md @@ -36,7 +36,7 @@ assert((randomFraction() + '').match(/\./g)); Dovresti usare `Math.random` per generare il numero decimale casuale. ```js -assert(code.match(/Math\.random/g).length >= 0); +assert(__helpers.removeJSComments(code).match(/Math\.random/g).length >= 0); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md index 306b0083fe7..089cee7571d 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md @@ -46,22 +46,22 @@ assert( Dovresti usare `Math.random` per generare un numero casuale. ```js -assert(code.match(/Math.random/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.random/g).length >= 1); ``` Dovresti moltiplicare il risultato di `Math.random` per 10 per ottenere un numero nell'intervallo tra zero e nove. ```js assert( - code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || - code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) + __helpers.removeJSComments(code).match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || + __helpers.removeJSComments(code).match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) ); ``` Dovresti usare `Math.floor` per rimuovere la parte decimale del numero. ```js -assert(code.match(/Math.floor/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.floor/g).length >= 1); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md index 7d3cc854dd0..1d274a95f47 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md @@ -49,10 +49,10 @@ assert(randomRange(0, 1) % 1 === 0); assert( (function () { if ( - code.match(/myMax/g).length > 1 && - code.match(/myMin/g).length > 2 && - code.match(/Math.floor/g) && - code.match(/Math.random/g) + __helpers.removeJSComments(code).match(/myMax/g).length > 1 && + __helpers.removeJSComments(code).match(/myMin/g).length > 2 && + __helpers.removeJSComments(code).match(/Math.floor/g) && + __helpers.removeJSComments(code).match(/Math.random/g) ) { return true; } else { diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md index 4e04af5fb1a..ce053cef66d 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md @@ -36,7 +36,7 @@ assert(myGlobal === 10); `myGlobal` dovrebbe essere dichiarata usando la parola chiave `let` o `const` ```js -assert(/(let|const)\s+myGlobal/.test(code)); +assert(/(let|const)\s+myGlobal/.test(__helpers.removeJSComments(code))); ``` `oopsGlobal` dovrebbe essere una variabile globale e avere un valore di `5` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md index 40cedbbfd81..2c507bce2f4 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md @@ -45,7 +45,7 @@ assert(myOutfit() === 'sweater'); Non dovresti cambiare l'istruzione return. ```js -assert(/return outerWear/.test(code)); +assert(/return outerWear/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md index a20c696babe..6c3e1c28e16 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md @@ -39,20 +39,20 @@ Non dovresti utilizzare l'operatore di assegnazione. ```js assert( - /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(code) + /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(__helpers.removeJSComments(code)) ); ``` Dovresti usare l'operatore `++`. ```js -assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code)); +assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(__helpers.removeJSComments(code))); ``` Non dovresti cambiare il codice sopra il commento specificato. ```js -assert(/let myVar = 87;/.test(code)); +assert(/let myVar = 87;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md index 35dcb3eb114..650c13d2f1b 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md @@ -26,7 +26,7 @@ Definisci una variabile `a` con `var` e inizializzala ad un valore di `9`. Dovresti inizializzare `a` ad un valore di `9`. ```js -assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code)); +assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md index 80564aa7295..c74b35a540b 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md @@ -30,20 +30,20 @@ Converti la logica per usare le istruzioni `else if`. Dovresti avere almeno due istruzioni `else` ```js -assert(code.match(/else/g).length > 1); +assert(__helpers.removeJSComments(code).match(/else/g).length > 1); ``` Dovresti avere almeno due istruzioni `if` ```js -assert(code.match(/if/g).length > 1); +assert(__helpers.removeJSComments(code).match(/if/g).length > 1); ``` Dovresti avere una parentesi graffa di apertura e una di chiusura per ogni blocco di codice `if else`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/ ) ); diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md index 640f3be83a4..a47822e2262 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md @@ -28,13 +28,13 @@ Combina le istruzioni `if` in una singola istruzione `if/else`. Dovresti avere una sola istruzione `if` nell'editor ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` Dovresti usare una istruzione `else` ```js -assert(/else/g.test(code)); +assert(/else/g.test(__helpers.removeJSComments(code))); ``` `testElse(4)` dovrebbe restituire la stringa `5 or Smaller` @@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5'); Non dovresti modificare il codice sopra o sotto i commenti specificati. ```js -assert(/let result = "";/.test(code) && /return result;/.test(code)); +assert(/let result = "";/.test(__helpers.removeJSComments(code)) && /return result;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md index 02f2ac569b1..fe811813377 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md @@ -32,7 +32,7 @@ Inserisci i numeri dispari da 1 a 9 in `myArray` usando un ciclo `for`. Dovresti usare un ciclo `for`. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` dovrebbe essere uguale a `[1, 3, 5, 7, 9]`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md index 5be90a8aae7..08738899c1b 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md @@ -30,7 +30,7 @@ Dichiara una variabile `total` e inizializzala a `0`. Usa un ciclo `for` per som `total` dovrebbe essere dichiarato e inizializzato a 0. ```js -assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); ``` `total` dovrebbe essere uguale a 20. @@ -42,13 +42,13 @@ assert(total === 20); Dovresti usare un ciclo `for` per iterare attraverso `myArr`. ```js -assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code)); +assert(/for\s*\(/g.test(__helpers.removeJSComments(code)) && /myArr\s*\[/g.test(__helpers.removeJSComments(code))); ``` Non dovresti tentare di assegnare direttamente il valore 20 a `total`. ```js -assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm)); +assert(!__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/total[=+-]0*[1-9]+/gm)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md index 84aa88652db..8f63469d0f5 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md @@ -56,7 +56,7 @@ Cambia il ciclo `while` nel codice con un ciclo `do...while` in modo che il cicl Dovresti usare un ciclo `do...while` per questo esercizio. ```js -assert(code.match(/do/g)); +assert(__helpers.removeJSComments(code).match(/do/g)); ``` `myArray` dovrebbe essere uguale a `[10]`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md index 46a73d0507d..3169be66ae4 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md @@ -44,7 +44,7 @@ Usa un ciclo `for` per inserire i valori da 1 a 5 in `myArray`. Dovresti usare un ciclo `for`. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` dovrebbe essere uguale a `[1, 2, 3, 4, 5]`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md index 0aa2bb494ee..c78ffd1d699 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md @@ -36,7 +36,7 @@ Aggiungi i numeri da 5 a 0 (inclusi) in ordine decrescente a `myArray` utilizzan Dovresti usare un ciclo `while`. ```js -assert(code.match(/while/g)); +assert(__helpers.removeJSComments(code).match(/while/g)); ``` `myArray` dovrebbe essere uguale a `[5, 4, 3, 2, 1, 0]`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index 0f00c407bc3..2c2d470a96d 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -48,7 +48,7 @@ Dovresti aggiungere una variabile locale `myVar`. ```js assert( /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( - __helpers.removeWhiteSpace(code) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)) ) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md index a9083c34217..9bbc9cc7039 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md @@ -47,7 +47,7 @@ assert( Dovresti usare `pop()` su `myArray`. ```js -assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code)); +assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(__helpers.removeJSComments(code))); ``` `removedFromMyArray` dovrebbe contenere solo `["cat", 2]`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md index f88063fda3d..091ae4e8f42 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md @@ -52,7 +52,7 @@ Dovresti usare l'indice corretto per modificare il valore in `myArray`. ```js assert( (function () { - if (code.match(/myArray\[0\]\s*=\s*/g)) { + if (__helpers.removeJSComments(code).match(/myArray\[0\]\s*=\s*/g)) { return true; } else { return false; diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md index 360bb423834..d57619e6ed8 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md @@ -94,13 +94,13 @@ assert(sequentialSizes(9) === 'High'); Non dovresti usare alcuna dichiarazione `if` o `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Dovresti avere nove dichiarazioni `case` ```js -assert(code.match(/case/g).length === 9); +assert(__helpers.removeJSComments(code).match(/case/g).length === 9); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md index ba1c14e1054..001dbc01217 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md @@ -28,7 +28,7 @@ assert(product === 5.0); Dovresti usare l'operatore `*` ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md index 4895a754e9e..9ee3f7bdcb8 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md @@ -36,7 +36,7 @@ assert(product === 80); Dovresti usare l'operatore `*`. ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md index ecd90d91bcd..bdf767c7040 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md @@ -60,7 +60,7 @@ Dovresti chiamare `functionWithArgs` con due numeri dopo averla definita. ```js assert( /functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test( - code.replace(/\s/g, '') + __helpers.removeJSComments(code).replace(/\s/g, '') ) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md index efea46c07c3..71effad1669 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md @@ -47,7 +47,7 @@ assert(compareEquality('20', 20) === 'Not Equal'); Dovresti usare l'operatore `===` ```js -assert(code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index 77eec1bd905..cba4350d218 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -47,7 +47,7 @@ Dovresti rimuovere tutte le barre rovesciate (`\`). ```js assert( - !/\\/g.test(code) && + !/\\/g.test(__helpers.removeJSComments(code)) && myStr.match( '\\s*\\s*Link\\s*\\s*' ) @@ -57,7 +57,7 @@ assert( Dovresti avere due virgolette singole `'` e quattro virgolette doppie `"`. ```js -assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2); +assert(__helpers.removeJSComments(code).match(/"/g).length === 4 && __helpers.removeJSComments(code).match(/'/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index a4299082318..2061c5a46a7 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,7 +66,7 @@ Il tuo codice non deve fare affidamento su alcun tipo di ciclo (`for` o `while` ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md index b4ef377b7ec..6c891a2fb55 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md @@ -45,19 +45,19 @@ Cambiare le istruzioni `if`/`else if` concatenate con un'istruzione `switch`. Non dovresti usare nessuna istruzione `else` nell'editor ```js -assert(!/else/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code))); ``` Non dovresti usare nessuna istruzione `if` nell'editor ```js -assert(!/if/g.test(code)); +assert(!/if/g.test(__helpers.removeJSComments(code))); ``` Dovresti avere almeno quattro istruzioni `break` ```js -assert(code.match(/break/g).length >= 4); +assert(__helpers.removeJSComments(code).match(/break/g).length >= 4); ``` `chainToSwitch("bob")` dovrebbe restituire la stringa `Marley` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md index ad1b8c9e4f9..02ec06c8994 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md @@ -52,7 +52,7 @@ assert(isLess(15, 10) === false); Non dovresti usare alcuna dichiarazione `if` o `else` ```js -assert(!/if|else/g.test(code)); +assert(!/if|else/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md index 9e5abb1fdd4..187db9cee3b 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md @@ -63,13 +63,13 @@ assert(caseInSwitch(4) === 'delta'); Non dovresti usare alcuna dichiarazione `if` o `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Dovresti avere almeno 3 istruzioni `break` ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md index da191dbe147..070930b18ef 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md @@ -35,7 +35,7 @@ Assegna il valore `7` alla variabile `a`. Non modificare il codice sopra il commento specificato. ```js -assert(/var a;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code))); ``` `a` dovrebbe avere un valore di 7. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md index 98bcfdccbe0..5e6145347e5 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md @@ -35,7 +35,7 @@ assert(difference === 12); Devi solo sottrarre un numero da `45`. ```js -assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code))); +assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md index 8e1e2e7ec25..e38100c9160 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md @@ -40,7 +40,7 @@ assert(myStr === 'Hello World'); Non modificare il codice sopra il commento specificato. ```js -assert(/myStr = "Jello World"/.test(code)); +assert(/myStr = "Jello World"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md index 7265f4bf64a..8c11fcdac5b 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md @@ -56,19 +56,19 @@ assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000); `studlyCapVar` dovrebbe usare camelCase sia nella sezione di dichiarazione che in quella di assegnazione. ```js -assert(code.match(/studlyCapVar/g).length === 2); +assert(__helpers.removeJSComments(code).match(/studlyCapVar/g).length === 2); ``` `properCamelCase` dovrebbe usare camelCase sia nella sezione di dichiarazione che in quella di assegnazione. ```js -assert(code.match(/properCamelCase/g).length === 2); +assert(__helpers.removeJSComments(code).match(/properCamelCase/g).length === 2); ``` `titleCaseOver` dovrebbe usare camelCase sia nella sezione di dichiarazione che in quella di assegnazione. ```js -assert(code.match(/titleCaseOver/g).length === 2); +assert(__helpers.removeJSComments(code).match(/titleCaseOver/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index 368f71db799..7e1368fb215 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -39,9 +39,9 @@ Non modificare il codice sotto il commento specificato. ```js assert( - /a = a \+ 1;/.test(code) && - /b = b \+ 5;/.test(code) && - /c = c \+ " String!";/.test(code) + /a = a \+ 1;/.test(__helpers.removeJSComments(code)) && + /b = b \+ 5;/.test(__helpers.removeJSComments(code)) && + /c = c \+ " String!";/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md index 27d8a790c03..3c8f7deeb76 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md @@ -39,7 +39,7 @@ assert(/happy coder/gi.test(myDog.name)); Non dovresti modificare la definizione di `myDog`. ```js -assert(/"name": "Coder"/.test(code)); +assert(/"name": "Coder"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md index cf5e2771641..57143d68856 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md @@ -41,7 +41,7 @@ assert(firstLetterOfLastName === 'L'); Dovresti usare la notazione a parentesi. ```js -assert(code.match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md index e19e3fe9fe3..2beab463364 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(lastLetterOfLastName === 'e'); Dovresti usare `.length` per ottenere l'ultima lettera. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md index 656b831ba86..7e30dff22a2 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md @@ -39,7 +39,7 @@ assert(thirdLetterOfLastName === 'v'); Dovresti usare la notazione a parentesi. ```js -assert(code.match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md index 9e288b6f467..d07c5a9fca6 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(secondToLastLetterOfLastName === 'c'); Dovresti usare `.length` per ottenere la penultima lettera. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md index 13585303218..2b26ef3d651 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md @@ -54,7 +54,7 @@ Nella funzione `checkSign` utilizza più operatori condizionali - seguendo il fo `checkSign` dovrebbe utilizzare più operatori condizionali ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(__helpers.removeJSComments(code))); ``` `checkSign(10)` dovrebbe restituire la stringa `positive`. Nota che la capitalizzazione conta diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index dd1c2796c0a..31192751bc3 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,7 +59,7 @@ Il tuo codice non dovrebbe basarsi su alcun tipo di ciclo (`for`, `while`o funzi ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index 1e51a4efc07..c27468254f0 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,7 +26,7 @@ Il codice non dovrebbe utilizzare alcun ciclo (`for` o `while` o funzioni di ord ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index 35b0db3af9f..101b730f5fc 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -42,7 +42,7 @@ Utilizzare l'operatore condizionale nella funzione `checkEqual` per verificare s `checkEqual` dovrebbe utilizzare l'operatore condizionale ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(__helpers.removeJSComments(code))); ``` `checkEqual(1, 2)` dovrebbe restituire la stringa `Not Equal` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md index a4001a6006b..2f55bcf7e29 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md @@ -34,7 +34,7 @@ Usa `parseInt()` nella funzione `convertToInteger` in modo che converta un numer `convertToInteger` dovrebbe utilizzare la funzione `parseInt()` ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("10011")` dovrebbe restituire un numero diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md index 3d11acc5080..6e4389445fd 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md @@ -26,7 +26,7 @@ Usa `parseInt()` nella funzione `convertToInteger` in modo che converta la serie `convertToInteger` dovrebbe utilizzare la funzione `parseInt()` ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("56")` dovrebbe restituire un numero diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md index 9b45036c530..4509146d121 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md @@ -83,14 +83,14 @@ assert(typeof phoneticLookup('') === 'undefined'); Non dovresti modificare l'istruzione `return` ```js -assert(code.match(/return\sresult;/)); +assert(__helpers.removeJSComments(code).match(/return\sresult;/)); ``` Non dovresti usare le istruzioni `case`, `switch`o `if` ```js assert( - !/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) + !/case|switch|if/g.test(__helpers.removeJSComments(code).replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md index dd129066d5c..abc0dad7954 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md @@ -53,7 +53,7 @@ assert( Non dovresti usare direttamente i valori `dog`, `ran`, `big` o `quickly` per creare `wordBlanks`. ```js -const newCode = removeAssignments(code); +const newCode = removeAssignments(__helpers.removeJSComments(code)); assert( !/dog/.test(newCode) && !/ran/.test(newCode) && diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md index 5461979838f..1cbb6e58ac7 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md @@ -50,7 +50,7 @@ Dovresti chiamare `reusableFunction` dopo averla definita. ```js const functionStr = reusableFunction && __helpers.removeWhiteSpace(reusableFunction.toString()); -const codeWithoutFunction = __helpers.removeWhiteSpace(code).replace(/reusableFunction\(\)\{/g, ''); +const codeWithoutFunction = __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).replace(/reusableFunction\(\)\{/g, ''); assert(/reusableFunction\(\)/.test(codeWithoutFunction)); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md index 03d28d4fece..bc98e4d34a6 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md @@ -25,7 +25,7 @@ assert(power == 8); Il tuo codice dovrebbe utilizzare l'ordine corretto degli argomenti per la chiamata della funzione `raiseToPower`. ```js -assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); +assert(__helpers.removeJSComments(code).match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md index bbdef1ac11f..c0849918670 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md @@ -37,7 +37,7 @@ assert(result == 9); Il tuo codice dovrebbe chiamare la funzione `getNine`. ```js -assert(code.match(/getNine\(\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/getNine\(\)/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md index ad97f1a027a..bf6889b8cd4 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md @@ -27,25 +27,25 @@ assert(netWorkingCapital === 2); Non ci dovrebbero essere casi di variabili scritte male nel codice. ```js -assert(!code.match(/recievables/g)); +assert(!__helpers.removeJSComments(code).match(/recievables/g)); ``` La variabile `receivables` dovrebbe essere dichiarata e utilizzata correttamente nel codice. ```js -assert(code.match(/receivables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/receivables/g).length == 2); ``` Non ci dovrebbero essere casi di variabili scritte male nel codice. ```js -assert(!code.match(/payable;/g)); +assert(!__helpers.removeJSComments(code).match(/payable;/g)); ``` La variabile `payables` dovrebbe essere dichiarata e utilizzata correttamente nel codice. ```js -assert(code.match(/payables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/payables/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index 1d966d3389d..1fed121a896 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -37,13 +37,13 @@ Correggi la stringa in modo da usare virgolette diverse per il valore `href` o f Il tuo codice dovrebbe correggere le virgolette intorno al valore `href` `#Home` cambiandole o facendone l'escaping. ```js -assert(code.match(//g)); +assert(__helpers.removeJSComments(code).match(//g)); ``` Il tuo codice dovrebbe mantenere le virgolette doppie intorno all'intera stringa. ```js -assert(code.match(/"

.*?<\/p>";/g)); +assert(__helpers.removeJSComments(code).match(/"

.*?<\/p>";/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md index 05ce9a2066a..f078399dc41 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md @@ -37,25 +37,25 @@ Correggi i due errori di indicizzazione nella funzione seguente così che tutti Il tuo codice dovrebbe impostare la condizione iniziale del ciclo in modo che inizi al primo indice. ```js -assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?=\s*?0\s*?;/g).length == 1); ``` Il tuo codice dovrebbe aggiustare la condizione iniziale del ciclo in modo che l'indice inizi da 0. ```js -assert(!code.match(/i\s?=\s*?1\s*?;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s?=\s*?1\s*?;/g)); ``` Il tuo codice dovrebbe impostare la condizione di chiusura del ciclo in modo che si interrompa all'ultimo indice. ```js -assert(code.match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); ``` Il tuo codice dovrebbe fissare la condizione di chiusura del ciclo in modo che si fermi a un passo dalla lunghezza. ```js -assert(!code.match(/i\s*?<=\s*?len;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?<=\s*?len;/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md index 37b1d7a4307..d9db9674a68 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md @@ -21,7 +21,7 @@ Correggi gli errori delle due coppie nel codice. Il tuo codice dovrebbe aggiungere la parte mancante dell'array. ```js -assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); +assert(__helpers.removeJSComments(code).match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); ``` Il tuo codice dovrebbe correggere la parte mancante del metodo `.reduce()`. L'output su console dovrebbe mostrare che `Sum of array values is: 6`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md index ef5e9b39f6b..d6b8224a7b6 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md @@ -43,7 +43,7 @@ assert(result == 'Not equal!'); La condizione dovrebbe usare `==` o `===` per verificare l'uguaglianza. ```js -assert(code.match(/x\s*?===?\s*?y/g)); +assert(__helpers.removeJSComments(code).match(/x\s*?===?\s*?y/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md index 13cf035dceb..241f9d2b95c 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md @@ -31,13 +31,13 @@ La funzione `myFunc()` contiene un ciclo infinito perché la condizione terminal Il tuo codice dovrebbe cambiare l'operatore di confronto nella condizione di chiusura (la parte centrale) del ciclo `for`. ```js -assert(code.match(/i\s*?<=\s*?4;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?<=\s*?4;/g).length == 1); ``` Il tuo codice dovrebbe aggiustare l'operatore di confronto nella condizione di chiusura del ciclo. ```js -assert(!code.match(/i\s*?!=\s*?4;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?!=\s*?4;/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index de636d96ead..9d2c849a293 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -23,7 +23,7 @@ Dopo questo, usa `console.log` per scrivere il valore della variabile `output` n Dovresti usare `console.log()` per visualizzare la variabile `output`. ```js -assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/console\.log\(output\)/)); ``` Dovresti usare `console.clear()` per cancellare la console del browser. @@ -31,7 +31,7 @@ Dovresti usare `console.clear()` per cancellare la console del browser. ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console.clear\(\)/) ); ``` @@ -41,7 +41,7 @@ Dovresti pulire la console con `console.clear` dopo il tuo log. ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console\.log\(output\)[\s\S]*console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md index 6739b505790..b13d74f22e0 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md @@ -29,7 +29,7 @@ Utilizza il metodo `console.log()` per visualizzare il valore della variabile `a Il tuo codice dovrebbe utilizzare `console.log()` per controllare il valore della variabile `a`. ```js -assert(code.match(/console\.log\(a\)/g)); +assert(__helpers.removeJSComments(code).match(/console\.log\(a\)/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md index 780546a7d78..4c8a0701f39 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md @@ -32,19 +32,19 @@ Aggiungi due istruzioni `console.log()` per controllare il `typeof` di ciascuna Il tuo codice dovrebbe utilizzare `typeof` in due istruzioni `console.log()` per controllare il tipo delle variabili. ```js -assert(code.match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); ``` Il tuo codice dovrebbe utilizzare `typeof` per controllare il tipo della variabile `seven`. ```js -assert(code.match(/typeof[\( ]seven\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]seven\)?/g)); ``` Il tuo codice dovrebbe utilizzare `typeof` per controllare il tipo della variabile `three`. ```js -assert(code.match(/typeof[\( ]three\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]three\)?/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index 9bae4052294..9e1f4cf5f07 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -87,13 +87,13 @@ Questo esercizio è progettato per illustrare la differenza tra il modo in cui l `var` non dovrebbe esistere nel codice. ```js -assert(!code.match(/var/g)); +assert(!__helpers.removeJSComments(code).match(/var/g)); ``` La variabile `i` dichiarata nell'istruzione `if` dovrebbe essere uguale alla stringa `block scope`. ```js -assert(code.match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); +assert(__helpers.removeJSComments(code).match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); ``` `checkScope()` dovrebbe restituire la stringa `function scope` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index 017515e93e2..ab4a2e61451 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,7 +32,7 @@ Fai sì che la promise gestisca il successo e il fallimento. Se `responseFromSer ```js assert( - code.match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) ); ``` @@ -40,7 +40,7 @@ assert( ```js assert( - code.match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md index 76658a61e04..3df1ae75006 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md @@ -32,7 +32,7 @@ La tua promise dovrebbe ricevere una funzione con `resolve` e `reject` come para ```js assert( - code.match( + __helpers.removeJSComments(code).match( /Promise\s*\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g ) ); diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md index 282e75c14ef..4aed63a2fb8 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md @@ -25,14 +25,14 @@ Aggiungi al documento HTML uno script di tipo `module` e dagli `index.js` come f Dovresti creare un tag `script`. ```js -assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); +assert(__helpers.removeJSComments(code).match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); ``` Il tuo tag `script` dovrebbe avere l'attributo `type` con un valore di `module`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g ) ); @@ -42,7 +42,7 @@ Il tuo tag `script` dovrebbe avere una `src` impostata su `index.js`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g ) ); diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md index 7fb83f25dd3..32480ca1f8b 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md @@ -38,7 +38,7 @@ Il tuo codice dovrebbe usare l'`export` di default. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g ) ); diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md index 231cf5a650f..7380858e1dd 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md @@ -75,7 +75,7 @@ assert.match(code, /(`.*\${.*}.*`)/); Dovresti usare un iteratore. ```js -assert(code.match(/for|map|reduce|forEach|while/)); +assert(__helpers.removeJSComments(code).match(/for|map|reduce|forEach|while/)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md index e9469010f92..2bfc0bce341 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md @@ -34,7 +34,7 @@ Dovresti chiamare il metodo `then` sulla promise. ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.then\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.then\(/g) ); ``` @@ -50,7 +50,7 @@ Dovresti scrivere `result` sulla console. assert( resultIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.then\(.*?result.*?console.log\(result\).*?\)/) ); ``` @@ -60,7 +60,7 @@ assert( ## --after-user-code-- ```js -const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(code)); +const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md index 50ceab32b64..7f89e477163 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md @@ -28,7 +28,7 @@ Dovresti chiamare il metodo `catch` sulla promise. ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.catch\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.catch\(/g) ); ``` @@ -44,7 +44,7 @@ Dovresti visualizzare `error` nella console. assert( errorIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.catch\(.*?error.*?console.log\(error\).*?\)/) ); ``` @@ -54,7 +54,7 @@ assert( ## --after-user-code-- ```js -const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(code)); +const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md index 1934aecd2ab..3d6d27dbc28 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md @@ -25,7 +25,7 @@ Nel codice seguente, importa l'esportazione predefinita dal file `math_functions Dovresti importare correttamente `subtract` da `math_functions.js`. ```js -assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); +assert(__helpers.removeJSComments(code).match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md index af7bf95d202..5147dd30bd8 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md @@ -36,19 +36,19 @@ Un array è dichiarato come `const s = [5, 7, 2]`. Cambia l'array in `[2, 5, 7]` Non dovresti sostituire la parola chiave `const`. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `s` dovrebbe essere una variabile costante (usando `const`). ```js -assert(code.match(/const\s+s/g)); +assert(__helpers.removeJSComments(code).match(/const\s+s/g)); ``` Non dovresti cambiare la dichiarazione originale dell'array. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g )); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md index ddab2d484af..114f12b8bbf 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md @@ -34,19 +34,19 @@ In questa sfida utilizzerai `Object.freeze` per impedire di cambiare le costanti Non dovresti sostituire la parola chiave `const`. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `MATH_CONSTANTS` dovrebbe essere una variabile costante (usando `const`). ```js -assert(code.match(/const\s+MATH_CONSTANTS/g)); +assert(__helpers.removeJSComments(code).match(/const\s+MATH_CONSTANTS/g)); ``` Non dovresti cambiare la dichiarazione originale di `MATH_CONSTANTS`. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g )); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md index f3df1e70ef9..1764cd11b6e 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md @@ -32,7 +32,7 @@ Dovresti importare correttamente `uppercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); @@ -42,7 +42,7 @@ Dovresti importare correttamente `lowercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index 211e498c46e..19b09f48511 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -44,7 +44,7 @@ assert(increment(5) === 6); Un parametro predefinito di valore `1` dovrebbe essere utilizzato per `value`. ```js -assert(code.match(/value\s*=\s*1/g)); +assert(__helpers.removeJSComments(code).match(/value\s*=\s*1/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md index cc050269a94..e3c989717df 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md @@ -31,7 +31,7 @@ Il tuo codice dovrebbe utilizzare correttamente la sintassi `import * as`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g ) ); diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index 9e0840bc4de..f409d5b587d 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -66,7 +66,7 @@ assert( Dovresti usare la parola chiave `class`. ```js -assert(code.match(/class/g)); +assert(__helpers.removeJSComments(code).match(/class/g)); ``` `Vegetable` dovrebbe poter essere istanziata. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md index 9752462bb62..2105fb14617 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md @@ -51,7 +51,7 @@ assert(b === 8); Dovresti usare la destrutturazione di array per scambiare `a` e `b`. ```js -assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code)); +assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index 3aa8e054ac0..8771df8edb6 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -43,8 +43,8 @@ Dovresti rimuovere la sintassi di assegnazione ES5. ```js assert( - !code.match(/lowToday = LOCAL_FORECAST\.today\.low/g) && - !code.match(/highToday = LOCAL_FORECAST\.today.high/g) + !__helpers.removeJSComments(code).match(/lowToday = LOCAL_FORECAST\.today\.low/g) && + !__helpers.removeJSComments(code).match(/highToday = LOCAL_FORECAST\.today.high/g) ); ``` @@ -52,7 +52,7 @@ Dovresti usare la destrutturazione per creare la variabile `lowToday`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(low\s*:\s*lowToday[^}]*|[^,]*,\s*low\s*:\s*lowToday\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); @@ -62,7 +62,7 @@ Dovresti usare la destrutturazione per creare la variabile `highToday`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday,?\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index db0e19671ba..110b8aeec1a 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -34,8 +34,8 @@ Dovresti rimuovere la sintassi di assegnazione ES5. ```js assert( - !code.match(/highToday = HIGH_TEMPERATURES\.today/g) && - !code.match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) + !__helpers.removeJSComments(code).match(/highToday = HIGH_TEMPERATURES\.today/g) && + !__helpers.removeJSComments(code).match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) ); ``` @@ -43,7 +43,7 @@ Dovresti usare la destrutturazione per creare la variabile `highToday`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(today\s*:\s*highToday[^}]*|[^,]*,\s*today\s*:\s*highToday\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); @@ -53,7 +53,7 @@ Dovresti usare la destrutturazione per creare la variabile `highTomorrow`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(tomorrow\s*:\s*highTomorrow[^}]*|[^,]*,\s*tomorrow\s*:\s*highTomorrow\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index b9272cbbeb0..d4334c5e5ae 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,7 +43,7 @@ Dovresti rimuovere la sintassi di assegnazione ES5. ```js assert( - !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !__helpers.removeJSComments(code).match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -51,7 +51,7 @@ Dovresti usare la destrutturazione per creare la variabile `today`. ```js assert( - code.match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` @@ -59,7 +59,7 @@ Dovresti usare la destrutturazione per creare la variabile `tomorrow`. ```js assert( - code.match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md index 17980d1850b..404418d57ae 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md @@ -50,13 +50,13 @@ assert(half(stats) === 28.015); Dovresti ricorrere alla destrutturazione. ```js -assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/half=\({\w+,\w+}\)/)); ``` Dovresti utilizzare il parametro destrutturato. ```js -assert(!code.match(/stats\.max|stats\.min/)); +assert(!__helpers.removeJSComments(code).match(/stats\.max|stats\.min/)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index 8cc1ff28cf2..5d5fccca175 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -47,7 +47,7 @@ assert.deepEqual(_testArr, [1, 2, 3, 4, 5]) `Array.slice()` non dovrebbe essere utilizzato. ```js -assert(!code.match(/\.\s*slice\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*slice\s*\(/)); ``` Dovresti usare la sintassi rest. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md index f489c5099c6..c51863785d2 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md @@ -42,7 +42,7 @@ Dovresti esportare correttamente `uppercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+uppercaseString|export\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)})/g ) ); @@ -52,7 +52,7 @@ Dovresti esportare correttamente `lowercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+lowercaseString|export\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)})/g ) ); diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md index 5f2b2fcacfe..4097f78eafc 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md @@ -57,7 +57,7 @@ assert(sum() === 0); `sum` dovrebbe essere una funzione freccia che utilizza la sintassi del parametro resto (`...`) sul parametro `args`. ```js -assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/sum=\(\.\.\.args\)=>/)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md index e94e37b552a..67315240a5b 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md @@ -55,7 +55,7 @@ assert(arr2.every((v, i) => v === arr1[i]) && arr2.length); L'operatore spread `...` dovrebbe essere usato per duplicare `arr1`. ```js -assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); +assert(__helpers.removeJSComments(code).match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); ``` `arr2` dovrebbe rimanere invariato quando `arr1` viene modificato. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md index 0a21cc15686..6c270a06bc5 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md @@ -54,7 +54,7 @@ assert.match(code, /const\s+myConcat/g); ```js assert( - /myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) && + /myConcat=\(\w+,\w+\)=>/.test(__helpers.removeJSComments(code).replace(/\s/g, '')) && typeof myConcat === 'function' ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 21849a3277d..f90d370a1d7 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,14 +39,14 @@ Riscrivi la funzione `setGear` all'interno dell'oggetto `bicycle` usando la scor La dichiarazione di funzione tradizionale non deve essere utilizzata. ```js -assert(!code.match(/function/)); +assert(!__helpers.removeJSComments(code).match(/function/)); ``` `setGear` dovrebbe essere una funzione dichiarativa. ```js assert( - typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/) + typeof bicycle.setGear === 'function' && __helpers.removeJSComments(code).match(/setGear\s*\(.+\)\s*\{/) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md index 11f6db1373b..123cd00c8f5 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md @@ -43,7 +43,7 @@ assert.deepEqual( Il tuo codice non dovrebbe usare la coppia `key:value`. ```js -assert(!code.match(/:/g)) +assert(!__helpers.removeJSComments(code).match(/:/g)) ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md index 23ef2b2989d..5c164d1ed03 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md @@ -30,13 +30,13 @@ Cambia la funzione `nonMutatingPush` in modo che utilizzi `concat` per aggiunger Dovresti usare il metodo `concat`. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` Non dovresti usare il metodo `push`. ```js -assert(!code.match(/\.?[\s\S]*?push/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?push/g)); ``` L'array `first` non dovrebbe cambiare. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md index 425650fe9a0..f8caeb434cd 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md @@ -31,7 +31,7 @@ L'output non dovrebbe avere spazi Il tuo codice non dovrebbe usare il metodo `replace` per questa sfida. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `urlSlug("Winter Is Coming")` dovrebbe restituire la stringa `winter-is-coming`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md index 276483c0d6e..127215b1806 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md @@ -27,13 +27,13 @@ Usa il metodo `join` (tra gli altri) all'interno della funzione `sentensify` per Il tuo codice dovrebbe utilizzare il metodo `join`. ```js -assert(code.match(/\.join/g)); +assert(__helpers.removeJSComments(code).match(/\.join/g)); ``` Il tuo codice non dovrebbe usare il metodo `replace`. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `sentensify("May-the-force-be-with-you")` dovrebbe restituire una stringa. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md index 9080414f5bc..4569efbb763 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md @@ -25,7 +25,7 @@ Utilizza il metodo `concat` nella funzione `nonMutatingConcat` per concatenare ` Il tuo codice dovrebbe usare il metodo `concat`. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` L'array `first` non dovrebbe cambiare. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md index 6a522752c63..ac1f07266a8 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md @@ -47,7 +47,7 @@ assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_ Il tuo codice non dovrebbe usare il metodo `map`. ```js -assert(!code.match(/\.?[\s\S]*?map/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?map/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md index 2cd8d4d0e54..417b7fe228b 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md @@ -43,7 +43,7 @@ assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFi Il tuo codice non dovrebbe usare il metodo `filter`. ```js -assert(!code.match(/\.?[\s\S]*?filter/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?filter/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md index a16389a1195..6eecdabda98 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md @@ -77,7 +77,7 @@ assert(add(11)(22)(33) === 66); Il tuo codice dovrebbe includere una dichiarazione finale che restituisca `x + y + z`. ```js -assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); +assert(__helpers.removeJSComments(code).match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md index 0ca07afaf8b..5e48ef7679f 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md @@ -30,13 +30,13 @@ Non mutare l'array originale fornito alla funzione. Il tuo codice dovrebbe utilizzare il metodo `slice`. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` Il tuo codice non dovrebbe usare il metodo `splice`. ```js -assert(!code.match(/\.?[\s\S]*?splice/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?splice/g)); ``` Non dovresti mutare l'array originale passato alla funzione. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md index 7334fcec523..e11a9a0cb39 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md @@ -28,7 +28,7 @@ Usa il metodo `slice` nella funzione `sliceArray` per restituire parte dell'arra Il tuo codice dovrebbe utilizzare il metodo `slice`. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` La variabile `inputAnim` non dovrebbe cambiare. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md index 5f20c74f670..19fffc48973 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md @@ -47,7 +47,7 @@ Usa il metodo `sort` nella funzione `alphabeticalOrder` per ordinare gli element Il tuo codice dovrebbe usare il metodo `sort`. ```js -assert(code.match(/\.sort/g)); +assert(__helpers.removeJSComments(code).match(/\.sort/g)); ``` `alphabeticalOrder(["a", "d", "c", "a", "z", "g"])` dovrebbe restituire `["a", "a", "c", "d", "g", "z"]`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md index 4a9e267ca4e..5f5b232a621 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md @@ -33,7 +33,7 @@ Usa il metodo `split` all'interno della funzione `splitify` per dividere `str` i Il tuo codice dovrebbe utilizzare il metodo `split`. ```js -assert(code.match(/\.split/g)); +assert(__helpers.removeJSComments(code).match(/\.split/g)); ``` `splitify("Hello World,I-am code")` dovrebbe restituire `["Hello", "World", "I", "am", "code"]`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index 9ffab3b00e8..ae5212dc7ca 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), `for`, `while`, e `forEach` non dovrebbero essere usati. ```js -assert(!code.match(/for|while|forEach/g)); +assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ``` Dovrebbero essere usati `map`, `filter` o `reduce`. @@ -36,7 +36,7 @@ Dovrebbero essere usati `map`, `filter` o `reduce`. ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md index 02cfc87dd59..f7162eb1565 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md @@ -31,7 +31,7 @@ Usa il metodo `every` all'interno della funzione `checkPositive` per verificare Il tuo codice dovrebbe utilizzare il metodo `every`. ```js -assert(code.match(/\.every/g)); +assert(__helpers.removeJSComments(code).match(/\.every/g)); ``` `checkPositive([1, 2, 3, -4, 5])` dovrebbe restituire `false`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md index 5ac9222bf1b..0a6e83a92ae 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md @@ -46,13 +46,13 @@ assert( Il tuo codice dovrebbe utilizzare il metodo `filter`. ```js -assert(code.match(/\s*\.\s*filter/g)); +assert(__helpers.removeJSComments(code).match(/\s*\.\s*filter/g)); ``` Il tuo codice non dovrebbe utilizzare un ciclo `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` `filteredList` dovrebbe essere uguale a `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"}, {"title": "Batman Begins", "rating": "8.3"}]`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 5990cfeae4e..b444a450d52 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,13 +52,13 @@ assert( Il tuo codice non dovrebbe utilizzare un ciclo `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); ``` Il tuo codice dovrebbe utilizzare il metodo `map`. ```js -assert(code.match(/\.map/g)); +assert(__helpers.removeJSComments(code).match(/\.map/g)); ``` `ratings` dovrebbe essere uguale a `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"},{"title": "Batman Begins", "rating": "8.3"}, {"title": "Avatar", "rating": "7.9"}]`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md index fefae672b96..bfc64519c66 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md @@ -66,7 +66,7 @@ assert( Il tuo codice dovrebbe usare il metodo `reduce`. ```js -assert(code.match(/\.reduce/g)); +assert(__helpers.removeJSComments(code).match(/\.reduce/g)); ``` `getRating(watchList)` dovrebbe essere pari a 8.675. @@ -78,7 +78,7 @@ assert(getRating(watchList) === 8.675); Il tuo codice non dovrebbe utilizzare un ciclo `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` Il tuo codice dovrebbe restituire l'output corretto dopo aver valutato l'oggetto `watchList`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md index 6e40098e444..f9ca85a1372 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md @@ -31,7 +31,7 @@ Usa il metodo `some` all'interno della funzione `checkPositive` per verificare s Il tuo codice dovrebbe usare il metodo `some`. ```js -assert(code.match(/\.some/g)); +assert(__helpers.removeJSComments(code).match(/\.some/g)); ``` `checkPositive([1, 2, 3, -4, 5])` dovrebbe restituire `true`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md index 8b6e11957bb..6937366e9a4 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md @@ -39,7 +39,7 @@ assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4]); La tua soluzione non dovrebbe utilizzare i metodi `Array.prototype.flat()` o `Array.prototype.flatMap()`. ```js -assert(!code.match(/\.\s*flat\s*\(/) && !code.match(/\.\s*flatMap\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*flat\s*\(/) && !__helpers.removeJSComments(code).match(/\.\s*flatMap\s*\(/)); ``` Le variabili globali non dovrebbero essere utilizzate. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md index 57f790fbd50..e247c7075dc 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md @@ -49,7 +49,7 @@ Aggiungi la proprietà `numLegs` e i due metodi `eat()` e `describe()` al `proto `Dog.prototype` dovrebbe essere impostato su un nuovo oggetto. ```js -assert(/Dog\.prototype\s*?=\s*?{/.test(code)); +assert(/Dog\.prototype\s*?=\s*?{/.test(__helpers.removeJSComments(code))); ``` `Dog.prototype` dovrebbe avere la proprietà `numLegs`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md index 2ed0c42bbb2..de0d40a6850 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md @@ -61,7 +61,7 @@ La variabile `duck` dovrebbe essere inizializzata con `Object.create`. ```js assert( /(let|const|var)\s{1,}duck\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` @@ -71,7 +71,7 @@ La variabile `beagle` dovrebbe essere inizializzata con `Object.create`. ```js assert( /(let|const|var)\s{1,}beagle\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md index f16584f4fda..32bc68134fe 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md @@ -61,7 +61,7 @@ assert.deepEqual(prototypeProps, ['numLegs']); Dovresti risolvere questa sfida senza usare il metodo integrato `Object.keys()`. ```js -assert(!/\Object.keys/.test(code)); +assert(!/\Object.keys/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md index 7bea8695014..e45e009a8b4 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md @@ -43,7 +43,7 @@ assert(dog.sayLegs() === 'This dog has 4 legs.'); Il tuo codice dovrebbe utilizzare la parola chiave `this` per accedere alla proprietà `numLegs` di `dog`. ```js -assert(code.match(/this\.numLegs/g)); +assert(__helpers.removeJSComments(code).match(/this\.numLegs/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md index f9067450677..4e88aba3e1e 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md @@ -51,7 +51,7 @@ assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1); Dovresti risolvere questa sfida senza usare il metodo integrato `Object.keys()`. ```js -assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); +assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(__helpers.removeJSComments(code))); ``` Dovresti risolvere questa sfida senza predefinire il contenuto dell'array `ownProps` nel codice. @@ -59,7 +59,7 @@ Dovresti risolvere questa sfida senza predefinire il contenuto dell'array `ownPr ```js assert( !/\[\s*(?:'|")(?:name|numLegs)|(?:push|concat)\(\s*(?:'|")(?:name|numLegs)/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md index 4389df95219..bfb3d29fd8e 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md @@ -55,7 +55,7 @@ assert(joinDogFraternity(new Dog('')) === true); `joinDogFraternity` dovrebbe utilizzare la proprietà `constructor`. ```js -assert(/\.constructor/.test(code) && !/instanceof/.test(code)); +assert(/\.constructor/.test(__helpers.removeJSComments(code)) && !/instanceof/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md index 2bb3c4fcb8b..abbc26fd92f 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md @@ -29,13 +29,13 @@ Riscrivi la funzione `makeNest` e rimuovi la sua chiamata in modo che diventi un La funzione dovrebbe essere anonima. ```js -assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, ''))); +assert(/\((function|\(\))(=>|\(\)){?/.test(__helpers.removeJSComments(code).replace(/\s/g, ''))); ``` La tua funzione dovrebbe avere delle parentesi alla fine dell'espressione, in modo da chiamarla immediatamente. ```js -assert(/\(.*(\)\(|\}\(\))\)/.test(code.replace(/[\s;]/g, ''))); +assert(/\(.*(\)\(|\}\(\))\)/.test(__helpers.removeJSComments(code).replace(/[\s;]/g, ''))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md index 2bb47a9f8d2..95b27c877dc 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md @@ -42,7 +42,7 @@ Modifica il codice per mostrare la corretta catena del prototipo. Il tuo codice dovrebbe mostrare che `Object.prototype` è il prototype di `Dog.prototype` ```js -assert(/Object\.prototype\.isPrototypeOf/.test(code)); +assert(/Object\.prototype\.isPrototypeOf/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md index 9d5aad5e70a..7d4f86c798f 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md @@ -35,7 +35,7 @@ Usa `isPrototypeOf` per controllare il `prototype` di `beagle`. Dovresti mostrare che `Dog.prototype` è il `prototype` di `beagle` ```js -assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code)); +assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md index 89d80999cc0..2c450d84d5d 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md @@ -52,7 +52,7 @@ assert(hound instanceof Dog); Il tuo codice dovrebbe utilizzare l'operatore `new` per creare un'istanza di `Dog`. ```js -assert(code.match(/new/g)); +assert(__helpers.removeJSComments(code).match(/new/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md index fa0ca374a64..83fede3c74d 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md @@ -43,7 +43,7 @@ Cambia il modo in cui `weight` è dichiarata nella funzione `Bird` in modo che d La proprietà `weight` dovrebbe essere una variabile privata e dovrebbe avere il valore di `15`. ```js -assert(code.match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); ``` Il tuo codice dovrebbe creare un metodo in `Bird` chiamato `getWeight` che restituisca il valore della variabile privata `weight`. @@ -55,7 +55,7 @@ assert(new Bird().getWeight() === 15); La funzione `getWeight` dovrebbe restituire la variabile privata `weight`. ```js -assert(code.match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); +assert(__helpers.removeJSComments(code).match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md index 8006d8f0ab4..d5740976427 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md @@ -29,13 +29,13 @@ Mostra entrambe le proprietà dell'oggetto `dog` sulla tua console. Il tuo codice dovrebbe utilizzare `console.log` per mostrare il valore della proprietà `name` dell'oggetto `dog`. ```js -assert(/console.log\(.*dog\.name.*\)/g.test(code)); +assert(/console.log\(.*dog\.name.*\)/g.test(__helpers.removeJSComments(code))); ``` Il tuo codice dovrebbe utilizzare `console.log` per mostrare il valore della proprietà `numLegs` dell'oggetto `dog`. ```js -assert(/console.log\(.*dog\.numLegs.*\)/g.test(code)); +assert(/console.log\(.*dog\.numLegs.*\)/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md index dd64d073056..2e398daf76e 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md @@ -53,7 +53,7 @@ assert(typeof myHouse.numBedrooms === 'number'); Dovresti verificare che `myHouse` sia un'istanza di `House` usando l'operatore `instanceof`. ```js -assert(/myHouse\s*instanceof\s*House/.test(code)); +assert(/myHouse\s*instanceof\s*House/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md index cf2de313d93..db9eadf6bbc 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md @@ -75,7 +75,7 @@ assert(!myRegex.test('EleanorRoosevelt')); Dovresti usare `.test()` per testare l'espressione regolare. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` Il tuo risultato dovrebbe restituire `true`. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md index 7634641c528..35b4a669270 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md @@ -51,7 +51,7 @@ assert(codingRegex.source === 'coding'); Dovresti usare il metodo `.match()`. ```js -assert(code.match(/\.match\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.match\(.*\)/)); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md index 92567540c8e..ebb36f0f8d6 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md @@ -31,7 +31,7 @@ Completa l'espressione regolare `unRegex` in modo che corrisponda alle stringhe Dovresti usare il metodo `.test()`. ```js -assert(code.match(/\.test\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.test\(.*\)/)); ``` Dovresti usare il carattere jolly nella tua espressione regolare `unRegex` diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index 7aeef429520..83222438aa4 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -52,7 +52,7 @@ assert(!waldoRegex.test('Somewhere is hiding in this text.')); Dovresti cercare la corrispondenza di una stringa letterale con la tua espressione regolare. ```js -assert(!/\/.*\/i/.test(code)); +assert(!/\/.*\/i/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md index 22b76d8ef35..02a1655e15f 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md @@ -27,13 +27,13 @@ assert(result === 'Hello, World!'); La tua soluzione non dovrebbe usare il metodo `String.prototype.trim()`. ```js -assert(!code.match(/\.?[\s\S]*?trim/)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?trim/)); ``` La variabile `result` non dovrebbe essere impostata direttamente con una stringa ```js -assert(!code.match(/result\s*=\s*["'`].*?["'`]/)); +assert(!__helpers.removeJSComments(code).match(/result\s*=\s*["'`].*?["'`]/)); ``` Il valore della variabile `hello` non dovrebbe cambiare. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md index cd79d0e962d..be3fa4a6862 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md @@ -37,7 +37,7 @@ Scrivi un'espressione regolare `fixRegex` utilizzando tre gruppi di cattura che Dovresti usare `.replace()` per cercare e sostituire. ```js -assert(code.match(/\.replace\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.replace\(.*\)/)); ``` La tua espressione regolare dovrebbe sostituire la stringa `one two three` con la stringa `three two one` @@ -49,7 +49,7 @@ assert(result === 'three two one'); Non dovresti cambiare l'ultima riga. ```js -assert(code.match(/result\s*=\s*str\.replace\(.*?\)/)); +assert(__helpers.removeJSComments(code).match(/result\s*=\s*str\.replace\(.*?\)/)); ``` `fixRegex` dovrebbe usare almeno tre gruppi di cattura. diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md index 389c6f674d9..1e37a138bae 100644 --- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md +++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md @@ -31,7 +31,7 @@ Applica l'espressione regolare `myRegex` alla stringa `myString` usando il metod Dovresti usare `.test()` per testare l'espressione regolare. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` Il tuo risultato dovrebbe restituire `true`. diff --git a/curriculum/challenges/italian/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md b/curriculum/challenges/italian/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md index e08d494d3f5..70a0e61b19d 100644 --- a/curriculum/challenges/italian/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md +++ b/curriculum/challenges/italian/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md @@ -15,12 +15,9 @@ You should have `if number >= 10:` within the `for` loop. ```js ({ - test: () => { - const transformedCode = code.replace(/\r/g, ""); - const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); - const { function_body } = verify_card_number; - - assert.match(function_body, /if +number +>= +10:/); + test: () => + { + assert(runPython(`_Node(_code).find_function("verify_card_number").find_for_loops()[1].find_ifs()[0].find_conditions()[0].is_equivalent("number >= 10")`)); } }) ``` diff --git a/curriculum/challenges/italian/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md b/curriculum/challenges/italian/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md index 0c3447bff18..d90f8a63eec 100644 --- a/curriculum/challenges/italian/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md +++ b/curriculum/challenges/italian/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md @@ -115,7 +115,10 @@ from importlib import reload reload(probability_calculator) probability_calculator.random.seed(95) -def test_hat_draw(self): + +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw(self): hat = probability_calculator.Hat(red=5,blue=2) actual = hat.draw(2) expected = ['blue', 'red'] @@ -140,6 +143,49 @@ t.result.wasSuccessful() }); ``` +The `draw` method should behave correctly when the number of balls to extract is bigger than the number of balls in the hat. + +```js +({ + test: () => { + pyodide.FS.writeFile("/home/pyodide/probability_calculator.py", code); + pyodide.FS.writeFile( + "/home/pyodide/test_module.py", + ` +import unittest +import probability_calculator +from importlib import reload + +reload(probability_calculator) + +probability_calculator.random.seed(95) +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw_2(self): + hat = probability_calculator.Hat(yellow=5,red=1,green=3,blue=9,test=1) + actual = hat.draw(20) + expected = ['yellow', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'green', 'green', 'green', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'test'] + self.assertEqual(actual, expected, 'Expected hat draw to return all items from hat contents.') + actual = len(hat.contents) + expected = 0 + self.assertEqual(actual, expected, 'Expected hat draw to leave no items in contents.') + ` + ); + const testCode = ` +from unittest import main +import test_module +from importlib import reload + +reload(test_module) +t = main(module='test_module', exit=False) +t.result.wasSuccessful() +`; + const out = __pyodide.runPython(testCode); + assert(out); + }, +}); +``` + The `experiment` method should return a different probability. @@ -221,7 +267,8 @@ class Hat: def draw(self, number): drawn = [] if number >= len(self.contents): - return self.contents + drawn.extend(self.contents) + self.contents = [] else: for i in range(number): drawn.append( @@ -229,8 +276,7 @@ class Hat: ) return drawn -def experiment(hat, expected_balls, num_balls_drawn, num_experiments): - +def experiment(hat, expected_balls, num_balls_drawn, num_experiments): expected_balls_list = [] drawn_list = [] success = 0 @@ -248,12 +294,7 @@ def experiment(hat, expected_balls, num_balls_drawn, num_experiments): except: continue if len(exp_ball_list_copy) == 0: - success += 1 - - - - - probability = success/num_experiments - + success += 1 + probability = success/num_experiments return probability ``` diff --git a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md index 9389de3cf61..1a35690f495 100644 --- a/curriculum/challenges/italian/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md +++ b/curriculum/challenges/italian/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md @@ -48,9 +48,9 @@ La dichiarazione iniziale di `homeworkStack` non dovrebbe essere modificata. ```js assert( - code.match(/=/g).length === 1 && + __helpers.removeJSComments(code).match(/=/g).length === 1 && /homeworkStack\s*=\s*\["BIO12"\s*,\s*"HIS80"\s*,\s*"MAT122"\s*,\s*"PSY44"\]/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md index 0dceb577f2f..3593db03e6d 100644 --- a/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md @@ -2,7 +2,6 @@ id: 5f356ed60a5decd94ab66986 title: Step 22 challengeType: 0 -removeComments: false dashedName: step-22 --- diff --git a/curriculum/challenges/italian/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md b/curriculum/challenges/italian/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md index 38bc0df3e48..9a8d1216be9 100644 --- a/curriculum/challenges/italian/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md +++ b/curriculum/challenges/italian/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md @@ -40,15 +40,15 @@ assert(canvasFilter === 'blur(2px)'); ## --seed-contents-- ```css +--fcc-editable-region-- .canvas { width: 500px; height: 600px; background-color: #4d0f00; overflow: hidden; ---fcc-editable-region-- ---fcc-editable-region-- } +--fcc-editable-region-- .frame { border: 50px solid black; diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md index 23265b45ed3..5f928fc5aef 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md @@ -7,7 +7,7 @@ dashedName: step-55 # --description-- -Inside, the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. +Inside the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. Now, you should see a category displayed underneath each post topic. diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md index befb559c8e9..5debed2bb48 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md @@ -7,9 +7,11 @@ dashedName: step-43 # --description-- -Nota come il valore `10` è posizionato all'inizio dell'array. Questo perché il comportamento predefinito di `.sort()` è quello di convertire i valori in stringhe e ordinarli alfabeticamente. E `10` viene prima `2` alfabeticamente. +Notice how the number `10` is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the numbers values to strings, and sort them alphabetically. E `10` viene prima `2` alfabeticamente. -Per risolvere questo problema, puoi passare una funzione callback al metodo `.sort()`. The callback function has two parameters - for yours, use `a` and `b`. Lascia la funzione vuota per ora. +Per risolvere questo problema, puoi passare una funzione callback al metodo `.sort()`. The callback function has two parameters - for yours, use `a` and `b`. The parameters of `a` and `b` represent the number values in the array that will be sorted. + +Lascia la funzione vuota per ora. # --hints-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md index db5d9d893d1..4ea91848ae7 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md @@ -26,7 +26,7 @@ assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\( La funzione callback dovrebbe restituire `a - b`. ```js -assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+a\s*-\s*b\s*;?\s*}\s*\)/); +assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+(?:parseInt)?(?:Number)?\(?a\)?\s*-\s*(?:parseInt)?(?:Number)?\(?b\)?\s*;?\s*}\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index 4b7ffea86e6..4c116acc40b 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -11,6 +11,8 @@ In `evalFormula`, dichiara una funzione freccia `idToText` che prende un paramet La funzione `idToText` dovrebbe restituire il risultato della chiamata `.find()` sull'array `cells` con una funzione callback che prende un parametro `cell` e restituisce `cell.id === id`. +Both of your functions should use implicit returns. + # --hints-- Dovresti dichiarare una variabile `idToText` nella funzione `evalFormula`. diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md index 57110b715a9..37487b1771c 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md @@ -23,13 +23,7 @@ Open up the console to see the result. # --hints-- -You should call `.repeat()` on your two `" "` strings. - -```js -assert.lengthOf(code.match(/" ".repeat/g), 2); -``` - -Your `" "` strings should be repeated `rowCount - rowNumber` times. +You should call `.repeat()` on your `" "` strings to repeat them `rowCount - rowNumber` times. ```js assert.equal(padRow(1, 3), " # "); diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md index 3306b1a478b..4170d3bd12b 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md @@ -3,7 +3,6 @@ id: 660f3ce51f70571e1c5227c8 title: Step 69 challengeType: 1 dashedName: step-69 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md index ea0a831040f..7a939244a7c 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md @@ -3,7 +3,6 @@ id: 660f3dd626be3a1ffe27e5d1 title: Step 70 challengeType: 1 dashedName: step-70 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md index e30d808ccb6..b676558ec74 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md @@ -3,7 +3,6 @@ id: 660f4f79e2a82a4e92290f44 title: Step 101 challengeType: 1 dashedName: step-101 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md index dc683e61ce5..3f088de2c91 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md @@ -3,7 +3,6 @@ id: 660f53ad3d39175c5d4335ac title: Step 108 challengeType: 1 dashedName: step-108 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md new file mode 100644 index 00000000000..286128cc2cf --- /dev/null +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md @@ -0,0 +1,74 @@ +--- +id: 662693f82c91a66be46c881b +title: Step 1 +challengeType: 1 +dashedName: step-1 +--- + +# --description-- + +A teacher has finished grading their students' tests and needs your help to calculate the average score for the class. + +Complete the `getAverage` function which takes in an array of test scores and returns the average score. + +The average is calculated by adding up all the scores and dividing by the total number of scores. + +```js +average = sum of all scores / total number of scores +``` + +A couple of function calls have been provided for you so you can test out your code. + +**Tips** + +- You can use a loop to iterate over the `scores` array and add up all the scores. +- You can use the `length` property to get the total number of scores. + +# --hints-- + +Your `getAverage` function should return a number. + +```js +assert.strictEqual(typeof getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 'number'); +``` + +`getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])` should return `71.7`. + +```js +assert.strictEqual(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 71.7); +``` + +`getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])` should return `85.4`. + +```js +assert.strictEqual(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]), 85.4); +``` + +`getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100])` should return `92.4`. + +```js +assert.strictEqual(getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100]), 92.4); +``` + +Your `getAverage` function should return the average score of the test scores. + +```js +assert.strictEqual(getAverage([52, 56, 60, 65, 70, 75, 80, 85, 90, 95]), 72.8); +assert.strictEqual(getAverage([45, 50, 55, 60, 65, 70, 75, 80, 85, 90]), 67.5); +assert.strictEqual(getAverage([38, 42, 46, 50, 54, 58, 62, 66, 70, 74]), 56); +``` + +# --seed-- + +## --seed-contents-- + +```js +--fcc-editable-region-- +function getAverage(scores) { + +} + +console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])); +console.log(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md new file mode 100644 index 00000000000..f7e9253a5a5 --- /dev/null +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md @@ -0,0 +1,104 @@ +--- +id: 6626a060c4006f793e10cb33 +title: Step 2 +challengeType: 1 +dashedName: step-2 +--- + +# --description-- + +Now the teacher needs your help converting the student score to a letter grade. + +Complete the `getGrade` function that takes a number `score` as a parameter. Your function should return a string representing a letter grade based on the score. + +Here are the scores and their corresponding letter grades: + +| Score Range | Grade | +| ----------- | ------- | +| `100` | `"A++"` | +| `90 - 99` | `"A"` | +| `80 - 89` | `"B"` | +| `70 - 79` | `"C"` | +| `60 - 69` | `"D"` | +| `0 - 59` | `"F"` | + + +**Tips** + +- Remember that you learned about conditional statements(`if`, `else if`, and `else`). +- Remember that you learned about comparison operators (`>`, `<`, `>=`, `<=`, `===`). + +# --hints-- + +Your `getGrade` function should return `"A++"` if the score is `100`. + +```js +assert.strictEqual(getGrade(100), "A++"); +``` + +Your `getGrade` function should return `"A"` if the score is `94`. + +```js +assert.strictEqual(getGrade(94), "A"); +``` + +Your `getGrade` function should return `"B"` if the score is between `80` and `89`. + +```js +assert.strictEqual(getGrade(80), "B"); +assert.strictEqual(getGrade(83), "B"); +assert.strictEqual(getGrade(88), "B"); +``` + +Your `getGrade` function should return `"C"` if the score is `78`. + +```js +assert.strictEqual(getGrade(75), "C"); +``` + +Your `getGrade` function should return `"D"` if the score is between `60` and `69`. + +```js +assert.strictEqual(getGrade(60), "D"); +assert.strictEqual(getGrade(63), "D"); +assert.strictEqual(getGrade(68), "D"); +``` + +Your `getGrade` function should return `"F"` if the score is `57`. + +```js +assert.strictEqual(getGrade(57), "F"); +``` + +Your `getGrade` function should return `"F"` if the score is between `0` and `59`. + +```js +assert.strictEqual(getGrade(0), "F"); +assert.strictEqual(getGrade(30), "F"); +assert.strictEqual(getGrade(43), "F"); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} +--fcc-editable-region-- +function getGrade(score) { + +} + +console.log(getGrade(96)); +console.log(getGrade(82)); +console.log(getGrade(56)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md new file mode 100644 index 00000000000..b168e1325fc --- /dev/null +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md @@ -0,0 +1,88 @@ +--- +id: 6626b4c58c027d86478ff5eb +title: Step 3 +challengeType: 1 +dashedName: step-3 +--- + +# --description-- + +The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an `"F"`. + +Complete the function `hasPassingGrade` that takes a student score as a parameter. Your function should return `true` if the student has a passing grade and `false` if they do not. + +**Tips** + +- Use the `getGrade` function to get the student's grade. Then check if the grade is passing or not. + +# --hints-- + +Your `hasPassingGrade` function should return a boolean value. + +```js +assert.strictEqual(typeof hasPassingGrade(100), "boolean"); +``` + +Your `hasPassingGrade` function should return `true` if the grade is an `"A"`. + +```js +assert.isTrue(hasPassingGrade(100)); +``` + +Your `hasPassingGrade` function should return `false` if the grade is an `"F"`. + +```js +assert.isFalse(hasPassingGrade(53)); +``` + +Your `hasPassingGrade` function should return `true` for all passing grades. + +```js +assert.isTrue(hasPassingGrade(87)); +assert.isTrue(hasPassingGrade(60)); +assert.isTrue(hasPassingGrade(73)); +assert.isTrue(hasPassingGrade(96)); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +--fcc-editable-region-- +function hasPassingGrade(score) { + +} + + +console.log(hasPassingGrade(100)); +console.log(hasPassingGrade(53)); +console.log(hasPassingGrade(87)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md new file mode 100644 index 00000000000..08ee3cea27b --- /dev/null +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md @@ -0,0 +1,143 @@ +--- +id: 6626b8dcf5057f896f948440 +title: Step 4 +challengeType: 1 +dashedName: step-4 +--- + +# --description-- + +Now that the teacher has all of the information they need, they want to be able to message the student with the results. + +Complete the `studentMsg` function with `totalScores` and `studentScore` for parameters. The function should return a string representing a message to the student. + +If the student passed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You passed the course. +``` + +If the student failed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You failed the course. +``` + +Replace `average-goes-here` with the average of the total scores. Replace `grade-goes-here` with the student's grade. + +**Tips** + +- Use the `getAverage` function to get the class average. +- Use the `getGrade` function to get the student's grade. +- Use string concatenation (`+`) to build the message. +- Be careful with the punctuation and spaces in the message. + +# --hints-- + +Your function call of `studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)` should return the following message: `"Class average: 71.7. Your grade: F. You failed the course."`. + +```js +assert.strictEqual(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37), "Class average: 71.7. Your grade: F. You failed the course."); +``` + +Your function call of `studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)` should return the following message: `"Class average: 50.8. Your grade: A++. You passed the course."`. + +```js +assert.strictEqual(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100), "Class average: 50.8. Your grade: A++. You passed the course."); +``` + +Your `studentMsg` function should return a the correct message based on the student's score and the class average. + +```js +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 92), "Class average: 70.25. Your grade: A. You passed the course."); +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 57), "Class average: 70.25. Your grade: F. You failed the course."); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +--fcc-editable-region-- +function studentMsg(totalScores, studentScore) { + +} +console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)); +--fcc-editable-region-- + +``` + + +# --solutions-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +function studentMsg(totalScores, studentScore) { + let average = getAverage(totalScores); + let grade = getGrade(studentScore); + + return `Class average: ${average}. Your grade: ${grade}. You ${ + hasPassingGrade(studentScore) ? "passed" : "failed" + } the course.`; +} + +``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md index 4bf1d6463d1..6d8a9d8763d 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md @@ -87,7 +87,7 @@ assert(confirmEnding('Abstraction', 'action') === true); このチャレンジを解決するプログラムでは、組み込みメソッド `.endsWith()` を使用しないでください。 ```js -assert(!/\.endsWith\(.*?\)\s*?;?/.test(code) && !/\['endsWith'\]/.test(code)); +assert(!/\.endsWith\(.*?\)\s*?;?/.test(__helpers.removeJSComments(code)) && !/\['endsWith'\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md index 24fe2f10e7a..0a70e9cd493 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md @@ -51,7 +51,7 @@ assert(repeatStringNumTimes('abc', -2) === ''); 組み込みメソッドの `repeat()` は使用しないでください。 ```js -assert(!/\.repeat/g.test(code)); +assert(!/\.repeat/g.test(__helpers.removeJSComments(code))); ``` `repeatStringNumTimes("abc", 0)` は `""` を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md index 6823661ec4e..0df17f8fe40 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md @@ -53,19 +53,19 @@ assert.deepEqual( `htmlColorNames` 関数で `splice()` メソッドを使用する必要があります。 ```js -assert(/.splice/.test(code)); +assert(/.splice/.test(__helpers.removeJSComments(code))); ``` `shift()` または `unshift()` は使用しないでください。 ```js -assert(!/shift|unshift/.test(code)); +assert(!/shift|unshift/.test(__helpers.removeJSComments(code))); ``` 配列ブラケット記法は使用しないでください。 ```js -assert(!/\[\d\]\s*=/.test(code)); +assert(!/\[\d\]\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md index 9cbd53a3de0..8ee08787322 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md @@ -85,8 +85,8 @@ The definition of the `foods` object should not be changed. ```js assert( - code.search(/let foods/) === -1 && - code.search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ + __helpers.removeJSComments(code).search(/let foods/) === -1 && + __helpers.removeJSComments(code).search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ ) !== -1 ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md index 3e2b9d28284..89b8ca52e01 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md @@ -27,7 +27,7 @@ users.hasOwnProperty('Alan'); ```js -assert(code.match(/users/gm).length <= 2) +assert(__helpers.removeJSComments(code).match(/users/gm).length <= 2) ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index 7b656edc621..e8e7650c84e 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ `copyMachine` 関数では、配列 `arr` を付けた `spread operator` を使用する必要があります。 ```js -assert(code.match(/\.\.\.\s*arr/)); +assert(__helpers.removeJSComments(__helpers.removeJSComments(code)).match(/\.\.\.\s*arr/)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md index 3f82c638be5..fbf85ec16d9 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md @@ -38,7 +38,7 @@ assert.deepEqual( `forecast` 関数で `slice()` メソッドを使用する必要があります。 ```js -assert(/\.slice\(/.test(code)); +assert(/\.slice\(/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index 163d99433e6..06195a46588 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -51,7 +51,7 @@ We've defined a function `countOnline` which accepts one argument, `allUsers`. U ```js assert( - code.match( + __helpers.removeJSComments(code).match( /for\s*\(\s*(var|let|const)\s+[a-zA-Z_$]\w*\s+in\s+[a-zA-Z_$]\w*\s*\)/ ) ); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md index ebc3f2ad705..d7997306de8 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md @@ -61,7 +61,7 @@ assert(userActivity.data.online === 45); `online` プロパティを、ドット記法またはブラケット記法を使用して設定する必要があります。 ```js -assert.strictEqual(code.search(/online: 45/), -1); +assert.strictEqual(__helpers.removeJSComments(code).search(/online: 45/), -1); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md index 26f341a6b14..be2d8c5a39c 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md @@ -40,7 +40,7 @@ let newArray = array.splice(3, 2); ```js assert( - __helpers.removeWhiteSpace(code).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) ); ``` @@ -56,14 +56,14 @@ assert.strictEqual( コードでは、`arr` に対して `splice()` メソッドを使用する必要があります。 ```js -assert(__helpers.removeWhiteSpace(code).match(/arr\.splice\(/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(/)); ``` splice は `arr` から要素を削除するのみで、`arr` にどんな新しい要素も追加しないものとします。 ```js assert( - !__helpers.removeWhiteSpace(code).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) + !__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md index bd50345331f..15d5f53bcba 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md @@ -39,9 +39,9 @@ assert( ```js assert( - code.search(/oranges:/) !== -1 && - code.search(/plums:/) !== -1 && - code.search(/strawberries:/) !== -1 + __helpers.removeJSComments(code).search(/oranges:/) !== -1 && + __helpers.removeJSComments(code).search(/plums:/) !== -1 && + __helpers.removeJSComments(code).search(/strawberries:/) !== -1 ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md index 6a70356523f..3c86a950268 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md @@ -54,7 +54,7 @@ assert( ```js assert( (function () { - if (code.match(/\s*=\s*myArray\[0\]/g)) { + if (__helpers.removeJSComments(code).match(/\s*=\s*myArray\[0\]/g)) { return true; } else { return false; diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md index 63fe214315b..e59dae614cf 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md @@ -45,7 +45,7 @@ assert(myData === 8); ブラケット記法を使用して、`myArray` から正しい値を読み取る必要があります。 ```js -assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code))); +assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md index 19c3a59c545..4697ee64bd8 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md @@ -54,7 +54,7 @@ assert(secondTree === 'pine'); ドット記法とブラケット記法を使用して `myPlants` にアクセスする必要があります。 ```js -assert(/=\s*myPlants\[1\].list\[1\]/.test(code)); +assert(/=\s*myPlants\[1\].list\[1\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md index 8c604fbc0fa..b47591116d2 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md @@ -64,7 +64,7 @@ assert(drinkValue === 'water'); ブラケット記法を 2 回使用する必要があります。 ```js -assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md index e4697382969..34ce792f525 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md @@ -60,7 +60,7 @@ assert(shirtValue === 'jersey'); ドット記法を 2 回使用する必要があります。 ```js -assert(code.match(/testObj\.\w+/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\.\w+/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md index 7478df3fb00..3bef0cc9bd5 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md @@ -56,19 +56,19 @@ assert(player === 'Montana'); ブラケット記法を使用して `testObj` にアクセスする必要があります。 ```js -assert(/testObj\s*?\[.*?\]/.test(code)); +assert(/testObj\s*?\[.*?\]/.test(__helpers.removeJSComments(code))); ``` 値 `Montana` を、変数 `player` に直接、割り当てることはできません。 ```js -assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); +assert(!__helpers.removeJSComments(code).match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); ``` ブラケット記法で、変数 `playerNumber` を使用する必要があります。 ```js -assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code)); +assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md index 25496fd7906..7ebb70b4679 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md @@ -53,7 +53,7 @@ assert(myDog.bark !== undefined); `myDog` の初期化に `bark`を追加しないでください。 ```js -assert(!/bark[^\n]:/.test(code)); +assert(!/bark[^\n]:/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md index 1dbb97138ad..cfda09486b3 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md @@ -38,7 +38,7 @@ assert(sum === 20); `+` 演算子を使用してください。 ```js -assert(/\+/.test(code)); +assert(/\+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md index 0a513a931a5..ff7061a60f3 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md @@ -71,7 +71,7 @@ assert(switchOfStuff(4) === 'stuff'); `if` または `else` ステートメントを使用することはできません。 ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` `default` ステートメントを使用する必要があります。 @@ -83,7 +83,7 @@ assert(switchOfStuff('string-to-trigger-default-case') === 'stuff'); 少なくとも 3 つの `break` ステートメントを含める必要があります。 ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md index 3a3dd86ecf2..0efb2e58eaf 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md @@ -36,7 +36,7 @@ assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2); `+=` 演算子を使用して、`someAdjective` を `myStr` に連結する必要があります。 ```js -assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md index ccdb178b03e..0e836079a64 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md @@ -29,7 +29,7 @@ myNum = myVar; 指定のコメントより上にあるコードを変更しないでください。 ```js -assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code))); ``` `b` の値は `7` でなければなりません。 @@ -41,7 +41,7 @@ assert(typeof b === 'number' && b === 7); `a` は `=` を使って `b` に割り当てられなければなりません。 ```js -assert(/b\s*=\s*a\s*/g.test(code)); +assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md index b280d194f95..afeca6468f2 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md @@ -34,7 +34,7 @@ assert(processed === 2); `processArg` を `processed` に代入する必要があります。 ```js -assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code)); +assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md index 946dcb48cde..7f1d474ab6a 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md @@ -39,19 +39,19 @@ if (condition1) { 少なくとも 4 つの `else` ステートメントが必要です。 ```js -assert(code.match(/else/g).length > 3); +assert(__helpers.removeJSComments(code).match(/else/g).length > 3); ``` 少なくとも 4 つの `if` ステートメントが必要です。 ```js -assert(code.match(/if/g).length > 3); +assert(__helpers.removeJSComments(code).match(/if/g).length > 3); ``` 少なくとも 1 つの `return` ステートメントが必要です。 ```js -assert(code.match(/return/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/return/g).length >= 1); ``` `testSize(0)` は文字列 `Tiny` を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index 408be62038a..124fe9b919f 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -2,7 +2,6 @@ id: bd7123c9c441eddfaeb4bdef title: JavaScript コードにコメントする challengeType: 1 -removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' forumTopicId: 16783 dashedName: comment-your-javascript-code diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index 17ea6782ee2..c747856ed23 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -58,7 +58,7 @@ assert(testEqual('12') === 'Equal'); `==` 演算子を使用してください。 ```js -assert(code.match(/==/g) && !code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/==/g) && !__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index f60f5776bbe..490ca9c139d 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -73,7 +73,7 @@ assert(testGreaterThan(150) === 'Over 100'); `>` 演算子を 2 回以上使用してください。 ```js -assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index 0edd1f3b83a..a307361e898 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -73,7 +73,7 @@ assert(testGreaterOrEqual(21) === '20 or Over'); `>=` 演算子を 2 回以上使用してください。 ```js -assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index c8aedc8067a..79276c46424 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -60,7 +60,7 @@ assert(testNotEqual('bob') === 'Not Equal'); `!=` 演算子を使用してください。 ```js -assert(code.match(/(?!!==)!=/)); +assert(__helpers.removeJSComments(code).match(/(?!!==)!=/)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index 5cfb3bed71c..253b48d854d 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -66,7 +66,7 @@ assert(testLessThan(99) === '55 or Over'); `<` 演算子を 2 回以上使用してください。 ```js -assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index 023cbc238a0..6c335c557e6 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -72,7 +72,7 @@ assert(testLessOrEqual(55) === 'More Than 24'); `<=` 演算子を 2 回以上使用してください。 ```js -assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index ac506286a97..a8c3a824423 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -49,7 +49,7 @@ assert(testStrict('7') === 'Not Equal'); `===` 演算子を使用してください ```js -assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index c54b2e65639..1cf8ec3ea1a 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -52,7 +52,7 @@ assert(testStrictNotEqual('bob') === 'Not Equal'); `!==` 演算子を使用してください。 ```js -assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md index b455c43f52e..5f197d6104e 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md @@ -40,13 +40,13 @@ return "No"; `&&` 演算子を 1 回使用してください。 ```js -assert(code.match(/&&/g).length === 1); +assert(__helpers.removeJSComments(code).match(/&&/g).length === 1); ``` `if` ステートメントを 1 つだけにする必要があります。 ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalAnd(0)` は文字列 `No` を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md index 0c844da84e1..cb6da3c982c 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md @@ -43,13 +43,13 @@ return "Yes"; `||`演算子を 1 回使用してください。 ```js -assert(code.match(/\|\|/g).length === 1); +assert(__helpers.removeJSComments(code).match(/\|\|/g).length === 1); ``` `if` ステートメントを 1 つだけにする必要があります。 ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalOr(0)` は文字列 `Outside` を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md index 18f54bb0427..905a8adf657 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md @@ -54,16 +54,16 @@ assert(c === 19); 各変数で `+=` 演算子を使用してください。 ```js -assert(code.match(/\+=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\+=/g).length === 3); ``` 指定のコメントより上にあるコードを変更しないでください。 ```js assert( - /let a = 3;/.test(code) && - /let b = 17;/.test(code) && - /let c = 12;/.test(code) + /let a = 3;/.test(__helpers.removeJSComments(code)) && + /let b = 17;/.test(__helpers.removeJSComments(code)) && + /let c = 12;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md index 1214801d5db..1c932f6a481 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md @@ -48,16 +48,16 @@ assert(c === 3); 各変数で `/=` 演算子を使用してください。 ```js -assert(code.match(/\/=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\/=/g).length === 3); ``` 指定のコメントより上にあるコードを変更しないでください。 ```js assert( - /let a = 48;/.test(code) && - /let b = 108;/.test(code) && - /let c = 33;/.test(code) + /let a = 48;/.test(__helpers.removeJSComments(code)) && + /let b = 108;/.test(__helpers.removeJSComments(code)) && + /let c = 33;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md index f55ced24e14..c44657a0b78 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md @@ -48,16 +48,16 @@ assert(c === 46); 各変数で `*=` 演算子を使用してください。 ```js -assert(code.match(/\*=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\*=/g).length === 3); ``` 指定のコメントより上にあるコードを変更しないでください。 ```js assert( - /let a = 5;/.test(code) && - /let b = 12;/.test(code) && - /let c = 4\.6;/.test(code) + /let a = 5;/.test(__helpers.removeJSComments(code)) && + /let b = 12;/.test(__helpers.removeJSComments(code)) && + /let c = 4\.6;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md index 6af96e9ecf2..3f0e2844228 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md @@ -48,14 +48,14 @@ assert(c === 2); 各変数で `-=` 演算子を使用してください。 ```js -assert(code.match(/-=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/-=/g).length === 3); ``` 指定のコメントより上にあるコードを変更しないでください。 ```js assert( - /let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code) + /let a = 11;/.test(__helpers.removeJSComments(code)) && /let b = 9;/.test(__helpers.removeJSComments(code)) && /let c = 3;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md index da94ff9e293..bc6e3565149 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md @@ -47,19 +47,19 @@ assert(myStr === 'This is the start. This is the end.'); `+` 演算子を使用して `myStr` を作成する必要があります。 ```js -assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g)); +assert(__helpers.removeJSComments(code).match(/(["']).*\1\s*\+\s*(["']).*\2/g)); ``` `const` キーワードを使用して `myStr` を作成する必要があります。 ```js -assert(/const\s+myStr/.test(code)); +assert(/const\s+myStr/.test(__helpers.removeJSComments(code))); ``` 結果を `myStr` 変数に代入する必要があります。 ```js -assert(/myStr\s*=/.test(code)); +assert(/myStr\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index cb447743050..53ec8a7bfcc 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -43,7 +43,7 @@ assert(myStr === 'This is the first sentence. This is the second sentence.'); `+=` 演算子を使用して `myStr` を作成する必要があります。 ```js -assert(code.match(/myStr\s*\+=\s*(["']).*\1/g)); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*(["']).*\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md index 9927b79ae31..14731028044 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md @@ -35,7 +35,7 @@ assert(typeof myName !== 'undefined' && myName.length > 2); 2つの `+` 演算子を使用して、`myName` を挿入した `myStr` を作成する必要があります。 ```js -assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); +assert(__helpers.removeJSComments(code).match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md index 4b75b29b3b6..4c5eb519ff8 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md @@ -34,13 +34,13 @@ for (let i = 10; i > 0; i -= 2) { この作業では `for` ループを使用してください。 ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` 配列メソッド `push` を使用してください。 ```js -assert(code.match(/myArray.push/)); +assert(__helpers.removeJSComments(code).match(/myArray.push/)); ``` `myArray` は `[9, 7, 5, 3, 1]` となる必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md index fa868c96e6f..af6ec718a94 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md @@ -37,7 +37,7 @@ var ourName; `myName` を `var` キーワードで宣言し、末尾にセミコロンを付ける必要があります。 ```js -assert(/var\s+myName\s*;/.test(code)); +assert(/var\s+myName\s*;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md index cee75294562..2a7bc0c9db3 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md @@ -38,25 +38,25 @@ assert(myVar === 10); `myVar = myVar - 1;` を書き換える必要があります。 ```js -assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); ``` `myVar` に `10` を代入してはいけません。 ```js -assert(!code.match(/myVar\s*=\s*10.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*10.*?;?/)); ``` `myVar` には `--` 演算子を使用する必要があります。 ```js -assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code)); +assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(__helpers.removeJSComments(code))); ``` 指定されたコメントより上のコードを変更してはいけません。 ```js -assert(/let myVar = 11;/.test(code)); +assert(/let myVar = 11;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md index fd7921ef4d9..7cc9f0740bd 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md @@ -55,7 +55,7 @@ assert(typeof myDog === 'object' && myDog.tails === undefined); `myDog` の設定を変更しないでください。 ```js -assert(code.match(/"tails": 1/g).length > 0); +assert(__helpers.removeJSComments(code).match(/"tails": 1/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md index 1f1cf2f0b3c..e1d11e45d0e 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md @@ -26,13 +26,13 @@ assert(quotient === 2.2); `/` 演算子を使用して 4.4 を 2.0 で割る必要があります。 ```js -assert(/4\.40*\s*\/\s*2\.*0*/.test(code)); +assert(/4\.40*\s*\/\s*2\.*0*/.test(__helpers.removeJSComments(code))); ``` 変数 quotient には一度だけ代入してください。 ```js -assert(code.match(/quotient\s*=/g).length === 1); +assert(__helpers.removeJSComments(code).match(/quotient\s*=/g).length === 1); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md index ea5bfc99019..249177de391 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md @@ -35,7 +35,7 @@ assert(quotient === 2); `/` 演算子を使用してください。 ```js -assert(/\d+\s*\/\s*\d+/.test(code)); +assert(/\d+\s*\/\s*\d+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md index 30dd0dc9fa2..7d639ceeb12 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md @@ -36,7 +36,7 @@ I am a "double quoted" string inside "double quotes". 2 つのダブルクォート (`"`) と 4 つのエスケープされたダブルクォート (`\"`) を使用する必要があります。 ```js -assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2); +assert(__helpers.removeJSComments(code).match(/\\"/g).length === 4 && __helpers.removeJSComments(code).match(/[^\\]"/g).length === 2); ``` 変数 `myStr` は文字列 `I am a "double quoted" string inside "double quotes".` になる必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md index 2107b9e97ab..36e17e18337 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md @@ -29,8 +29,8 @@ console.log("Alan Peter".length); ```js assert( - code.match(/let lastNameLength = 0;/) && - code.match(/const lastName = "Lovelace";/) + __helpers.removeJSComments(code).match(/let lastNameLength = 0;/) && + __helpers.removeJSComments(code).match(/const lastName = "Lovelace";/) ); ``` @@ -43,7 +43,7 @@ assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8); `lastName.length` のように、`.length` を使用して `lastName` の長さを取得する必要があります。 ```js -assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/)); +assert(__helpers.removeJSComments(code).match(/=\s*lastName\.length/g) && !__helpers.removeJSComments(code).match(/lastName\s*=\s*8/)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md index 734187bd96c..48d80dd8342 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md @@ -39,7 +39,7 @@ dashedName: finding-a-remainder-in-javascript 変数 `remainder` を初期化する必要があります。 ```js -assert(/(const|let|var)\s+?remainder/.test(code)); +assert(/(const|let|var)\s+?remainder/.test(__helpers.removeJSComments(code))); ``` `remainder` の値は `2` になる必要があります。 @@ -51,7 +51,7 @@ assert(remainder === 2); `%` 演算子を使用してください。 ```js -assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code)); +assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md index f8235f20b58..c9997bef4b9 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md @@ -36,7 +36,7 @@ assert((randomFraction() + '').match(/\./g)); `Math.random` を使用して、小数の乱数を生成する必要があります。 ```js -assert(code.match(/Math\.random/g).length >= 0); +assert(__helpers.removeJSComments(code).match(/Math\.random/g).length >= 0); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md index 348c48d34ec..a3431a5f1a0 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md @@ -46,22 +46,22 @@ assert( `Math.random` を使用して、乱数を生成する必要があります。 ```js -assert(code.match(/Math.random/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.random/g).length >= 1); ``` You should have multiplied the result of `Math.random` by 10 to make it a number in the range from zero to nine. ```js assert( - code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || - code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) + __helpers.removeJSComments(code).match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || + __helpers.removeJSComments(code).match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) ); ``` `Math.floor` を使用して、小数点以下の端数を切り捨てる必要があります。 ```js -assert(code.match(/Math.floor/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.floor/g).length >= 1); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md index ae58c37ea89..9aacc665ee0 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md @@ -49,10 +49,10 @@ assert(randomRange(0, 1) % 1 === 0); assert( (function () { if ( - code.match(/myMax/g).length > 1 && - code.match(/myMin/g).length > 2 && - code.match(/Math.floor/g) && - code.match(/Math.random/g) + __helpers.removeJSComments(code).match(/myMax/g).length > 1 && + __helpers.removeJSComments(code).match(/myMin/g).length > 2 && + __helpers.removeJSComments(code).match(/Math.floor/g) && + __helpers.removeJSComments(code).match(/Math.random/g) ) { return true; } else { diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md index 3f82b9d4eba..a0eb7d9ac57 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md @@ -36,7 +36,7 @@ assert(myGlobal === 10); `myGlobal` は `let` キーワードまたは `const` キーワードを使用して宣言する必要があります。 ```js -assert(/(let|const)\s+myGlobal/.test(code)); +assert(/(let|const)\s+myGlobal/.test(__helpers.removeJSComments(code))); ``` `oopsGlobal` はグローバル変数で、値は `5` である必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md index f95661799c5..cf584ed6db8 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md @@ -45,7 +45,7 @@ assert(myOutfit() === 'sweater'); return ステートメントを変更してはいけません。 ```js -assert(/return outerWear/.test(code)); +assert(/return outerWear/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md index 301e59bdc45..3ca0588d2c6 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md @@ -39,20 +39,20 @@ assert(myVar === 88); ```js assert( - /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(code) + /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(__helpers.removeJSComments(code)) ); ``` `++` 演算子を使用する必要があります。 ```js -assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code)); +assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(__helpers.removeJSComments(code))); ``` 指定のコメントより上にあるコードを変更しないでください。 ```js -assert(/let myVar = 87;/.test(code)); +assert(/let myVar = 87;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md index 56464f48a60..547db48eede 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md @@ -26,7 +26,7 @@ var myVar = 0; `a` を値 `9` で初期化する必要があります。 ```js -assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code)); +assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md index e9a8a93887e..ea5e852caa2 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md @@ -30,20 +30,20 @@ if (num > 15) { 2 つ以上の `else` ステートメントを記述する必要があります。 ```js -assert(code.match(/else/g).length > 1); +assert(__helpers.removeJSComments(code).match(/else/g).length > 1); ``` 2 つ以上の `if` ステートメントを記述する必要があります。 ```js -assert(code.match(/if/g).length > 1); +assert(__helpers.removeJSComments(code).match(/if/g).length > 1); ``` `if else` コードブロックごとに開始と終了の中括弧を置く必要があります。 ```js assert( - code.match( + __helpers.removeJSComments(code).match( /if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/ ) ); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md index b40f77070c0..a57fa7bfb7c 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md @@ -28,13 +28,13 @@ if (num > 10) { エディターでは 1 つの `if` ステートメントのみを記述する必要があります。 ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `else` ステートメントを使用する必要があります。 ```js -assert(/else/g.test(code)); +assert(/else/g.test(__helpers.removeJSComments(code))); ``` `testElse(4)` は文字列 `5 or Smaller` を返す必要があります。 @@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5'); 指定のコメントの上または下のコードを変更しないでください。 ```js -assert(/let result = "";/.test(code) && /return result;/.test(code)); +assert(/let result = "";/.test(__helpers.removeJSComments(code)) && /return result;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md index 37cf3c3bf5b..aea5c7f4fd6 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md @@ -32,7 +32,7 @@ for (let i = 0; i < 10; i += 2) { この作業には `for` ループを使用してください。 ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` は `[1, 3, 5, 7, 9]` になる必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md index 5f2b85751eb..0853dbdd081 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md @@ -30,7 +30,7 @@ for (let i = 0; i < arr.length; i++) { `total` を宣言し、0 に初期化する必要があります。 ```js -assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); ``` `total` は 20 と等しくなる必要があります。 @@ -42,13 +42,13 @@ assert(total === 20); `for` ループを使用して、`myArr` の繰り返し処理を行う必要があります。 ```js -assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code)); +assert(/for\s*\(/g.test(__helpers.removeJSComments(code)) && /myArr\s*\[/g.test(__helpers.removeJSComments(code))); ``` 値 20 を直接 `total` に代入しないでください。 ```js -assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm)); +assert(!__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/total[=+-]0*[1-9]+/gm)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md index 91f27d15f9f..a31a6107e9a 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md @@ -56,7 +56,7 @@ do { この課題には `do...while` ループを使用してください。 ```js -assert(code.match(/do/g)); +assert(__helpers.removeJSComments(code).match(/do/g)); ``` `myArray` は `[10]` に等しくなる必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md index 2c678b38f91..3680fe69724 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md @@ -44,7 +44,7 @@ for (let i = 0; i < 5; i++) { この課題には `for` ループを使用してください。 ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` は `[1, 2, 3, 4, 5]` となる必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md index 3a15fb63364..ef158c32c9d 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md @@ -36,7 +36,7 @@ while ループを利用して配列に値を push してみましょう。 この課題には `while` ループを使用してください。 ```js -assert(code.match(/while/g)); +assert(__helpers.removeJSComments(code).match(/while/g)); ``` `myArray` は `[5, 4, 3, 2, 1, 0]` となる必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index 4b48c396f30..1bce08eff9c 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -48,7 +48,7 @@ assert.throws(declared, ReferenceError); ```js assert( /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( - __helpers.removeWhiteSpace(code) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)) ) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md index c7ac8374e71..836219701f5 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md @@ -47,7 +47,7 @@ assert( `myArray` で `pop()` を使用する必要があります。 ```js -assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code)); +assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(__helpers.removeJSComments(code))); ``` `removedFromMyArray` は `["cat", 2]` のみを含む必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md index 5d5603f1ed6..90d864255f7 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md @@ -52,7 +52,7 @@ assert( ```js assert( (function () { - if (code.match(/myArray\[0\]\s*=\s*/g)) { + if (__helpers.removeJSComments(code).match(/myArray\[0\]\s*=\s*/g)) { return true; } else { return false; diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md index 06dfe59f421..5dd2b4de2b8 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md @@ -94,13 +94,13 @@ assert(sequentialSizes(9) === 'High'); `if` ステートメントまたは `else` ステートメントを使用しないでください。 ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` 9 つの `case` ステートメントが必要です。 ```js -assert(code.match(/case/g).length === 9); +assert(__helpers.removeJSComments(code).match(/case/g).length === 9); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md index 4946ab96b5b..80bfc50bbe9 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md @@ -28,7 +28,7 @@ assert(product === 5.0); `*` 演算子を使用する必要があります。 ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md index 9a9b6126c09..a0da35da923 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md @@ -36,7 +36,7 @@ assert(product === 80); `*` 演算子を使用する必要があります。 ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md index 89a34ca54fd..c88d020eb46 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md @@ -60,7 +60,7 @@ assert(logOutput == 16); ```js assert( /functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test( - code.replace(/\s/g, '') + __helpers.removeJSComments(code).replace(/\s/g, '') ) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md index 79c1c063e37..ccc78857864 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md @@ -47,7 +47,7 @@ assert(compareEquality('20', 20) === 'Not Equal'); `===` 演算子を使用してください。 ```js -assert(code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index 1a4e470ef15..abd4de8c398 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -47,7 +47,7 @@ const badStr = 'Finn responds, "Let's go!"'; ```js assert( - !/\\/g.test(code) && + !/\\/g.test(__helpers.removeJSComments(code)) && myStr.match( '\\s*\\s*Link\\s*\\s*' ) @@ -57,7 +57,7 @@ assert( 2 つのシングルクォート `'` と 4 つのダブルクォート `"` を使用する必要があります。 ```js -assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2); +assert(__helpers.removeJSComments(code).match(/"/g).length === 4 && __helpers.removeJSComments(code).match(/'/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index e6d56c825b9..0baffe3eadb 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,7 +66,7 @@ assert.equal(sum([2, 3, 4, 5], 3), 9); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md index 003cc0b74d3..1dc3d4fcdbd 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md @@ -45,19 +45,19 @@ switch (val) { プログラムにはどんな `else` ステートメントも使用しないでください。 ```js -assert(!/else/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code))); ``` プログラムにはどんな `if` ステートメントも使用しないでください。 ```js -assert(!/if/g.test(code)); +assert(!/if/g.test(__helpers.removeJSComments(code))); ``` 少なくとも 4 つの `break` ステートメントを含める要があります。 ```js -assert(code.match(/break/g).length >= 4); +assert(__helpers.removeJSComments(code).match(/break/g).length >= 4); ``` `chainToSwitch("bob")` は文字列 `Marley` を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md index 64a61d88ca2..25853cca3d2 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md @@ -52,7 +52,7 @@ assert(isLess(15, 10) === false); `if` ステートメントまたは `else` ステートメントを使用しないでください。 ```js -assert(!/if|else/g.test(code)); +assert(!/if|else/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md index 273d28fce81..f5a0e525b5f 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md @@ -63,13 +63,13 @@ assert(caseInSwitch(4) === 'delta'); `if` ステートメントまたは `else` ステートメントを使用しないでください。 ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` 少なくとも 3 つの `break` ステートメントを記述する必要があります。 ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md index 675f11c3680..900dc9e94bf 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md @@ -35,7 +35,7 @@ myVar = 5; 指定のコメントより上にあるコードを変更しないでください。 ```js -assert(/var a;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code))); ``` `a` の値は 7 である必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md index 79eac1bcfba..61300b4b9b8 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md @@ -35,7 +35,7 @@ assert(difference === 12); `45` から 1 つの数値だけを引いてください。 ```js -assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code))); +assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md index d13b03bed6d..56b9388786b 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md @@ -40,7 +40,7 @@ assert(myStr === 'Hello World'); 指定のコメントより上にあるコードを変更しないでください。 ```js -assert(/myStr = "Jello World"/.test(code)); +assert(/myStr = "Jello World"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md index 2f673d3fdda..ffcb969c274 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md @@ -56,19 +56,19 @@ assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000); `studlyCapVar` は宣言部分と割り当て部分の両方でキャメルケースを使用する必要があります。 ```js -assert(code.match(/studlyCapVar/g).length === 2); +assert(__helpers.removeJSComments(code).match(/studlyCapVar/g).length === 2); ``` `properCamelCase` は宣言部分と割り当て部分の両方でキャメルケースを使用する必要があります。 ```js -assert(code.match(/properCamelCase/g).length === 2); +assert(__helpers.removeJSComments(code).match(/properCamelCase/g).length === 2); ``` `titleCaseOver` は宣言部分と割り当て部分の両方でキャメルケースを使用する必要があります。 ```js -assert(code.match(/titleCaseOver/g).length === 2); +assert(__helpers.removeJSComments(code).match(/titleCaseOver/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index 00dda8d64f2..34dfa7cf6c0 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -39,9 +39,9 @@ assert(!/undefined/.test(c) && c === 'I am a String!'); ```js assert( - /a = a \+ 1;/.test(code) && - /b = b \+ 5;/.test(code) && - /c = c \+ " String!";/.test(code) + /a = a \+ 1;/.test(__helpers.removeJSComments(code)) && + /b = b \+ 5;/.test(__helpers.removeJSComments(code)) && + /c = c \+ " String!";/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md index a171260570d..aa69217c168 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md @@ -39,7 +39,7 @@ assert(/happy coder/gi.test(myDog.name)); `myDog` の定義を編集しないでください。 ```js -assert(/"name": "Coder"/.test(code)); +assert(/"name": "Coder"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md index 8b40125feb7..1e7cb381f7d 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md @@ -41,7 +41,7 @@ assert(firstLetterOfLastName === 'L'); ブラケット記法を使用してください。 ```js -assert(code.match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md index 9fec24f60e1..c01df01ebc2 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(lastLetterOfLastName === 'e'); `.length` を使用して、最後の文字を取得する必要があります。 ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md index 08735479c72..1fbe3c516f7 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md @@ -39,7 +39,7 @@ assert(thirdLetterOfLastName === 'v'); ブラケット記法を使用してください。 ```js -assert(code.match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md index f9bd7ec1c5d..60d5fc55abe 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(secondToLastLetterOfLastName === 'c'); `.length` を使用して、最後から 2 番目の文字を取得する必要があります。 ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md index b86202c7549..f4060d374ef 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md @@ -54,7 +54,7 @@ function findGreaterOrEqual(a, b) { `checkSign` で複数条件演算子を使用する必要があります ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(__helpers.removeJSComments(code))); ``` `checkSign(10)` は文字列 `positive` を返す必要があります。 大文字の記述が重要であることに注意してください。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index 0819dd030db..0d0dcdb2e94 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,7 +59,7 @@ assert.deepStrictEqual(countdown(5), [5, 4, 3, 2, 1]); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index 5a2773b16d3..01e390e8ea4 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,7 +26,7 @@ assert(Array.isArray(rangeOfNumbers(5, 10))); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index 7ba570768e6..ad9c9f72872 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -42,7 +42,7 @@ function findGreater(a, b) { `checkEqual` では条件演算子を使用する必要があります。 ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(__helpers.removeJSComments(code))); ``` `checkEqual(1, 2)` は文字列 `Not Equal` を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md index 33579e1d2d4..f4279502cf2 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md @@ -34,7 +34,7 @@ radix 変数により、基数が 2 であり、`11` が 2 進数であること `convertToInteger` では `parseInt()` 関数を使用する必要があります。 ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("10011")` は数値を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md index 5537ad688b2..2d4a77010d3 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md @@ -26,7 +26,7 @@ const a = parseInt("007"); `convertToInteger` では `parseInt()` 関数を使用する必要があります。 ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("56")` は数値を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md index 396c7b3f37b..5d725fcb7b0 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md @@ -83,14 +83,14 @@ assert(typeof phoneticLookup('') === 'undefined'); `return` ステートメントを変更しないでください。 ```js -assert(code.match(/return\sresult;/)); +assert(__helpers.removeJSComments(code).match(/return\sresult;/)); ``` `case` ステートメント、`switch` ステートメント、`if` ステートメントを使用しないでください。 ```js assert( - !/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) + !/case|switch|if/g.test(__helpers.removeJSComments(code).replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md index ddc650094fb..b5007552fbd 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md @@ -53,7 +53,7 @@ assert( `wordBlanks` を作成するために、`dog`、`ran`、`big`、`quickly` の値を直接使用しないでください。 ```js -const newCode = removeAssignments(code); +const newCode = removeAssignments(__helpers.removeJSComments(code)); assert( !/dog/.test(newCode) && !/ran/.test(newCode) && diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md index 72e87e5aa6f..0ea6d7fa59f 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md @@ -50,7 +50,7 @@ assert(testConsole()); ```js const functionStr = reusableFunction && __helpers.removeWhiteSpace(reusableFunction.toString()); -const codeWithoutFunction = __helpers.removeWhiteSpace(code).replace(/reusableFunction\(\)\{/g, ''); +const codeWithoutFunction = __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).replace(/reusableFunction\(\)\{/g, ''); assert(/reusableFunction\(\)/.test(codeWithoutFunction)); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md index fb93b95e9d5..202b42ba825 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md @@ -25,7 +25,7 @@ assert(power == 8); コードで `raiseToPower` 関数を呼び出すときに、引数を正しい順序で使用する必要があります。 ```js -assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); +assert(__helpers.removeJSComments(code).match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md index 6a3f7ea1773..23ccb02aaf3 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md @@ -37,7 +37,7 @@ assert(result == 9); `getNine` 関数を呼び出す必要があります。 ```js -assert(code.match(/getNine\(\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/getNine\(\)/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md index cdc5732e21d..8ce3d08ac08 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md @@ -27,25 +27,25 @@ assert(netWorkingCapital === 2); コード内の変数にスペルミスがあってはいけません。 ```js -assert(!code.match(/recievables/g)); +assert(!__helpers.removeJSComments(code).match(/recievables/g)); ``` `receivables` 変数をコードで正しく宣言して使用する必要があります。 ```js -assert(code.match(/receivables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/receivables/g).length == 2); ``` コード内の変数にスペルミスがあってはいけません。 ```js -assert(!code.match(/payable;/g)); +assert(!__helpers.removeJSComments(code).match(/payable;/g)); ``` `payables` 変数をコードで正しく宣言して使用する必要があります。 ```js -assert(code.match(/payables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/payables/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index 09850ab74b1..07e9eb5e7db 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -37,13 +37,13 @@ const allSameQuotes = 'I\'ve had a perfectly wonderful evening, but this wasn\'t `href` の値 `#Home` を囲む引用符を変更するか、またはエスケープして、コードを修正します。 ```js -assert(code.match(//g)); +assert(__helpers.removeJSComments(code).match(//g)); ``` 文字列全体をダブルクォートで囲みます。 ```js -assert(code.match(/"

.*?<\/p>";/g)); +assert(__helpers.removeJSComments(code).match(/"

.*?<\/p>";/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md index 0c14b9a6e0c..e864ed8c6d3 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md @@ -37,25 +37,25 @@ for (let k = 0; k < len; k++) { ループが最初のインデックスから開始するように、ループの初期条件を設定します。 ```js -assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?=\s*?0\s*?;/g).length == 1); ``` インデックスが 0 から始まるように、ループの初期条件を修正します。 ```js -assert(!code.match(/i\s?=\s*?1\s*?;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s?=\s*?1\s*?;/g)); ``` ループが最後のインデックスで止まるように、ループの終了条件を設定します。 ```js -assert(code.match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); ``` ループが length の 1 つ前で止まるように、ループの終了条件を修正します。 ```js -assert(!code.match(/i\s*?<=\s*?len;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?<=\s*?len;/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md index 63590caed84..b22bb0c3f83 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md @@ -21,7 +21,7 @@ dashedName: catch-unclosed-parentheses-brackets-braces-and-quotes 配列で欠けているペアを修正する必要があります。 ```js -assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); +assert(__helpers.removeJSComments(code).match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); ``` `.reduce()` メソッドで欠けている部分を修正する必要があります。 コンソール出力に `Sum of array values is: 6` と表示する必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md index 4f94fd87057..8de044243dc 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md @@ -43,7 +43,7 @@ assert(result == 'Not equal!'); 等しいかどうかをテストするために `==` または `===` を使用する必要があります。 ```js -assert(code.match(/x\s*?===?\s*?y/g)); +assert(__helpers.removeJSComments(code).match(/x\s*?===?\s*?y/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md index ca403e5a9a8..a92f363a1d2 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md @@ -31,13 +31,13 @@ function loopy() { `for` ループの終了条件 (真ん中の部分) の比較演算子を変更する必要があります。 ```js -assert(code.match(/i\s*?<=\s*?4;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?<=\s*?4;/g).length == 1); ``` ループの終了条件にある比較演算子を修正する必要があります。 ```js -assert(!code.match(/i\s*?!=\s*?4;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?!=\s*?4;/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index 30d0481cd32..2313482172f 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -23,7 +23,7 @@ dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-c `console.log` を使用して `output` 変数を出力します。 ```js -assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/console\.log\(output\)/)); ``` `console.clear()` を使用してブラウザーのコンソールをクリアします。 @@ -31,7 +31,7 @@ assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console.clear\(\)/) ); ``` @@ -41,7 +41,7 @@ assert( ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console\.log\(output\)[\s\S]*console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md index dda301fc117..dfbf7e09b26 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md @@ -29,7 +29,7 @@ console.log('Hello world!'); 変数 `a` の値を確認するために `console.log()` を使用する必要があります。 ```js -assert(code.match(/console\.log\(a\)/g)); +assert(__helpers.removeJSComments(code).match(/console\.log\(a\)/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md index 91dc7cd2b96..c5a27bf5635 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md @@ -32,19 +32,19 @@ JavaScript は 7 つのプリミティブな (イミュータブル) データ 2 つの `console.log()` ステートメントで `typeof` を使用して変数の型を確認する必要があります。 ```js -assert(code.match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); ``` `typeof` を使用して変数 `seven` の型を確認する必要があります。 ```js -assert(code.match(/typeof[\( ]seven\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]seven\)?/g)); ``` `typeof` を使用して変数 `three` の型を確認する必要があります。 ```js -assert(code.match(/typeof[\( ]three\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]three\)?/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index 9b8780dac23..45d0b73424e 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -87,13 +87,13 @@ console.log(i); `var` をコードに入れてはいけません。 ```js -assert(!code.match(/var/g)); +assert(!__helpers.removeJSComments(code).match(/var/g)); ``` `if` ステートメント内で宣言された変数 `i` は、文字列 `block scope` になる必要があります。 ```js -assert(code.match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); +assert(__helpers.removeJSComments(code).match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); ``` `checkScope()` は、文字列 `function scope` を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index cb7fab47206..d75f23e9bcf 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,7 +32,7 @@ const myPromise = new Promise((resolve, reject) => { ```js assert( - code.match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) ); ``` @@ -40,7 +40,7 @@ assert( ```js assert( - code.match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md index 33a6c38fc32..1ee76f2d42d 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md @@ -32,7 +32,7 @@ assert(makeServerRequest instanceof Promise); ```js assert( - code.match( + __helpers.removeJSComments(code).match( /Promise\s*\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g ) ); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md index 6041c4fd882..2bcf2c8489b 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md @@ -25,14 +25,14 @@ type が `module` のスクリプトを HTML ドキュメントに追加し、`i `script` タグを作成する必要があります。 ```js -assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); +assert(__helpers.removeJSComments(code).match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); ``` `script` タグに、`module` という値を設定した `type` 属性を持たせる必要があります。 ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g ) ); @@ -42,7 +42,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g ) ); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md index c197093fa4d..6a026af7536 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md @@ -38,7 +38,7 @@ export default function(x, y) { ```js assert( - code.match( + __helpers.removeJSComments(code).match( /export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g ) ); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md index c9f6b95f786..9129cd93465 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md @@ -75,7 +75,7 @@ assert.match(code, /(`.*\${.*}.*`)/); イテレーターを使用する必要があります。 ```js -assert(code.match(/for|map|reduce|forEach|while/)); +assert(__helpers.removeJSComments(code).match(/for|map|reduce|forEach|while/)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md index 4ef1ad8935b..986f6b9c8fd 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md @@ -34,7 +34,7 @@ myPromise.then(result => { ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.then\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.then\(/g) ); ``` @@ -50,7 +50,7 @@ assert(resultIsParameter); assert( resultIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.then\(.*?result.*?console.log\(result\).*?\)/) ); ``` @@ -60,7 +60,7 @@ assert( ## --after-user-code-- ```js -const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(code)); +const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md index 1891c0ab3c6..7d348fd1078 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md @@ -28,7 +28,7 @@ myPromise.catch(error => { ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.catch\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.catch\(/g) ); ``` @@ -44,7 +44,7 @@ assert(errorIsParameter); assert( errorIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.catch\(.*?error.*?console.log\(error\).*?\)/) ); ``` @@ -54,7 +54,7 @@ assert( ## --after-user-code-- ```js -const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(code)); +const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md index 6e3e8a06821..e5b0946778d 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md @@ -25,7 +25,7 @@ import add from "./math_functions.js"; `math_functions.js` から `subtract` を適切にインポートする必要があります。 ```js -assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); +assert(__helpers.removeJSComments(code).match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md index 46f90f7d9f3..0a927a8e28a 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md @@ -36,19 +36,19 @@ console.log(s); `const` キーワードを置き換えないでください。 ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `s` は (`const` を使用して宣言した) 定数変数である必要があります。 ```js -assert(code.match(/const\s+s/g)); +assert(__helpers.removeJSComments(code).match(/const\s+s/g)); ``` 元の配列宣言を変更しないでください。 ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g )); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md index fb115be85b6..bc398889b48 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md @@ -34,19 +34,19 @@ console.log(obj); `const` キーワードを置き換えないでください。 ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `MATH_CONSTANTS` は (`const` を使用して宣言した) 定数変数である必要があります。 ```js -assert(code.match(/const\s+MATH_CONSTANTS/g)); +assert(__helpers.removeJSComments(code).match(/const\s+MATH_CONSTANTS/g)); ``` `MATH_CONSTANTS` の元の宣言を変更しないでください。 ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g )); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md index f8de22a1250..5d324d6af62 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md @@ -32,7 +32,7 @@ import { add, subtract } from './math_functions.js'; ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); @@ -42,7 +42,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index 50243c7db94..424d54b40bb 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -44,7 +44,7 @@ assert(increment(5) === 6); `value` に対して デフォルトパラメーター値 `1` を使用する必要があります。 ```js -assert(code.match(/value\s*=\s*1/g)); +assert(__helpers.removeJSComments(code).match(/value\s*=\s*1/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md index fdac12da576..8a98346b1ba 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md @@ -31,7 +31,7 @@ myMathModule.subtract(5,3); ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g ) ); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index a1956a1f7d0..40667a25bca 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -66,7 +66,7 @@ assert( `class` キーワードを使用する必要があります。 ```js -assert(code.match(/class/g)); +assert(__helpers.removeJSComments(code).match(/class/g)); ``` `Vegetable` をインスタンス化できる必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md index 08068f82a95..53926b38796 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md @@ -51,7 +51,7 @@ assert(b === 8); 配列の分割を使用して `a` と `b` を入れ替える必要があります。 ```js -assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code)); +assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index e9633c3535f..95e138df592 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -43,8 +43,8 @@ ES5 の代入構文を削除する必要があります。 ```js assert( - !code.match(/lowToday = LOCAL_FORECAST\.today\.low/g) && - !code.match(/highToday = LOCAL_FORECAST\.today.high/g) + !__helpers.removeJSComments(code).match(/lowToday = LOCAL_FORECAST\.today\.low/g) && + !__helpers.removeJSComments(code).match(/highToday = LOCAL_FORECAST\.today.high/g) ); ``` @@ -52,7 +52,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(low\s*:\s*lowToday[^}]*|[^,]*,\s*low\s*:\s*lowToday\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); @@ -62,7 +62,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday,?\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index 4fa2ea726d6..3b4e7cb9d2e 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -34,8 +34,8 @@ ES5 の代入構文を削除する必要があります。 ```js assert( - !code.match(/highToday = HIGH_TEMPERATURES\.today/g) && - !code.match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) + !__helpers.removeJSComments(code).match(/highToday = HIGH_TEMPERATURES\.today/g) && + !__helpers.removeJSComments(code).match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) ); ``` @@ -43,7 +43,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(today\s*:\s*highToday[^}]*|[^,]*,\s*today\s*:\s*highToday\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); @@ -53,7 +53,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(tomorrow\s*:\s*highTomorrow[^}]*|[^,]*,\s*tomorrow\s*:\s*highTomorrow\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 6ee8bc7753e..af71c8885e4 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,7 +43,7 @@ ES5 の代入構文を削除する必要があります。 ```js assert( - !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !__helpers.removeJSComments(code).match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -51,7 +51,7 @@ assert( ```js assert( - code.match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` @@ -59,7 +59,7 @@ assert( ```js assert( - code.match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md index 64c045317dc..56299a7c866 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md @@ -50,13 +50,13 @@ assert(half(stats) === 28.015); 分割を使用する必要があります。 ```js -assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/half=\({\w+,\w+}\)/)); ``` 分割されたパラメーターを使用する必要があります。 ```js -assert(!code.match(/stats\.max|stats\.min/)); +assert(!__helpers.removeJSComments(code).match(/stats\.max|stats\.min/)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index 7962fa73f78..b11f067a1b5 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -47,7 +47,7 @@ assert.deepEqual(_testArr, [1, 2, 3, 4, 5]) `Array.slice()` は使用しないでください。 ```js -assert(!code.match(/\.\s*slice\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*slice\s*\(/)); ``` You should use the rest syntax. diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md index 789507acbb9..75fed092d99 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md @@ -42,7 +42,7 @@ export { add, subtract }; ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+uppercaseString|export\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)})/g ) ); @@ -52,7 +52,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+lowercaseString|export\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)})/g ) ); diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md index 58b7fcb0dee..4f38dea30ee 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md @@ -57,7 +57,7 @@ assert(sum() === 0); `sum` は、`args` パラメーターで残余引数の構文 (`...`) を使用するアロー関数にする必要があります。 ```js -assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/sum=\(\.\.\.args\)=>/)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md index 6d4a4c59a55..b7cb0769d53 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md @@ -55,7 +55,7 @@ assert(arr2.every((v, i) => v === arr1[i]) && arr2.length); `...` spread operator should be used to duplicate `arr1`. ```js -assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); +assert(__helpers.removeJSComments(code).match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); ``` `arr2` should remain unchanged when `arr1` is changed. diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md index c4527aa57fd..346e71031e5 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md @@ -54,7 +54,7 @@ assert.match(code, /const\s+myConcat/g); ```js assert( - /myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) && + /myConcat=\(\w+,\w+\)=>/.test(__helpers.removeJSComments(code).replace(/\s/g, '')) && typeof myConcat === 'function' ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index a3bb3d5cd98..cf52b26ba03 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,14 +39,14 @@ const person = { 従来の関数式は使用しないでください。 ```js -assert(!code.match(/function/)); +assert(!__helpers.removeJSComments(code).match(/function/)); ``` `setGear` は宣言的な関数にする必要があります。 ```js assert( - typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/) + typeof bicycle.setGear === 'function' && __helpers.removeJSComments(code).match(/setGear\s*\(.+\)\s*\{/) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md index b810b784072..bf36b28c662 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md @@ -43,7 +43,7 @@ assert.deepEqual( コードでは `key:value` の形式を使用しないでください。 ```js -assert(!code.match(/:/g)) +assert(!__helpers.removeJSComments(code).match(/:/g)) ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md index 9f3ddaa6d4f..ef8a3fb6177 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md @@ -30,13 +30,13 @@ arr.push(4, 5, 6); コードで `concat` メソッドを使用する必要があります。 ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` コードで `push` メソッドを使用しないでください。 ```js -assert(!code.match(/\.?[\s\S]*?push/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?push/g)); ``` `first` 配列を変更しないようにする必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md index 0f196a638b0..a072c63b328 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md @@ -31,7 +31,7 @@ dashedName: apply-functional-programming-to-convert-strings-to-url-slugs このチャレンジに `replace` メソッドを使用しないでください。 ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `urlSlug("Winter Is Coming")` は文字列 `winter-is-coming` を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md index 26c79854bca..99e736da82f 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md @@ -27,13 +27,13 @@ const str = arr.join(" "); コードでは `join` メソッドを使用する必要があります。 ```js -assert(code.match(/\.join/g)); +assert(__helpers.removeJSComments(code).match(/\.join/g)); ``` `replace` メソッドを使用しないでください。 ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `sentensify("May-the-force-be-with-you")` は文字列を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md index 4ca1a201ead..803cc4912a3 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md @@ -25,7 +25,7 @@ dashedName: combine-two-arrays-using-the-concat-method コードでは `concat` メソッドを使用する必要があります。 ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` `first` 配列は変更しないでください。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md index 5cc935a21d1..e8b174907ca 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md @@ -47,7 +47,7 @@ assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_ `map` メソッドは使用しないでください。 ```js -assert(!code.match(/\.?[\s\S]*?map/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?map/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md index 8bbf85215c3..e8ec75404bd 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md @@ -43,7 +43,7 @@ assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFi `filter` メソッドを使用しないでください。 ```js -assert(!code.match(/\.?[\s\S]*?filter/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?filter/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md index 9bf76be6d5c..32f1ddee2f3 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md @@ -77,7 +77,7 @@ assert(add(11)(22)(33) === 66); コードの最後には、`x + y + z` を返すステートメントを含める必要があります。 ```js -assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); +assert(__helpers.removeJSComments(code).match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md index 5a27ae583f3..e2de4f864ea 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md @@ -30,13 +30,13 @@ cities.splice(3, 1); コードで `slice` メソッドを使用する必要があります。 ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` コードで `splice` メソッドを使用しないでください。 ```js -assert(!code.match(/\.?[\s\S]*?splice/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?splice/g)); ``` You should not mutate the original array passed to the function. diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md index f89bbab07b4..57c35786419 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md @@ -28,7 +28,7 @@ const newArray = arr.slice(1, 3); コードで `slice` メソッドを使用する必要があります。 ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` `inputAnim` 変数は変更しないでください。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md index 795292af6f3..91b82b562a1 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md @@ -47,7 +47,7 @@ JavaScript のデフォルトのソート方法で基準となるのは文字列 コードで `sort` メソッドを使用する必要があります。 ```js -assert(code.match(/\.sort/g)); +assert(__helpers.removeJSComments(code).match(/\.sort/g)); ``` `alphabeticalOrder(["a", "d", "c", "a", "z", "g"])` は `["a", "a", "c", "d", "g", "z"]` を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md index fad5fde51b5..226923966cb 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md @@ -33,7 +33,7 @@ const byDigits = otherString.split(/\d/); コードで `split` メソッドを使用する必要があります。 ```js -assert(code.match(/\.split/g)); +assert(__helpers.removeJSComments(code).match(/\.split/g)); ``` `splitify("Hello World,I-am code")` は `["Hello", "World", "I", "am", "code"]` を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index b2ad5418db8..3c088bfdb3b 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), `for`、`while`、および `forEach` は使用しないでください。 ```js -assert(!code.match(/for|while|forEach/g)); +assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ``` `map`、`filter`、または `reduce` を使用する必要があります。 @@ -36,7 +36,7 @@ assert(!code.match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md index 7d34b60249f..530a8567c0f 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md @@ -31,7 +31,7 @@ numbers.every(function(currentValue) { コードで `every` メソッドを使用する必要があります。 ```js -assert(code.match(/\.every/g)); +assert(__helpers.removeJSComments(code).match(/\.every/g)); ``` `checkPositive([1, 2, 3, -4, 5])` は `false` を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md index 86e2ec0df9c..802d858e78c 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md @@ -46,13 +46,13 @@ assert( コードで `filter` メソッドを使用する必要があります。 ```js -assert(code.match(/\s*\.\s*filter/g)); +assert(__helpers.removeJSComments(code).match(/\s*\.\s*filter/g)); ``` コードで `for` ループを使用しないでください。 ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` `filteredList` は `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"}, {"title": "Batman Begins", "rating": "8.3"}]` と等しくなる必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index d34007e9a6c..415f801d702 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,13 +52,13 @@ assert( `for` ループを使用しないでください。 ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); ``` コードで `map` メソッドを使用する必要があります。 ```js -assert(code.match(/\.map/g)); +assert(__helpers.removeJSComments(code).match(/\.map/g)); ``` `ratings` は `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"},{"title": "Batman Begins", "rating": "8.3"}, {"title": "Avatar", "rating": "7.9"}]` と等しくなる必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md index 91aaeb21a08..f4b97384a49 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md @@ -66,7 +66,7 @@ assert( コードで `reduce` メソッドを使用する必要があります。 ```js -assert(code.match(/\.reduce/g)); +assert(__helpers.removeJSComments(code).match(/\.reduce/g)); ``` `getRating(watchList)` は 8.675 になる必要があります。 @@ -78,7 +78,7 @@ assert(getRating(watchList) === 8.675); コードで `for` ループを使用しないでください。 ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` `watchList` オブジェクトを変更した後、コードは正しい出力を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md index 7dc2a76aa57..99620a2c2de 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md @@ -31,7 +31,7 @@ numbers.some(function(currentValue) { コードで `some` メソッドを使用する必要があります。 ```js -assert(code.match(/\.some/g)); +assert(__helpers.removeJSComments(code).match(/\.some/g)); ``` `checkPositive([1, 2, 3, -4, 5])` は `true` を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md index d2efc6c6c94..3a7eb90b506 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md @@ -39,7 +39,7 @@ assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4]); 解答には `Array.prototype.flat()` メソッドや `Array.prototype.flatMap()` メソッドを使用しないでください。 ```js -assert(!code.match(/\.\s*flat\s*\(/) && !code.match(/\.\s*flatMap\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*flat\s*\(/) && !__helpers.removeJSComments(code).match(/\.\s*flatMap\s*\(/)); ``` グローバル変数は使用しないでください。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md index a8590632be6..bd04a1deb1a 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md @@ -49,7 +49,7 @@ Bird.prototype = { `Dog.prototype` に新しいオブジェクトを設定する必要があります。 ```js -assert(/Dog\.prototype\s*?=\s*?{/.test(code)); +assert(/Dog\.prototype\s*?=\s*?{/.test(__helpers.removeJSComments(code))); ``` `Dog.prototype` はプロパティ `numLegs` を持つ必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md index 90227b6a208..f009c49a1ff 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md @@ -61,7 +61,7 @@ assert(typeof beagle !== 'undefined'); ```js assert( /(let|const|var)\s{1,}duck\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` @@ -71,7 +71,7 @@ assert( ```js assert( /(let|const|var)\s{1,}beagle\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md index c0e781b2126..7f9ccdce3d4 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md @@ -61,7 +61,7 @@ assert.deepEqual(prototypeProps, ['numLegs']); このチャレンジは組み込みのメソッド `Object.keys()` を使用せずに解決する必要があります。 ```js -assert(!/\Object.keys/.test(code)); +assert(!/\Object.keys/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md index 31094663a91..8931ccd088c 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md @@ -43,7 +43,7 @@ assert(dog.sayLegs() === 'This dog has 4 legs.'); コードで `dog` の `numLegs` プロパティにアクセスするには、`this` キーワードを使用する必要があります。 ```js -assert(code.match(/this\.numLegs/g)); +assert(__helpers.removeJSComments(code).match(/this\.numLegs/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md index e6a13d4b80c..8ae594ca311 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md @@ -51,7 +51,7 @@ assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1); このチャレンジは組み込みのメソッド `Object.keys()` を使用せずに解決する必要があります。 ```js -assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); +assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(__helpers.removeJSComments(code))); ``` `ownProps` 配列をハードコーディングせずに、このチャレンジを解決する必要があります。 @@ -59,7 +59,7 @@ assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); ```js assert( !/\[\s*(?:'|")(?:name|numLegs)|(?:push|concat)\(\s*(?:'|")(?:name|numLegs)/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md index e9c02023d8a..f147944355f 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md @@ -55,7 +55,7 @@ assert(joinDogFraternity(new Dog('')) === true); `joinDogFraternity` では `constructor` プロパティを使用する必要があります。 ```js -assert(/\.constructor/.test(code) && !/instanceof/.test(code)); +assert(/\.constructor/.test(__helpers.removeJSComments(code)) && !/instanceof/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md index 28478e87cbd..7cdb8dc33ba 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md @@ -29,13 +29,13 @@ JavaScript では、関数を宣言したらすぐに実行するというのが 関数は無名である必要があります。 ```js -assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, ''))); +assert(/\((function|\(\))(=>|\(\)){?/.test(__helpers.removeJSComments(code).replace(/\s/g, ''))); ``` 関数の式の末尾に括弧を付けて、すぐに呼び出す必要があります。 ```js -assert(/\(.*(\)\(|\}\(\))\)/.test(code.replace(/[\s;]/g, ''))); +assert(/\(.*(\)\(|\}\(\))\)/.test(__helpers.removeJSComments(code).replace(/[\s;]/g, ''))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md index d1151ddbd52..10514ce7eba 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md @@ -42,7 +42,7 @@ duck.hasOwnProperty("name"); `Object.prototype` が `Dog.prototype` のプロトタイプであることを示す必要があります。 ```js -assert(/Object\.prototype\.isPrototypeOf/.test(code)); +assert(/Object\.prototype\.isPrototypeOf/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md index ac8cda49587..3730c19a533 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md @@ -35,7 +35,7 @@ Bird.prototype.isPrototypeOf(duck); `beagle` の `prototype` が `Dog.prototype` であることを示す必要があります。 ```js -assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code)); +assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md index 2bed5762daf..f3da8fda655 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md @@ -52,7 +52,7 @@ assert(hound instanceof Dog); `Dog` のインスタンスを作成するには、`new` 演算子を使用する必要があります。 ```js -assert(code.match(/new/g)); +assert(__helpers.removeJSComments(code).match(/new/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md index ed48648b8fb..cea3c4fe4a8 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md @@ -43,7 +43,7 @@ ducky.getHatchedEggCount(); `weight` プロパティを private 変数にして、値 `15` を割り当てる必要があります。 ```js -assert(code.match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); ``` private 変数 `weight` の値を返す `getWeight` というメソッドを `Bird` に作成する必要があります。 @@ -55,7 +55,7 @@ assert(new Bird().getWeight() === 15); `getWeight` 関数は private 変数 `weight` を返す必要があります。 ```js -assert(code.match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); +assert(__helpers.removeJSComments(code).match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md index 747aeabe58f..56d5cfb33f5 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md @@ -29,13 +29,13 @@ console.log(duck.name); `console.log` を使用して、`dog` オブジェクトの `name` プロパティの値を出力します。 ```js -assert(/console.log\(.*dog\.name.*\)/g.test(code)); +assert(/console.log\(.*dog\.name.*\)/g.test(__helpers.removeJSComments(code))); ``` `console.log` を使用して、`dog` オブジェクトの `numLegs` プロパティの値を出力します。 ```js -assert(/console.log\(.*dog\.numLegs.*\)/g.test(code)); +assert(/console.log\(.*dog\.numLegs.*\)/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md index dff40344333..7437ea8ab2f 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md @@ -53,7 +53,7 @@ assert(typeof myHouse.numBedrooms === 'number'); `instanceof` 演算子を使用して、`myHouse` が `House` のインスタンスであることを検証する必要があります。 ```js -assert(/myHouse\s*instanceof\s*House/.test(code)); +assert(/myHouse\s*instanceof\s*House/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md index 5cf45ccb5de..ec55107c583 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md @@ -75,7 +75,7 @@ assert(!myRegex.test('EleanorRoosevelt')); `.test()` を使用して正規表現をテストする必要があります。 ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` 結果は `true` を返す必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md index ba7af8e9950..948e9c6d653 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md @@ -51,7 +51,7 @@ assert(codingRegex.source === 'coding'); `.match()` メソッドを使用する必要があります。 ```js -assert(code.match(/\.match\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.match\(.*\)/)); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md index fdbead79cf1..05ac4f3245d 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md @@ -31,7 +31,7 @@ huRegex.test(hugStr); `.test()` メソッドを使用する必要があります。 ```js -assert(code.match(/\.test\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.test\(.*\)/)); ``` 正規表現 `unRegex`でワイルドカード文字を使用する必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index 21806af8d86..3ca25573dd0 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -52,7 +52,7 @@ assert(!waldoRegex.test('Somewhere is hiding in this text.')); 正規表現でリテラル文字列のマッチを実行する必要があります。 ```js -assert(!/\/.*\/i/.test(code)); +assert(!/\/.*\/i/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md index ba1df99adc7..ccb885841ae 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md @@ -27,13 +27,13 @@ assert(result === 'Hello, World!'); 解答では `String.prototype.trim()` メソッドを使用しないでください。 ```js -assert(!code.match(/\.?[\s\S]*?trim/)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?trim/)); ``` `result` 変数に文字列を直接設定しないでください。 ```js -assert(!code.match(/result\s*=\s*["'`].*?["'`]/)); +assert(!__helpers.removeJSComments(code).match(/result\s*=\s*["'`].*?["'`]/)); ``` `hello` 変数の値は変更しないでください。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md index 80471a14705..47f51718fd2 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md @@ -37,7 +37,7 @@ wrongText.replace(silverRegex, "blue"); 検索と置換に `.replace()` を使用してください。 ```js -assert(code.match(/\.replace\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.replace\(.*\)/)); ``` 正規表現で、文字列 `one two three` を文字列 `three two one` に変更する必要があります。 @@ -49,7 +49,7 @@ assert(result === 'three two one'); 最後の行を変更しないでください。 ```js -assert(code.match(/result\s*=\s*str\.replace\(.*?\)/)); +assert(__helpers.removeJSComments(code).match(/result\s*=\s*str\.replace\(.*?\)/)); ``` `fixRegex` では少なくとも 3 つのキャプチャグループを使用する必要があります。 diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md index 1ea206acbd9..c00a107b129 100644 --- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md +++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md @@ -31,7 +31,7 @@ testRegex.test(testStr); `.test()` を使用して正規表現をテストする必要があります。 ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` 結果は `true` を返す必要があります。 diff --git a/curriculum/challenges/japanese/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md b/curriculum/challenges/japanese/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md index 50d5a7e9cb4..785877832b3 100644 --- a/curriculum/challenges/japanese/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md +++ b/curriculum/challenges/japanese/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md @@ -15,12 +15,9 @@ You should have `if number >= 10:` within the `for` loop. ```js ({ - test: () => { - const transformedCode = code.replace(/\r/g, ""); - const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); - const { function_body } = verify_card_number; - - assert.match(function_body, /if +number +>= +10:/); + test: () => + { + assert(runPython(`_Node(_code).find_function("verify_card_number").find_for_loops()[1].find_ifs()[0].find_conditions()[0].is_equivalent("number >= 10")`)); } }) ``` diff --git a/curriculum/challenges/japanese/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md b/curriculum/challenges/japanese/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md index 4d3ec4b658f..d239aef623b 100644 --- a/curriculum/challenges/japanese/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md +++ b/curriculum/challenges/japanese/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md @@ -115,7 +115,10 @@ from importlib import reload reload(probability_calculator) probability_calculator.random.seed(95) -def test_hat_draw(self): + +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw(self): hat = probability_calculator.Hat(red=5,blue=2) actual = hat.draw(2) expected = ['blue', 'red'] @@ -140,6 +143,49 @@ t.result.wasSuccessful() }); ``` +The `draw` method should behave correctly when the number of balls to extract is bigger than the number of balls in the hat. + +```js +({ + test: () => { + pyodide.FS.writeFile("/home/pyodide/probability_calculator.py", code); + pyodide.FS.writeFile( + "/home/pyodide/test_module.py", + ` +import unittest +import probability_calculator +from importlib import reload + +reload(probability_calculator) + +probability_calculator.random.seed(95) +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw_2(self): + hat = probability_calculator.Hat(yellow=5,red=1,green=3,blue=9,test=1) + actual = hat.draw(20) + expected = ['yellow', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'green', 'green', 'green', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'test'] + self.assertEqual(actual, expected, 'Expected hat draw to return all items from hat contents.') + actual = len(hat.contents) + expected = 0 + self.assertEqual(actual, expected, 'Expected hat draw to leave no items in contents.') + ` + ); + const testCode = ` +from unittest import main +import test_module +from importlib import reload + +reload(test_module) +t = main(module='test_module', exit=False) +t.result.wasSuccessful() +`; + const out = __pyodide.runPython(testCode); + assert(out); + }, +}); +``` + The `experiment` method should return a different probability. @@ -221,7 +267,8 @@ class Hat: def draw(self, number): drawn = [] if number >= len(self.contents): - return self.contents + drawn.extend(self.contents) + self.contents = [] else: for i in range(number): drawn.append( @@ -229,8 +276,7 @@ class Hat: ) return drawn -def experiment(hat, expected_balls, num_balls_drawn, num_experiments): - +def experiment(hat, expected_balls, num_balls_drawn, num_experiments): expected_balls_list = [] drawn_list = [] success = 0 @@ -248,12 +294,7 @@ def experiment(hat, expected_balls, num_balls_drawn, num_experiments): except: continue if len(exp_ball_list_copy) == 0: - success += 1 - - - - - probability = success/num_experiments - + success += 1 + probability = success/num_experiments return probability ``` diff --git a/curriculum/challenges/japanese/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md b/curriculum/challenges/japanese/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md index 4513cab3855..976ded35458 100644 --- a/curriculum/challenges/japanese/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md +++ b/curriculum/challenges/japanese/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md @@ -48,9 +48,9 @@ assert(homeworkStack.indexOf('PSY44') === -1); ```js assert( - code.match(/=/g).length === 1 && + __helpers.removeJSComments(code).match(/=/g).length === 1 && /homeworkStack\s*=\s*\["BIO12"\s*,\s*"HIS80"\s*,\s*"MAT122"\s*,\s*"PSY44"\]/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md index a715e466988..4ba6430da49 100644 --- a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md +++ b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md @@ -2,7 +2,6 @@ id: 5f356ed60a5decd94ab66986 title: ステップ 22 challengeType: 0 -removeComments: false dashedName: step-22 --- diff --git a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md index 451f995f2ee..0928b559cfe 100644 --- a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md +++ b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md @@ -40,15 +40,15 @@ assert(canvasFilter === 'blur(2px)'); ## --seed-contents-- ```css +--fcc-editable-region-- .canvas { width: 500px; height: 600px; background-color: #4d0f00; overflow: hidden; ---fcc-editable-region-- ---fcc-editable-region-- } +--fcc-editable-region-- .frame { border: 50px solid black; diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md index 14ef1349cd7..a4156771f3a 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md @@ -7,7 +7,7 @@ dashedName: step-55 # --description-- -Inside, the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. +Inside the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. Now, you should see a category displayed underneath each post topic. diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md index eca279b42fe..b69803b87d0 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md @@ -7,9 +7,11 @@ dashedName: step-43 # --description-- -Notice how the `10` value is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. +Notice how the number `10` is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the numbers values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. -To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. Leave the function empty for now. +To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. The parameters of `a` and `b` represent the number values in the array that will be sorted. + +Leave the function empty for now. # --hints-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md index d253c95b6c6..ee57c994e55 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md @@ -26,7 +26,7 @@ assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\( Your callback function should return `a - b`. ```js -assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+a\s*-\s*b\s*;?\s*}\s*\)/); +assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+(?:parseInt)?(?:Number)?\(?a\)?\s*-\s*(?:parseInt)?(?:Number)?\(?b\)?\s*;?\s*}\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b514741ae01..b1b54dda895 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -11,6 +11,8 @@ In your `evalFormula`, declare an `idToText` arrow function which takes an `id` Your `idToText` function should return the result of calling `.find()` on the `cells` array with a callback function that takes an `cell` parameter and returns `cell.id === id`. +Both of your functions should use implicit returns. + # --hints-- You should declare an `idToText` variable in your `evalFormula` function. diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md index 57110b715a9..37487b1771c 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md @@ -23,13 +23,7 @@ Open up the console to see the result. # --hints-- -You should call `.repeat()` on your two `" "` strings. - -```js -assert.lengthOf(code.match(/" ".repeat/g), 2); -``` - -Your `" "` strings should be repeated `rowCount - rowNumber` times. +You should call `.repeat()` on your `" "` strings to repeat them `rowCount - rowNumber` times. ```js assert.equal(padRow(1, 3), " # "); diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md index 3306b1a478b..4170d3bd12b 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md @@ -3,7 +3,6 @@ id: 660f3ce51f70571e1c5227c8 title: Step 69 challengeType: 1 dashedName: step-69 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md index ea0a831040f..7a939244a7c 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md @@ -3,7 +3,6 @@ id: 660f3dd626be3a1ffe27e5d1 title: Step 70 challengeType: 1 dashedName: step-70 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md index e30d808ccb6..b676558ec74 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md @@ -3,7 +3,6 @@ id: 660f4f79e2a82a4e92290f44 title: Step 101 challengeType: 1 dashedName: step-101 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md index dc683e61ce5..3f088de2c91 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md @@ -3,7 +3,6 @@ id: 660f53ad3d39175c5d4335ac title: Step 108 challengeType: 1 dashedName: step-108 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md new file mode 100644 index 00000000000..286128cc2cf --- /dev/null +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md @@ -0,0 +1,74 @@ +--- +id: 662693f82c91a66be46c881b +title: Step 1 +challengeType: 1 +dashedName: step-1 +--- + +# --description-- + +A teacher has finished grading their students' tests and needs your help to calculate the average score for the class. + +Complete the `getAverage` function which takes in an array of test scores and returns the average score. + +The average is calculated by adding up all the scores and dividing by the total number of scores. + +```js +average = sum of all scores / total number of scores +``` + +A couple of function calls have been provided for you so you can test out your code. + +**Tips** + +- You can use a loop to iterate over the `scores` array and add up all the scores. +- You can use the `length` property to get the total number of scores. + +# --hints-- + +Your `getAverage` function should return a number. + +```js +assert.strictEqual(typeof getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 'number'); +``` + +`getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])` should return `71.7`. + +```js +assert.strictEqual(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 71.7); +``` + +`getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])` should return `85.4`. + +```js +assert.strictEqual(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]), 85.4); +``` + +`getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100])` should return `92.4`. + +```js +assert.strictEqual(getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100]), 92.4); +``` + +Your `getAverage` function should return the average score of the test scores. + +```js +assert.strictEqual(getAverage([52, 56, 60, 65, 70, 75, 80, 85, 90, 95]), 72.8); +assert.strictEqual(getAverage([45, 50, 55, 60, 65, 70, 75, 80, 85, 90]), 67.5); +assert.strictEqual(getAverage([38, 42, 46, 50, 54, 58, 62, 66, 70, 74]), 56); +``` + +# --seed-- + +## --seed-contents-- + +```js +--fcc-editable-region-- +function getAverage(scores) { + +} + +console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])); +console.log(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md new file mode 100644 index 00000000000..f7e9253a5a5 --- /dev/null +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md @@ -0,0 +1,104 @@ +--- +id: 6626a060c4006f793e10cb33 +title: Step 2 +challengeType: 1 +dashedName: step-2 +--- + +# --description-- + +Now the teacher needs your help converting the student score to a letter grade. + +Complete the `getGrade` function that takes a number `score` as a parameter. Your function should return a string representing a letter grade based on the score. + +Here are the scores and their corresponding letter grades: + +| Score Range | Grade | +| ----------- | ------- | +| `100` | `"A++"` | +| `90 - 99` | `"A"` | +| `80 - 89` | `"B"` | +| `70 - 79` | `"C"` | +| `60 - 69` | `"D"` | +| `0 - 59` | `"F"` | + + +**Tips** + +- Remember that you learned about conditional statements(`if`, `else if`, and `else`). +- Remember that you learned about comparison operators (`>`, `<`, `>=`, `<=`, `===`). + +# --hints-- + +Your `getGrade` function should return `"A++"` if the score is `100`. + +```js +assert.strictEqual(getGrade(100), "A++"); +``` + +Your `getGrade` function should return `"A"` if the score is `94`. + +```js +assert.strictEqual(getGrade(94), "A"); +``` + +Your `getGrade` function should return `"B"` if the score is between `80` and `89`. + +```js +assert.strictEqual(getGrade(80), "B"); +assert.strictEqual(getGrade(83), "B"); +assert.strictEqual(getGrade(88), "B"); +``` + +Your `getGrade` function should return `"C"` if the score is `78`. + +```js +assert.strictEqual(getGrade(75), "C"); +``` + +Your `getGrade` function should return `"D"` if the score is between `60` and `69`. + +```js +assert.strictEqual(getGrade(60), "D"); +assert.strictEqual(getGrade(63), "D"); +assert.strictEqual(getGrade(68), "D"); +``` + +Your `getGrade` function should return `"F"` if the score is `57`. + +```js +assert.strictEqual(getGrade(57), "F"); +``` + +Your `getGrade` function should return `"F"` if the score is between `0` and `59`. + +```js +assert.strictEqual(getGrade(0), "F"); +assert.strictEqual(getGrade(30), "F"); +assert.strictEqual(getGrade(43), "F"); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} +--fcc-editable-region-- +function getGrade(score) { + +} + +console.log(getGrade(96)); +console.log(getGrade(82)); +console.log(getGrade(56)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md new file mode 100644 index 00000000000..b168e1325fc --- /dev/null +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md @@ -0,0 +1,88 @@ +--- +id: 6626b4c58c027d86478ff5eb +title: Step 3 +challengeType: 1 +dashedName: step-3 +--- + +# --description-- + +The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an `"F"`. + +Complete the function `hasPassingGrade` that takes a student score as a parameter. Your function should return `true` if the student has a passing grade and `false` if they do not. + +**Tips** + +- Use the `getGrade` function to get the student's grade. Then check if the grade is passing or not. + +# --hints-- + +Your `hasPassingGrade` function should return a boolean value. + +```js +assert.strictEqual(typeof hasPassingGrade(100), "boolean"); +``` + +Your `hasPassingGrade` function should return `true` if the grade is an `"A"`. + +```js +assert.isTrue(hasPassingGrade(100)); +``` + +Your `hasPassingGrade` function should return `false` if the grade is an `"F"`. + +```js +assert.isFalse(hasPassingGrade(53)); +``` + +Your `hasPassingGrade` function should return `true` for all passing grades. + +```js +assert.isTrue(hasPassingGrade(87)); +assert.isTrue(hasPassingGrade(60)); +assert.isTrue(hasPassingGrade(73)); +assert.isTrue(hasPassingGrade(96)); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +--fcc-editable-region-- +function hasPassingGrade(score) { + +} + + +console.log(hasPassingGrade(100)); +console.log(hasPassingGrade(53)); +console.log(hasPassingGrade(87)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md new file mode 100644 index 00000000000..08ee3cea27b --- /dev/null +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md @@ -0,0 +1,143 @@ +--- +id: 6626b8dcf5057f896f948440 +title: Step 4 +challengeType: 1 +dashedName: step-4 +--- + +# --description-- + +Now that the teacher has all of the information they need, they want to be able to message the student with the results. + +Complete the `studentMsg` function with `totalScores` and `studentScore` for parameters. The function should return a string representing a message to the student. + +If the student passed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You passed the course. +``` + +If the student failed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You failed the course. +``` + +Replace `average-goes-here` with the average of the total scores. Replace `grade-goes-here` with the student's grade. + +**Tips** + +- Use the `getAverage` function to get the class average. +- Use the `getGrade` function to get the student's grade. +- Use string concatenation (`+`) to build the message. +- Be careful with the punctuation and spaces in the message. + +# --hints-- + +Your function call of `studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)` should return the following message: `"Class average: 71.7. Your grade: F. You failed the course."`. + +```js +assert.strictEqual(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37), "Class average: 71.7. Your grade: F. You failed the course."); +``` + +Your function call of `studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)` should return the following message: `"Class average: 50.8. Your grade: A++. You passed the course."`. + +```js +assert.strictEqual(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100), "Class average: 50.8. Your grade: A++. You passed the course."); +``` + +Your `studentMsg` function should return a the correct message based on the student's score and the class average. + +```js +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 92), "Class average: 70.25. Your grade: A. You passed the course."); +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 57), "Class average: 70.25. Your grade: F. You failed the course."); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +--fcc-editable-region-- +function studentMsg(totalScores, studentScore) { + +} +console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)); +--fcc-editable-region-- + +``` + + +# --solutions-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +function studentMsg(totalScores, studentScore) { + let average = getAverage(totalScores); + let grade = getGrade(studentScore); + + return `Class average: ${average}. Your grade: ${grade}. You ${ + hasPassingGrade(studentScore) ? "passed" : "failed" + } the course.`; +} + +``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md index 4ad1e2c7910..b87f5fc9928 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md @@ -87,7 +87,7 @@ assert(confirmEnding('Abstraction', 'action') === true); Your code should not use the built-in method `.endsWith()` to solve the challenge. ```js -assert(!/\.endsWith\(.*?\)\s*?;?/.test(code) && !/\['endsWith'\]/.test(code)); +assert(!/\.endsWith\(.*?\)\s*?;?/.test(__helpers.removeJSComments(code)) && !/\['endsWith'\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md index 84b4b5dc65f..dbae3dde019 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md @@ -51,7 +51,7 @@ assert(repeatStringNumTimes('abc', -2) === ''); The built-in `repeat()` method should not be used. ```js -assert(!/\.repeat/g.test(code)); +assert(!/\.repeat/g.test(__helpers.removeJSComments(code))); ``` `repeatStringNumTimes("abc", 0)` should return `""`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md index ec9575f325c..8477ae22407 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md @@ -53,19 +53,19 @@ assert.deepEqual( The `htmlColorNames` function should utilize the `splice()` method ```js -assert(/.splice/.test(code)); +assert(/.splice/.test(__helpers.removeJSComments(code))); ``` You should not use `shift()` or `unshift()`. ```js -assert(!/shift|unshift/.test(code)); +assert(!/shift|unshift/.test(__helpers.removeJSComments(code))); ``` You should not use array bracket notation. ```js -assert(!/\[\d\]\s*=/.test(code)); +assert(!/\[\d\]\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md index 99f116debcc..8158c3eea52 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md @@ -85,8 +85,8 @@ The definition of the `foods` object should not be changed. ```js assert( - code.search(/let foods/) === -1 && - code.search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ + __helpers.removeJSComments(code).search(/let foods/) === -1 && + __helpers.removeJSComments(code).search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ ) !== -1 ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md index cd848ed5010..441b90c9776 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md @@ -27,7 +27,7 @@ The `users` object should not be accessed directly ```js -assert(code.match(/users/gm).length <= 2) +assert(__helpers.removeJSComments(code).match(/users/gm).length <= 2) ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index 7c0b9f2ea0f..6f20c63f701 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ The `copyMachine` function should utilize the `spread operator` with array `arr` ```js -assert(code.match(/\.\.\.\s*arr/)); +assert(__helpers.removeJSComments(__helpers.removeJSComments(code)).match(/\.\.\.\s*arr/)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md index 325439ea9a2..53005bd00eb 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md @@ -38,7 +38,7 @@ assert.deepEqual( The `forecast` function should utilize the `slice()` method ```js -assert(/\.slice\(/.test(code)); +assert(/\.slice\(/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index 5ce682a372c..7374a1198e2 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -51,7 +51,7 @@ The function `countOnline` should use a `for in` statement to iterate through th ```js assert( - code.match( + __helpers.removeJSComments(code).match( /for\s*\(\s*(var|let|const)\s+[a-zA-Z_$]\w*\s+in\s+[a-zA-Z_$]\w*\s*\)/ ) ); diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md index 731f95ff6ae..7bc4adb5993 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md @@ -61,7 +61,7 @@ assert(userActivity.data.online === 45); The `online` property should be set using dot or bracket notation. ```js -assert.strictEqual(code.search(/online: 45/), -1); +assert.strictEqual(__helpers.removeJSComments(code).search(/online: 45/), -1); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md index e3051ea8bb7..4b32f68e854 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md @@ -40,7 +40,7 @@ You should not change the original line of `const arr = [2, 4, 5, 1, 7, 5, 2, 1] ```js assert( - __helpers.removeWhiteSpace(code).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) ); ``` @@ -56,14 +56,14 @@ assert.strictEqual( Your code should utilize the `splice()` method on `arr`. ```js -assert(__helpers.removeWhiteSpace(code).match(/arr\.splice\(/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(/)); ``` The splice should only remove elements from `arr` and not add any additional elements to `arr`. ```js assert( - !__helpers.removeWhiteSpace(code).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) + !__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md index 575e41f90aa..627ed9a5948 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md @@ -39,9 +39,9 @@ The `oranges`, `plums`, and `strawberries` keys should be removed using `delete` ```js assert( - code.search(/oranges:/) !== -1 && - code.search(/plums:/) !== -1 && - code.search(/strawberries:/) !== -1 + __helpers.removeJSComments(code).search(/oranges:/) !== -1 && + __helpers.removeJSComments(code).search(/plums:/) !== -1 && + __helpers.removeJSComments(code).search(/strawberries:/) !== -1 ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md index 774a661f7f5..5d5e9200567 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md @@ -54,7 +54,7 @@ The data in variable `myArray` should be accessed using bracket notation. ```js assert( (function () { - if (code.match(/\s*=\s*myArray\[0\]/g)) { + if (__helpers.removeJSComments(code).match(/\s*=\s*myArray\[0\]/g)) { return true; } else { return false; diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md index 4921bfa8f02..c05662a8423 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md @@ -45,7 +45,7 @@ assert(myData === 8); You should be using bracket notation to read the correct value from `myArray`. ```js -assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code))); +assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md index 525977abeac..e5cf4fc9ef1 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md @@ -54,7 +54,7 @@ assert(secondTree === 'pine'); Your code should use dot and bracket notation to access `myPlants`. ```js -assert(/=\s*myPlants\[1\].list\[1\]/.test(code)); +assert(/=\s*myPlants\[1\].list\[1\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md index 41c08ea866f..6b15dffd25f 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md @@ -64,7 +64,7 @@ assert(drinkValue === 'water'); You should use bracket notation twice ```js -assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md index db9d63d3bb8..86dcd740f80 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md @@ -60,7 +60,7 @@ assert(shirtValue === 'jersey'); You should use dot notation twice ```js -assert(code.match(/testObj\.\w+/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\.\w+/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md index f509f03e7e7..dc370d28fb0 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md @@ -56,19 +56,19 @@ assert(player === 'Montana'); You should use bracket notation to access `testObj` ```js -assert(/testObj\s*?\[.*?\]/.test(code)); +assert(/testObj\s*?\[.*?\]/.test(__helpers.removeJSComments(code))); ``` You should not assign the value `Montana` to the variable `player` directly. ```js -assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); +assert(!__helpers.removeJSComments(code).match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); ``` You should be using the variable `playerNumber` in your bracket notation ```js -assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code)); +assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md index ab0a9969e9b..a0281239d92 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md @@ -53,7 +53,7 @@ assert(myDog.bark !== undefined); You should not add `bark` to the initialization of `myDog`. ```js -assert(!/bark[^\n]:/.test(code)); +assert(!/bark[^\n]:/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md index fc107f1b587..1d742e4d667 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md @@ -38,7 +38,7 @@ assert(sum === 20); You should use the `+` operator. ```js -assert(/\+/.test(code)); +assert(/\+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md index 319770d14b9..48d98bf34e6 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md @@ -71,7 +71,7 @@ assert(switchOfStuff(4) === 'stuff'); You should not use any `if` or `else` statements ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` You should use a `default` statement @@ -83,7 +83,7 @@ assert(switchOfStuff('string-to-trigger-default-case') === 'stuff'); You should have at least 3 `break` statements ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md index 7b2d223a44f..f0c61a714f4 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md @@ -36,7 +36,7 @@ assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2); You should append `someAdjective` to `myStr` using the `+=` operator. ```js -assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md index ad5a0371ab8..ed896f479f2 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md @@ -29,7 +29,7 @@ Assign the contents of `a` to variable `b`. You should not change code above the specified comment. ```js -assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code))); ``` `b` should have a value of `7`. @@ -41,7 +41,7 @@ assert(typeof b === 'number' && b === 7); `a` should be assigned to `b` with `=`. ```js -assert(/b\s*=\s*a\s*/g.test(code)); +assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md index a825bdf453a..e6e1ffcffe6 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md @@ -34,7 +34,7 @@ assert(processed === 2); You should assign `processArg` to `processed` ```js -assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code)); +assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md index 608723120c6..df451278269 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md @@ -39,19 +39,19 @@ Write chained `if`/`else if` statements to fulfill the following conditions: You should have at least four `else` statements ```js -assert(code.match(/else/g).length > 3); +assert(__helpers.removeJSComments(code).match(/else/g).length > 3); ``` You should have at least four `if` statements ```js -assert(code.match(/if/g).length > 3); +assert(__helpers.removeJSComments(code).match(/if/g).length > 3); ``` You should have at least one `return` statement ```js -assert(code.match(/return/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/return/g).length >= 1); ``` `testSize(0)` should return the string `Tiny` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index a5f59ff63f0..5b6a9e09cc1 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -2,7 +2,6 @@ id: bd7123c9c441eddfaeb4bdef title: Comment Your JavaScript Code challengeType: 1 -removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' forumTopicId: 16783 dashedName: comment-your-javascript-code diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index 8ef2dc27b8e..276b4c19d00 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -58,7 +58,7 @@ assert(testEqual('12') === 'Equal'); You should use the `==` operator ```js -assert(code.match(/==/g) && !code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/==/g) && !__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index 544d9f86fdb..292700753db 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -73,7 +73,7 @@ assert(testGreaterThan(150) === 'Over 100'); You should use the `>` operator at least twice ```js -assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index 3c0c64a793b..faf108fb241 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -73,7 +73,7 @@ assert(testGreaterOrEqual(21) === '20 or Over'); You should use the `>=` operator at least twice ```js -assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index c8260cfe2fe..8a8f79c4b84 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -60,7 +60,7 @@ assert(testNotEqual('bob') === 'Not Equal'); You should use the `!=` operator ```js -assert(code.match(/(?!!==)!=/)); +assert(__helpers.removeJSComments(code).match(/(?!!==)!=/)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index 8b7c5158fd8..d9b6893c63c 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -66,7 +66,7 @@ assert(testLessThan(99) === '55 or Over'); You should use the `<` operator at least twice ```js -assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index 55db0c27c7a..37e028eb9f7 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -72,7 +72,7 @@ assert(testLessOrEqual(55) === 'More Than 24'); You should use the `<=` operator at least twice ```js -assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index d0d14f64778..09d6fb81ad2 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -49,7 +49,7 @@ assert(testStrict('7') === 'Not Equal'); You should use the `===` operator ```js -assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index 9d2266e4636..c49a23991a0 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -52,7 +52,7 @@ assert(testStrictNotEqual('bob') === 'Not Equal'); You should use the `!==` operator ```js -assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md index e6433fac0ad..c557b1056d3 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md @@ -40,13 +40,13 @@ Replace the two if statements with one statement, using the `&&` operator, which You should use the `&&` operator once ```js -assert(code.match(/&&/g).length === 1); +assert(__helpers.removeJSComments(code).match(/&&/g).length === 1); ``` You should only have one `if` statement ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalAnd(0)` should return the string `No` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md index dba13a7dbc5..36178a26975 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md @@ -43,13 +43,13 @@ Combine the two `if` statements into one statement which returns the string `Out You should use the `||` operator once ```js -assert(code.match(/\|\|/g).length === 1); +assert(__helpers.removeJSComments(code).match(/\|\|/g).length === 1); ``` You should only have one `if` statement ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalOr(0)` should return the string `Outside` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md index 5e1db2e1405..f966d7484dd 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md @@ -54,16 +54,16 @@ assert(c === 19); You should use the `+=` operator for each variable. ```js -assert(code.match(/\+=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\+=/g).length === 3); ``` You should not modify the code above the specified comment. ```js assert( - /let a = 3;/.test(code) && - /let b = 17;/.test(code) && - /let c = 12;/.test(code) + /let a = 3;/.test(__helpers.removeJSComments(code)) && + /let b = 17;/.test(__helpers.removeJSComments(code)) && + /let c = 12;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md index dc48677b84b..2e3c8f71086 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md @@ -48,16 +48,16 @@ assert(c === 3); You should use the `/=` operator for each variable. ```js -assert(code.match(/\/=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\/=/g).length === 3); ``` You should not modify the code above the specified comment. ```js assert( - /let a = 48;/.test(code) && - /let b = 108;/.test(code) && - /let c = 33;/.test(code) + /let a = 48;/.test(__helpers.removeJSComments(code)) && + /let b = 108;/.test(__helpers.removeJSComments(code)) && + /let c = 33;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md index 6d3a4fe3ee5..a9de30a6364 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md @@ -48,16 +48,16 @@ assert(c === 46); You should use the `*=` operator for each variable. ```js -assert(code.match(/\*=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\*=/g).length === 3); ``` You should not modify the code above the specified comment. ```js assert( - /let a = 5;/.test(code) && - /let b = 12;/.test(code) && - /let c = 4\.6;/.test(code) + /let a = 5;/.test(__helpers.removeJSComments(code)) && + /let b = 12;/.test(__helpers.removeJSComments(code)) && + /let c = 4\.6;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md index c81bab787b6..8fce85b5742 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md @@ -48,14 +48,14 @@ assert(c === 2); You should use the `-=` operator for each variable. ```js -assert(code.match(/-=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/-=/g).length === 3); ``` You should not modify the code above the specified comment. ```js assert( - /let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code) + /let a = 11;/.test(__helpers.removeJSComments(code)) && /let b = 9;/.test(__helpers.removeJSComments(code)) && /let c = 3;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md index a0353053a7b..859400a3266 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md @@ -47,19 +47,19 @@ assert(myStr === 'This is the start. This is the end.'); You should use the `+` operator to build `myStr`. ```js -assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g)); +assert(__helpers.removeJSComments(code).match(/(["']).*\1\s*\+\s*(["']).*\2/g)); ``` `myStr` should be created using the `const` keyword. ```js -assert(/const\s+myStr/.test(code)); +assert(/const\s+myStr/.test(__helpers.removeJSComments(code))); ``` You should assign the result to the `myStr` variable. ```js -assert(/myStr\s*=/.test(code)); +assert(/myStr\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index 94201b36790..d47ee7fa973 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -43,7 +43,7 @@ assert(myStr === 'This is the first sentence. This is the second sentence.'); You should use the `+=` operator to build `myStr`. ```js -assert(code.match(/myStr\s*\+=\s*(["']).*\1/g)); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*(["']).*\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md index 7bad4a3053e..7eb7f6d79a9 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md @@ -35,7 +35,7 @@ assert(typeof myName !== 'undefined' && myName.length > 2); You should use two `+` operators to build `myStr` with `myName` inside it. ```js -assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); +assert(__helpers.removeJSComments(code).match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md index fe00f54d76b..5b84a8227cf 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md @@ -34,13 +34,13 @@ Push the odd numbers from 9 through 1 to `myArray` using a `for` loop. You should be using a `for` loop for this. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` You should be using the array method `push`. ```js -assert(code.match(/myArray.push/)); +assert(__helpers.removeJSComments(code).match(/myArray.push/)); ``` `myArray` should equal `[9, 7, 5, 3, 1]`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md index 9d41fe9503c..102e882e976 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md @@ -37,7 +37,7 @@ Look at the `ourName` example above if you get stuck. You should declare `myName` with the `var` keyword, ending with a semicolon ```js -assert(/var\s+myName\s*;/.test(code)); +assert(/var\s+myName\s*;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md index 3c5cb464e6a..ff957dabcfc 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md @@ -38,25 +38,25 @@ assert(myVar === 10); `myVar = myVar - 1;` should be changed. ```js -assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); ``` You should not assign `myVar` with `10`. ```js -assert(!code.match(/myVar\s*=\s*10.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*10.*?;?/)); ``` You should use the `--` operator on `myVar`. ```js -assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code)); +assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(__helpers.removeJSComments(code))); ``` You should not change code above the specified comment. ```js -assert(/let myVar = 11;/.test(code)); +assert(/let myVar = 11;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md index d224c8ebd47..da9a69186c6 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md @@ -55,7 +55,7 @@ assert(typeof myDog === 'object' && myDog.tails === undefined); You should not modify the `myDog` setup. ```js -assert(code.match(/"tails": 1/g).length > 0); +assert(__helpers.removeJSComments(code).match(/"tails": 1/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md index 90732f0bd7d..0cc61567576 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md @@ -26,13 +26,13 @@ assert(quotient === 2.2); You should use the `/` operator to divide 4.4 by 2 ```js -assert(/4\.40*\s*\/\s*2\.*0*/.test(code)); +assert(/4\.40*\s*\/\s*2\.*0*/.test(__helpers.removeJSComments(code))); ``` The quotient variable should only be assigned once ```js -assert(code.match(/quotient\s*=/g).length === 1); +assert(__helpers.removeJSComments(code).match(/quotient\s*=/g).length === 1); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md index f5e9875ac42..38427a994fb 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md @@ -35,7 +35,7 @@ assert(quotient === 2); You should use the `/` operator. ```js -assert(/\d+\s*\/\s*\d+/.test(code)); +assert(/\d+\s*\/\s*\d+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md index 21fcd4fe6eb..3f33d49c525 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md @@ -36,7 +36,7 @@ I am a "double quoted" string inside "double quotes". You should use two double quotes (`"`) and four escaped double quotes (`\"`). ```js -assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2); +assert(__helpers.removeJSComments(code).match(/\\"/g).length === 4 && __helpers.removeJSComments(code).match(/[^\\]"/g).length === 2); ``` Variable `myStr` should contain the string: `I am a "double quoted" string inside "double quotes".` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md index 28e463a453d..d17daa4c773 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md @@ -29,8 +29,8 @@ You should not change the variable declarations in the `// Setup` section. ```js assert( - code.match(/let lastNameLength = 0;/) && - code.match(/const lastName = "Lovelace";/) + __helpers.removeJSComments(code).match(/let lastNameLength = 0;/) && + __helpers.removeJSComments(code).match(/const lastName = "Lovelace";/) ); ``` @@ -43,7 +43,7 @@ assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8); You should be getting the length of `lastName` by using `.length` like this: `lastName.length`. ```js -assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/)); +assert(__helpers.removeJSComments(code).match(/=\s*lastName\.length/g) && !__helpers.removeJSComments(code).match(/lastName\s*=\s*8/)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md index c680879a8b2..6b5ba558c6e 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md @@ -39,7 +39,7 @@ Set `remainder` equal to the remainder of `11` divided by `3` using the rem The variable `remainder` should be initialized ```js -assert(/(const|let|var)\s+?remainder/.test(code)); +assert(/(const|let|var)\s+?remainder/.test(__helpers.removeJSComments(code))); ``` The value of `remainder` should be `2` @@ -51,7 +51,7 @@ assert(remainder === 2); You should use the `%` operator ```js -assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code)); +assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md index 0a93e330620..b8bc6c1778b 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md @@ -36,7 +36,7 @@ assert((randomFraction() + '').match(/\./g)); You should be using `Math.random` to generate the random decimal number. ```js -assert(code.match(/Math\.random/g).length >= 0); +assert(__helpers.removeJSComments(code).match(/Math\.random/g).length >= 0); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md index df5743e2d44..04d87ba9c83 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md @@ -46,22 +46,22 @@ assert( You should use `Math.random` to generate a random number. ```js -assert(code.match(/Math.random/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.random/g).length >= 1); ``` You should have multiplied the result of `Math.random` by 10 to make it a number in the range from zero to nine. ```js assert( - code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || - code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) + __helpers.removeJSComments(code).match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || + __helpers.removeJSComments(code).match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) ); ``` You should use `Math.floor` to remove the decimal part of the number. ```js -assert(code.match(/Math.floor/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.floor/g).length >= 1); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md index f9d999395ac..9f55b7dea17 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md @@ -49,10 +49,10 @@ assert(randomRange(0, 1) % 1 === 0); assert( (function () { if ( - code.match(/myMax/g).length > 1 && - code.match(/myMin/g).length > 2 && - code.match(/Math.floor/g) && - code.match(/Math.random/g) + __helpers.removeJSComments(code).match(/myMax/g).length > 1 && + __helpers.removeJSComments(code).match(/myMin/g).length > 2 && + __helpers.removeJSComments(code).match(/Math.floor/g) && + __helpers.removeJSComments(code).match(/Math.random/g) ) { return true; } else { diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md index 5ee2aea4e86..cf501ba85f1 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md @@ -36,7 +36,7 @@ assert(myGlobal === 10); `myGlobal` should be declared using the `let` or `const` keywords ```js -assert(/(let|const)\s+myGlobal/.test(code)); +assert(/(let|const)\s+myGlobal/.test(__helpers.removeJSComments(code))); ``` `oopsGlobal` should be a global variable and have a value of `5` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md index d4ae646f40e..bf48ff49d1e 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md @@ -45,7 +45,7 @@ assert(myOutfit() === 'sweater'); You should not change the return statement. ```js -assert(/return outerWear/.test(code)); +assert(/return outerWear/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md index 6f1b0031438..c11ae000e52 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md @@ -39,20 +39,20 @@ You should not use the assignment operator. ```js assert( - /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(code) + /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(__helpers.removeJSComments(code)) ); ``` You should use the `++` operator. ```js -assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code)); +assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(__helpers.removeJSComments(code))); ``` You should not change code above the specified comment. ```js -assert(/let myVar = 87;/.test(code)); +assert(/let myVar = 87;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md index 1fd59cdfff7..74dba02c291 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md @@ -26,7 +26,7 @@ Define a variable `a` with `var` and initialize it to a value of `9`. You should initialize `a` to a value of `9`. ```js -assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code)); +assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md index 803a30f9c84..b844174c40f 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md @@ -30,20 +30,20 @@ Convert the logic to use `else if` statements. You should have at least two `else` statements ```js -assert(code.match(/else/g).length > 1); +assert(__helpers.removeJSComments(code).match(/else/g).length > 1); ``` You should have at least two `if` statements ```js -assert(code.match(/if/g).length > 1); +assert(__helpers.removeJSComments(code).match(/if/g).length > 1); ``` You should have closing and opening curly braces for each `if else` code block. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/ ) ); diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md index 683f9a30b18..7348b6448eb 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md @@ -28,13 +28,13 @@ Combine the `if` statements into a single `if/else` statement. You should only have one `if` statement in the editor ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` You should use an `else` statement ```js -assert(/else/g.test(code)); +assert(/else/g.test(__helpers.removeJSComments(code))); ``` `testElse(4)` should return the string `5 or Smaller` @@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5'); You should not change the code above or below the specified comments. ```js -assert(/let result = "";/.test(code) && /return result;/.test(code)); +assert(/let result = "";/.test(__helpers.removeJSComments(code)) && /return result;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md index af1764e1738..47f86402e34 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md @@ -32,7 +32,7 @@ Push the odd numbers from 1 through 9 to `myArray` using a `for` loop. You should be using a `for` loop for this. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` should equal `[1, 3, 5, 7, 9]`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md index 9b1799d7840..36bbd457c0b 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md @@ -30,7 +30,7 @@ Declare and initialize a variable `total` to `0`. Use a `for` loop to add the va `total` should be declared and initialized to 0. ```js -assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); ``` `total` should equal 20. @@ -42,13 +42,13 @@ assert(total === 20); You should use a `for` loop to iterate through `myArr`. ```js -assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code)); +assert(/for\s*\(/g.test(__helpers.removeJSComments(code)) && /myArr\s*\[/g.test(__helpers.removeJSComments(code))); ``` You should not attempt to directly assign the value 20 to `total`. ```js -assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm)); +assert(!__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/total[=+-]0*[1-9]+/gm)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md index af005afe4f1..84f8c48bf65 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md @@ -56,7 +56,7 @@ Change the `while` loop in the code to a `do...while` loop so the loop will push You should be using a `do...while` loop for this exercise. ```js -assert(code.match(/do/g)); +assert(__helpers.removeJSComments(code).match(/do/g)); ``` `myArray` should equal `[10]`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md index b530a42a31a..16d2ac028c2 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md @@ -44,7 +44,7 @@ Use a `for` loop to push the values 1 through 5 onto `myArray`. You should be using a `for` loop for this. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` should equal `[1, 2, 3, 4, 5]`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md index 27a209e3775..236f2fa714c 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md @@ -36,7 +36,7 @@ Add the numbers 5 through 0 (inclusive) in descending order to `myArray` using a You should be using a `while` loop for this. ```js -assert(code.match(/while/g)); +assert(__helpers.removeJSComments(code).match(/while/g)); ``` `myArray` should equal `[5, 4, 3, 2, 1, 0]`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index eb73b0f20f6..e36c0ab3819 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -48,7 +48,7 @@ You should add a local `myVar` variable. ```js assert( /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( - __helpers.removeWhiteSpace(code) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)) ) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md index d6f5760b016..b449b95ab25 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md @@ -47,7 +47,7 @@ assert( You should use `pop()` on `myArray`. ```js -assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code)); +assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(__helpers.removeJSComments(code))); ``` `removedFromMyArray` should only contain `["cat", 2]`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md index e2af9ff7abd..4f440c3c1d4 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md @@ -52,7 +52,7 @@ You should be using correct index to modify the value in `myArray`. ```js assert( (function () { - if (code.match(/myArray\[0\]\s*=\s*/g)) { + if (__helpers.removeJSComments(code).match(/myArray\[0\]\s*=\s*/g)) { return true; } else { return false; diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md index 3d1d4276242..a922470d8e2 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md @@ -94,13 +94,13 @@ assert(sequentialSizes(9) === 'High'); You should not use any `if` or `else` statements ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` You should have nine `case` statements ```js -assert(code.match(/case/g).length === 9); +assert(__helpers.removeJSComments(code).match(/case/g).length === 9); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md index c1118c349f3..158c361ecdb 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md @@ -28,7 +28,7 @@ assert(product === 5.0); You should use the `*` operator ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md index 98cff459984..94383a301e5 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md @@ -36,7 +36,7 @@ assert(product === 80); You should use the `*` operator. ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md index 62795ccd42f..53f2940b537 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md @@ -60,7 +60,7 @@ You should call `functionWithArgs` with two numbers after you define it. ```js assert( /functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test( - code.replace(/\s/g, '') + __helpers.removeJSComments(code).replace(/\s/g, '') ) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md index ee683c59fa1..a124c651b08 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md @@ -47,7 +47,7 @@ assert(compareEquality('20', 20) === 'Not Equal'); You should use the `===` operator ```js -assert(code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index dc6b0959b9f..fa18defa6f7 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -47,7 +47,7 @@ You should remove all the backslashes (`\`). ```js assert( - !/\\/g.test(code) && + !/\\/g.test(__helpers.removeJSComments(code)) && myStr.match( '\\s*\\s*Link\\s*\\s*' ) @@ -57,7 +57,7 @@ assert( You should have two single quotes `'` and four double quotes `"`. ```js -assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2); +assert(__helpers.removeJSComments(code).match(/"/g).length === 4 && __helpers.removeJSComments(code).match(/'/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index e30e0a3018d..b38246305c5 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,7 +66,7 @@ Your code should not rely on any kind of loops (`for` or `while` or higher order ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md index b43ee5c811a..9b239123f07 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md @@ -45,19 +45,19 @@ Change the chained `if`/`else if` statements into a `switch` statement. You should not use any `else` statements anywhere in the editor ```js -assert(!/else/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code))); ``` You should not use any `if` statements anywhere in the editor ```js -assert(!/if/g.test(code)); +assert(!/if/g.test(__helpers.removeJSComments(code))); ``` You should have at least four `break` statements ```js -assert(code.match(/break/g).length >= 4); +assert(__helpers.removeJSComments(code).match(/break/g).length >= 4); ``` `chainToSwitch("bob")` should return the string `Marley` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md index fbca53af739..862523365ac 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md @@ -52,7 +52,7 @@ assert(isLess(15, 10) === false); You should not use any `if` or `else` statements ```js -assert(!/if|else/g.test(code)); +assert(!/if|else/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md index 87f0ade0359..dd61469c08d 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md @@ -63,13 +63,13 @@ assert(caseInSwitch(4) === 'delta'); You should not use any `if` or `else` statements ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` You should have at least 3 `break` statements ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md index 8c946f1c2d2..22ab4be5e44 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md @@ -35,7 +35,7 @@ Assign the value `7` to variable `a`. You should not change code above the specified comment. ```js -assert(/var a;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code))); ``` `a` should have a value of 7. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md index 83508131f07..5ef318c8e56 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md @@ -35,7 +35,7 @@ assert(difference === 12); You should only subtract one number from `45`. ```js -assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code))); +assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md index 2564240ae8c..8e189327f7a 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md @@ -40,7 +40,7 @@ assert(myStr === 'Hello World'); You should not change the code above the specified comment. ```js -assert(/myStr = "Jello World"/.test(code)); +assert(/myStr = "Jello World"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md index 93c8577ac67..1645b3846f6 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md @@ -56,19 +56,19 @@ assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000); `studlyCapVar` should use camelCase in both declaration and assignment sections. ```js -assert(code.match(/studlyCapVar/g).length === 2); +assert(__helpers.removeJSComments(code).match(/studlyCapVar/g).length === 2); ``` `properCamelCase` should use camelCase in both declaration and assignment sections. ```js -assert(code.match(/properCamelCase/g).length === 2); +assert(__helpers.removeJSComments(code).match(/properCamelCase/g).length === 2); ``` `titleCaseOver` should use camelCase in both declaration and assignment sections. ```js -assert(code.match(/titleCaseOver/g).length === 2); +assert(__helpers.removeJSComments(code).match(/titleCaseOver/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index 27fe3157eec..1d6dc81ef4e 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -39,9 +39,9 @@ You should not change code below the specified comment. ```js assert( - /a = a \+ 1;/.test(code) && - /b = b \+ 5;/.test(code) && - /c = c \+ " String!";/.test(code) + /a = a \+ 1;/.test(__helpers.removeJSComments(code)) && + /b = b \+ 5;/.test(__helpers.removeJSComments(code)) && + /c = c \+ " String!";/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md index 1fed807aff3..730c224be61 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md @@ -39,7 +39,7 @@ assert(/happy coder/gi.test(myDog.name)); You should not edit the `myDog` definition. ```js -assert(/"name": "Coder"/.test(code)); +assert(/"name": "Coder"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md index ff334faf2cf..bb362ea62b1 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md @@ -41,7 +41,7 @@ assert(firstLetterOfLastName === 'L'); You should use bracket notation. ```js -assert(code.match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md index b2c4ce8d478..e433f67a70a 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(lastLetterOfLastName === 'e'); You should use `.length` to get the last letter. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md index b5cd43bef41..6d208672baf 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md @@ -39,7 +39,7 @@ assert(thirdLetterOfLastName === 'v'); You should use bracket notation. ```js -assert(code.match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md index db3391361ed..7f507243a94 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(secondToLastLetterOfLastName === 'c'); You should use `.length` to get the second last letter. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md index ca8734b30b2..84df1c3f51e 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md @@ -54,7 +54,7 @@ In the `checkSign` function, use multiple conditional operators - following the `checkSign` should use multiple conditional operators ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(__helpers.removeJSComments(code))); ``` `checkSign(10)` should return the string `positive`. Note that capitalization matters diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index 36dd7bcbf98..e57a13d85af 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,7 +59,7 @@ Your code should not rely on any kind of loops (`for`, `while` or higher order f ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index c1d664f2baf..f0705fa2a4f 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,7 +26,7 @@ Your code should not use any loop syntax (`for` or `while` or higher order funct ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index cca85c335f3..475aeb74a31 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -42,7 +42,7 @@ Use the conditional operator in the `checkEqual` function to check if two number `checkEqual` should use the conditional operator ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(__helpers.removeJSComments(code))); ``` `checkEqual(1, 2)` should return the string `Not Equal` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md index 392131577e9..aadb827669c 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md @@ -34,7 +34,7 @@ Use `parseInt()` in the `convertToInteger` function so it converts a binary numb `convertToInteger` should use the `parseInt()` function ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("10011")` should return a number diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md index 8b7a39b1f31..b599b4289b6 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md @@ -26,7 +26,7 @@ Use `parseInt()` in the `convertToInteger` function so it converts the input str `convertToInteger` should use the `parseInt()` function ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("56")` should return a number diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md index 0f879f74f7b..9f4ec2d2980 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md @@ -83,14 +83,14 @@ assert(typeof phoneticLookup('') === 'undefined'); You should not modify the `return` statement ```js -assert(code.match(/return\sresult;/)); +assert(__helpers.removeJSComments(code).match(/return\sresult;/)); ``` You should not use `case`, `switch`, or `if` statements ```js assert( - !/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) + !/case|switch|if/g.test(__helpers.removeJSComments(code).replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md index 63638db6ec7..1652e0da3a8 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md @@ -53,7 +53,7 @@ assert( `wordBlanks`을 작성하기 위해서 `dog`, `ran`, `big`, 또는 `quickly`의 값들을 직접적으로 사용해서는 안됩니다. ```js -const newCode = removeAssignments(code); +const newCode = removeAssignments(__helpers.removeJSComments(code)); assert( !/dog/.test(newCode) && !/ran/.test(newCode) && diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md index 2a62b70ea4f..97fe0e88005 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md @@ -50,7 +50,7 @@ You should call `reusableFunction` once it is defined. ```js const functionStr = reusableFunction && __helpers.removeWhiteSpace(reusableFunction.toString()); -const codeWithoutFunction = __helpers.removeWhiteSpace(code).replace(/reusableFunction\(\)\{/g, ''); +const codeWithoutFunction = __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).replace(/reusableFunction\(\)\{/g, ''); assert(/reusableFunction\(\)/.test(codeWithoutFunction)); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md index 7aea16b1e6b..25744faaff1 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md @@ -25,7 +25,7 @@ assert(power == 8); Your code should use the correct order of the arguments for the `raiseToPower` function call. ```js -assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); +assert(__helpers.removeJSComments(code).match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md index 83f757ada16..fa042698c88 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md @@ -37,7 +37,7 @@ assert(result == 9); Your code should call the `getNine` function. ```js -assert(code.match(/getNine\(\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/getNine\(\)/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md index c0795c6ea6f..bcbfad11dea 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md @@ -27,25 +27,25 @@ assert(netWorkingCapital === 2); There should be no instances of misspelled variables in the code. ```js -assert(!code.match(/recievables/g)); +assert(!__helpers.removeJSComments(code).match(/recievables/g)); ``` The `receivables` variable should be declared and used properly in the code. ```js -assert(code.match(/receivables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/receivables/g).length == 2); ``` There should be no instances of misspelled variables in the code. ```js -assert(!code.match(/payable;/g)); +assert(!__helpers.removeJSComments(code).match(/payable;/g)); ``` The `payables` variable should be declared and used properly in the code. ```js -assert(code.match(/payables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/payables/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index 90d6fcd9581..8cd7fce770f 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -37,13 +37,13 @@ Fix the string so it either uses different quotes for the `href` value, or escap Your code should fix the quotes around the `href` value `#Home` by either changing or escaping them. ```js -assert(code.match(//g)); +assert(__helpers.removeJSComments(code).match(//g)); ``` Your code should keep the double quotes around the entire string. ```js -assert(code.match(/"

.*?<\/p>";/g)); +assert(__helpers.removeJSComments(code).match(/"

.*?<\/p>";/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md index e0ccc7ba4d2..1c29cf7a8ea 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md @@ -37,25 +37,25 @@ Fix the two indexing errors in the following function so all the numbers 1 throu Your code should set the initial condition of the loop so it starts at the first index. ```js -assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?=\s*?0\s*?;/g).length == 1); ``` Your code should fix the initial condition of the loop so that the index starts at 0. ```js -assert(!code.match(/i\s?=\s*?1\s*?;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s?=\s*?1\s*?;/g)); ``` Your code should set the terminal condition of the loop so it stops at the last index. ```js -assert(code.match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); ``` Your code should fix the terminal condition of the loop so that it stops at 1 before the length. ```js -assert(!code.match(/i\s*?<=\s*?len;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?<=\s*?len;/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md index 42ad053023c..174e004e94a 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md @@ -21,7 +21,7 @@ Fix the two pair errors in the code. Your code should fix the missing piece of the array. ```js -assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); +assert(__helpers.removeJSComments(code).match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); ``` Your code should fix the missing piece of the `.reduce()` method. The console output should show that `Sum of array values is: 6`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md index 7fea55d1857..bdb5b446fa0 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md @@ -43,7 +43,7 @@ assert(result == 'Not equal!'); The condition should use either `==` or `===` to test for equality. ```js -assert(code.match(/x\s*?===?\s*?y/g)); +assert(__helpers.removeJSComments(code).match(/x\s*?===?\s*?y/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md index 9455e136450..bc754ef04be 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md @@ -31,13 +31,13 @@ The `myFunc()` function contains an infinite loop because the terminal condition Your code should change the comparison operator in the terminal condition (the middle part) of the `for` loop. ```js -assert(code.match(/i\s*?<=\s*?4;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?<=\s*?4;/g).length == 1); ``` Your code should fix the comparison operator in the terminal condition of the loop. ```js -assert(!code.match(/i\s*?!=\s*?4;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?!=\s*?4;/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index cb849f0678c..e1a156d6d87 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -23,7 +23,7 @@ After that, use `console.log` to log the `output` variable. View the two console You should use `console.log()` to print the `output` variable. ```js -assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/console\.log\(output\)/)); ``` You should use `console.clear()` to clear the browser console. @@ -31,7 +31,7 @@ You should use `console.clear()` to clear the browser console. ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console.clear\(\)/) ); ``` @@ -41,7 +41,7 @@ You should clear the console after your log. ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console\.log\(output\)[\s\S]*console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md index 4e212c27230..e0572d55c49 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md @@ -29,7 +29,7 @@ Use the `console.log()` method to print the value of the variable `a` where note Your code should use `console.log()` to check the value of the variable `a`. ```js -assert(code.match(/console\.log\(a\)/g)); +assert(__helpers.removeJSComments(code).match(/console\.log\(a\)/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md index 4a665970ce0..b4c2503d024 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md @@ -32,19 +32,19 @@ Add two `console.log()` statements to check the `typeof` each of the two variabl Your code should use `typeof` in two `console.log()` statements to check the type of the variables. ```js -assert(code.match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); ``` Your code should use `typeof` to check the type of the variable `seven`. ```js -assert(code.match(/typeof[\( ]seven\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]seven\)?/g)); ``` Your code should use `typeof` to check the type of the variable `three`. ```js -assert(code.match(/typeof[\( ]three\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]three\)?/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index f2fcef3fbbe..5c9235a5625 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -87,13 +87,13 @@ This exercise is designed to illustrate the difference between how `var` and `le `var` should not exist in code. ```js -assert(!code.match(/var/g)); +assert(!__helpers.removeJSComments(code).match(/var/g)); ``` The variable `i` declared in the `if` statement should equal the string `block scope`. ```js -assert(code.match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); +assert(__helpers.removeJSComments(code).match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); ``` `checkScope()` should return the string `function scope` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index aea3b4dd18e..077060dea36 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,7 +32,7 @@ Make the promise handle success and failure. If `responseFromServer` is `true`, ```js assert( - code.match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) ); ``` @@ -40,7 +40,7 @@ assert( ```js assert( - code.match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md index 664d8a09303..d4dd94e7047 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md @@ -32,7 +32,7 @@ Your promise should receive a function with `resolve` and `reject` as parameters ```js assert( - code.match( + __helpers.removeJSComments(code).match( /Promise\s*\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g ) ); diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md index 30959b42a3c..d4964d1b073 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md @@ -25,14 +25,14 @@ Add a script to the HTML document of type `module` and give it the source file o You should create a `script` tag. ```js -assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); +assert(__helpers.removeJSComments(code).match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); ``` Your `script` tag should have the `type` attribute with a value of `module`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g ) ); @@ -42,7 +42,7 @@ Your `script` tag should have a `src` of `index.js`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g ) ); diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md index 0f4d9c3390b..4461a51d4d0 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md @@ -38,7 +38,7 @@ Your code should use an `export` fallback. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g ) ); diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md index 22e02de6657..e3691452a84 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md @@ -75,7 +75,7 @@ assert.match(code, /(`.*\${.*}.*`)/); An iterator should be used. ```js -assert(code.match(/for|map|reduce|forEach|while/)); +assert(__helpers.removeJSComments(code).match(/for|map|reduce|forEach|while/)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md index 8ce7f00b693..15529fa97f0 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md @@ -34,7 +34,7 @@ You should call the `then` method on the promise. ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.then\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.then\(/g) ); ``` @@ -50,7 +50,7 @@ You should log `result` to the console. assert( resultIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.then\(.*?result.*?console.log\(result\).*?\)/) ); ``` @@ -60,7 +60,7 @@ assert( ## --after-user-code-- ```js -const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(code)); +const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md index 9cf7ab11460..4a6b8ef70df 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md @@ -28,7 +28,7 @@ You should call the `catch` method on the promise. ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.catch\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.catch\(/g) ); ``` @@ -44,7 +44,7 @@ You should log `error` to the console. assert( errorIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.catch\(.*?error.*?console.log\(error\).*?\)/) ); ``` @@ -54,7 +54,7 @@ assert( ## --after-user-code-- ```js -const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(code)); +const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md index d8a0a3d465e..2ad5a5f9e0c 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md @@ -25,7 +25,7 @@ In the following code, import the default export from the `math_functions.js` fi You should properly import `subtract` from `math_functions.js`. ```js -assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); +assert(__helpers.removeJSComments(code).match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md index 45e1bf50d4a..b8959ccd03d 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md @@ -36,19 +36,19 @@ An array is declared as `const s = [5, 7, 2]`. Change the array to `[2, 5, 7]` u You should not replace `const` keyword. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `s` should be a constant variable (by using `const`). ```js -assert(code.match(/const\s+s/g)); +assert(__helpers.removeJSComments(code).match(/const\s+s/g)); ``` You should not change the original array declaration. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g )); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md index 81871af4d84..2ccc4562475 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md @@ -34,19 +34,19 @@ In this challenge you are going to use `Object.freeze` to prevent mathematical c You should not replace the `const` keyword. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `MATH_CONSTANTS` should be a constant variable (by using `const`). ```js -assert(code.match(/const\s+MATH_CONSTANTS/g)); +assert(__helpers.removeJSComments(code).match(/const\s+MATH_CONSTANTS/g)); ``` You should not change the original declaration of `MATH_CONSTANTS`. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g )); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md index ff3449dd2f8..f4bc9c5b431 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md @@ -32,7 +32,7 @@ You should properly import `uppercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); @@ -42,7 +42,7 @@ You should properly import `lowercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index 0bb3fd12f27..d274ece607e 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -44,7 +44,7 @@ assert(increment(5) === 6); A default parameter value of `1` should be used for `value`. ```js -assert(code.match(/value\s*=\s*1/g)); +assert(__helpers.removeJSComments(code).match(/value\s*=\s*1/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md index c990788c45a..7c68ab7bc5b 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md @@ -31,7 +31,7 @@ Your code should properly use `import * as` syntax. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g ) ); diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index 6ac1354551d..79757f26c3d 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -66,7 +66,7 @@ assert( The `class` keyword should be used. ```js -assert(code.match(/class/g)); +assert(__helpers.removeJSComments(code).match(/class/g)); ``` `Vegetable` should be able to be instantiated. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md index 06603733844..15fd81f95d8 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md @@ -51,7 +51,7 @@ assert(b === 8); You should use array destructuring to swap `a` and `b`. ```js -assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code)); +assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index 7351036c00a..5e45ea952e3 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -43,8 +43,8 @@ You should remove the ES5 assignment syntax. ```js assert( - !code.match(/lowToday = LOCAL_FORECAST\.today\.low/g) && - !code.match(/highToday = LOCAL_FORECAST\.today.high/g) + !__helpers.removeJSComments(code).match(/lowToday = LOCAL_FORECAST\.today\.low/g) && + !__helpers.removeJSComments(code).match(/highToday = LOCAL_FORECAST\.today.high/g) ); ``` @@ -52,7 +52,7 @@ You should use destructuring to create the `lowToday` variable. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(low\s*:\s*lowToday[^}]*|[^,]*,\s*low\s*:\s*lowToday\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); @@ -62,7 +62,7 @@ You should use destructuring to create the `highToday` variable. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday,?\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index a4d5d900732..9fc0ab09b7b 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -34,8 +34,8 @@ You should remove the ES5 assignment syntax. ```js assert( - !code.match(/highToday = HIGH_TEMPERATURES\.today/g) && - !code.match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) + !__helpers.removeJSComments(code).match(/highToday = HIGH_TEMPERATURES\.today/g) && + !__helpers.removeJSComments(code).match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) ); ``` @@ -43,7 +43,7 @@ You should use destructuring to create the `highToday` variable. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(today\s*:\s*highToday[^}]*|[^,]*,\s*today\s*:\s*highToday\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); @@ -53,7 +53,7 @@ You should use destructuring to create the `highTomorrow` variable. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(tomorrow\s*:\s*highTomorrow[^}]*|[^,]*,\s*tomorrow\s*:\s*highTomorrow\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 5d71f583488..fa6536ed622 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,7 +43,7 @@ You should remove the ES5 assignment syntax. ```js assert( - !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !__helpers.removeJSComments(code).match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -51,7 +51,7 @@ You should use destructuring to create the `today` variable. ```js assert( - code.match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` @@ -59,7 +59,7 @@ You should use destructuring to create the `tomorrow` variable. ```js assert( - code.match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md index 5e5d98d9ad4..b854c6d6963 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md @@ -50,13 +50,13 @@ assert(half(stats) === 28.015); Destructuring should be used. ```js -assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/half=\({\w+,\w+}\)/)); ``` Destructured parameter should be used. ```js -assert(!code.match(/stats\.max|stats\.min/)); +assert(!__helpers.removeJSComments(code).match(/stats\.max|stats\.min/)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index 31b4e1cecf2..3b292c14093 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -47,7 +47,7 @@ assert.deepEqual(_testArr, [1, 2, 3, 4, 5]) `Array.slice()` should not be used. ```js -assert(!code.match(/\.\s*slice\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*slice\s*\(/)); ``` You should use the rest syntax. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md index cffcbbe642a..aced8c3e666 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md @@ -42,7 +42,7 @@ You should properly export `uppercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+uppercaseString|export\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)})/g ) ); @@ -52,7 +52,7 @@ You should properly export `lowercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+lowercaseString|export\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)})/g ) ); diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md index 3662a2a5b6a..16419359312 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md @@ -57,7 +57,7 @@ assert(sum() === 0); `sum` should be an arrow function which uses the rest parameter syntax (`...`) on the `args` parameter. ```js -assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/sum=\(\.\.\.args\)=>/)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md index 164b000a977..2f7b4d71c57 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md @@ -55,7 +55,7 @@ assert(arr2.every((v, i) => v === arr1[i]) && arr2.length); `...` spread operator should be used to duplicate `arr1`. ```js -assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); +assert(__helpers.removeJSComments(code).match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); ``` `arr2` should remain unchanged when `arr1` is changed. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md index b69719ca7b6..dacd988e3b1 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md @@ -54,7 +54,7 @@ assert.match(code, /const\s+myConcat/g); ```js assert( - /myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) && + /myConcat=\(\w+,\w+\)=>/.test(__helpers.removeJSComments(code).replace(/\s/g, '')) && typeof myConcat === 'function' ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 358e8df5ea9..973013765c9 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,14 +39,14 @@ Refactor the function `setGear` inside the object `bicycle` to use the shorthand Traditional function expression should not be used. ```js -assert(!code.match(/function/)); +assert(!__helpers.removeJSComments(code).match(/function/)); ``` `setGear` should be a declarative function. ```js assert( - typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/) + typeof bicycle.setGear === 'function' && __helpers.removeJSComments(code).match(/setGear\s*\(.+\)\s*\{/) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md index 5841f2d195e..698e8f8b27b 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md @@ -43,7 +43,7 @@ assert.deepEqual( Your code should not use `key:value`. ```js -assert(!code.match(/:/g)) +assert(!__helpers.removeJSComments(code).match(/:/g)) ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md index 2ed704595e3..825ddecc5e7 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md @@ -30,13 +30,13 @@ Change the `nonMutatingPush` function so it uses `concat` to merge `newItem` to Your code should use the `concat` method. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` Your code should not use the `push` method. ```js -assert(!code.match(/\.?[\s\S]*?push/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?push/g)); ``` The `first` array should not change. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md index 8023a0f9914..a47af76189d 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md @@ -31,7 +31,7 @@ The output should not have any spaces Your code should not use the `replace` method for this challenge. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `urlSlug("Winter Is Coming")` should return the string `winter-is-coming`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md index 639900381dd..48955e87d5a 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md @@ -27,13 +27,13 @@ Use the `join` method (among others) inside the `sentensify` function to make a Your code should use the `join` method. ```js -assert(code.match(/\.join/g)); +assert(__helpers.removeJSComments(code).match(/\.join/g)); ``` Your code should not use the `replace` method. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `sentensify("May-the-force-be-with-you")` should return a string. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md index 18e42098bc3..1f85418eb66 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md @@ -25,7 +25,7 @@ Use the `concat` method in the `nonMutatingConcat` function to concatenate `atta Your code should use the `concat` method. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` The `first` array should not change. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md index 5d639253214..2c7324a123d 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md @@ -47,7 +47,7 @@ assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_ Your code should not use the `map` method. ```js -assert(!code.match(/\.?[\s\S]*?map/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?map/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md index 5dd410b9d01..120acd331c2 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md @@ -43,7 +43,7 @@ assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFi Your code should not use the `filter` method. ```js -assert(!code.match(/\.?[\s\S]*?filter/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?filter/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md index efa43ab8a23..cdb646ad31e 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md @@ -77,7 +77,7 @@ assert(add(11)(22)(33) === 66); Your code should include a final statement that returns `x + y + z`. ```js -assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); +assert(__helpers.removeJSComments(code).match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md index 7b67c284b42..27f925aa552 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md @@ -30,13 +30,13 @@ Do not mutate the original array provided to the function. Your code should use the `slice` method. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` Your code should not use the `splice` method. ```js -assert(!code.match(/\.?[\s\S]*?splice/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?splice/g)); ``` You should not mutate the original array passed to the function. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md index ad25ac3ca30..3dbbb9c586c 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md @@ -28,7 +28,7 @@ Use the `slice` method in the `sliceArray` function to return part of the `anim` Your code should use the `slice` method. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` The `inputAnim` variable should not change. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md index 0dcf521c245..c57e31d884d 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md @@ -47,7 +47,7 @@ Use the `sort` method in the `alphabeticalOrder` function to sort the elements o Your code should use the `sort` method. ```js -assert(code.match(/\.sort/g)); +assert(__helpers.removeJSComments(code).match(/\.sort/g)); ``` `alphabeticalOrder(["a", "d", "c", "a", "z", "g"])` should return `["a", "a", "c", "d", "g", "z"]`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md index 790a15b15e3..8f6492382c5 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md @@ -33,7 +33,7 @@ Use the `split` method inside the `splitify` function to split `str` into an arr Your code should use the `split` method. ```js -assert(code.match(/\.split/g)); +assert(__helpers.removeJSComments(code).match(/\.split/g)); ``` `splitify("Hello World,I-am code")` should return `["Hello", "World", "I", "am", "code"]`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index 3b80b6677c1..da62f91a2ab 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), `for`, `while`, and `forEach` should not be used. ```js -assert(!code.match(/for|while|forEach/g)); +assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ``` `map`, `filter`, or `reduce` should be used. @@ -36,7 +36,7 @@ assert(!code.match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md index 61942f19549..d9e99d6855b 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md @@ -31,7 +31,7 @@ Use the `every` method inside the `checkPositive` function to check if every ele Your code should use the `every` method. ```js -assert(code.match(/\.every/g)); +assert(__helpers.removeJSComments(code).match(/\.every/g)); ``` `checkPositive([1, 2, 3, -4, 5])` should return `false`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md index cf4b07d73df..4e7bd57545d 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md @@ -46,13 +46,13 @@ assert( Your code should use the `filter` method. ```js -assert(code.match(/\s*\.\s*filter/g)); +assert(__helpers.removeJSComments(code).match(/\s*\.\s*filter/g)); ``` Your code should not use a `for` loop. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` `filteredList` should equal `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"}, {"title": "Batman Begins", "rating": "8.3"}]`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index a256fe48b94..0c4713bb9a6 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,13 +52,13 @@ assert( Your code should not use a `for` loop. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); ``` Your code should use the `map` method. ```js -assert(code.match(/\.map/g)); +assert(__helpers.removeJSComments(code).match(/\.map/g)); ``` `ratings` should equal `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"},{"title": "Batman Begins", "rating": "8.3"}, {"title": "Avatar", "rating": "7.9"}]`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md index 6d3260b0d58..f9b9ef5797c 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md @@ -66,7 +66,7 @@ assert( Your code should use the `reduce` method. ```js -assert(code.match(/\.reduce/g)); +assert(__helpers.removeJSComments(code).match(/\.reduce/g)); ``` The `getRating(watchList)` should equal 8.675. @@ -78,7 +78,7 @@ assert(getRating(watchList) === 8.675); Your code should not use a `for` loop. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` Your code should return the correct output after modifying the `watchList` object. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md index aa6b48e0bcd..7cfa6aa1dc3 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md @@ -31,7 +31,7 @@ Use the `some` method inside the `checkPositive` function to check if any elemen Your code should use the `some` method. ```js -assert(code.match(/\.some/g)); +assert(__helpers.removeJSComments(code).match(/\.some/g)); ``` `checkPositive([1, 2, 3, -4, 5])` should return `true`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md index e0538763619..e6e2f2ef50c 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md @@ -39,7 +39,7 @@ assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4]); Your solution should not use the `Array.prototype.flat()` or `Array.prototype.flatMap()` methods. ```js -assert(!code.match(/\.\s*flat\s*\(/) && !code.match(/\.\s*flatMap\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*flat\s*\(/) && !__helpers.removeJSComments(code).match(/\.\s*flatMap\s*\(/)); ``` Global variables should not be used. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md index 5313994f242..0fdd4c2bf41 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md @@ -49,7 +49,7 @@ Add the property `numLegs` and the two methods `eat()` and `describe()` to the ` `Dog.prototype` should be set to a new object. ```js -assert(/Dog\.prototype\s*?=\s*?{/.test(code)); +assert(/Dog\.prototype\s*?=\s*?{/.test(__helpers.removeJSComments(code))); ``` `Dog.prototype` should have the property `numLegs`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md index 27fa9f57b7c..07d1f417a7b 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md @@ -61,7 +61,7 @@ The `duck` variable should be initialised with `Object.create`. ```js assert( /(let|const|var)\s{1,}duck\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` @@ -71,7 +71,7 @@ The `beagle` variable should be initialised with `Object.create`. ```js assert( /(let|const|var)\s{1,}beagle\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md index 75444c77126..bad85d4905c 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md @@ -61,7 +61,7 @@ assert.deepEqual(prototypeProps, ['numLegs']); You should solve this challenge without using the built in method `Object.keys()`. ```js -assert(!/\Object.keys/.test(code)); +assert(!/\Object.keys/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md index b0c80c8ee4c..d0c24b5c472 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md @@ -43,7 +43,7 @@ assert(dog.sayLegs() === 'This dog has 4 legs.'); Your code should use the `this` keyword to access the `numLegs` property of `dog`. ```js -assert(code.match(/this\.numLegs/g)); +assert(__helpers.removeJSComments(code).match(/this\.numLegs/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md index 2eb048692a7..4053289b262 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md @@ -51,7 +51,7 @@ assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1); You should solve this challenge without using the built in method `Object.keys()`. ```js -assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); +assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(__helpers.removeJSComments(code))); ``` You should solve this challenge without hardcoding the `ownProps` array. @@ -59,7 +59,7 @@ You should solve this challenge without hardcoding the `ownProps` array. ```js assert( !/\[\s*(?:'|")(?:name|numLegs)|(?:push|concat)\(\s*(?:'|")(?:name|numLegs)/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md index 17b2bf83598..a3cd74fa7f5 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md @@ -55,7 +55,7 @@ assert(joinDogFraternity(new Dog('')) === true); `joinDogFraternity` should use the `constructor` property. ```js -assert(/\.constructor/.test(code) && !/instanceof/.test(code)); +assert(/\.constructor/.test(__helpers.removeJSComments(code)) && !/instanceof/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md index 67ebe4d0e79..6692f8321f8 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md @@ -29,13 +29,13 @@ Rewrite the function `makeNest` and remove its call so instead it's an anonymous The function should be anonymous. ```js -assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, ''))); +assert(/\((function|\(\))(=>|\(\)){?/.test(__helpers.removeJSComments(code).replace(/\s/g, ''))); ``` Your function should have parentheses at the end of the expression to call it immediately. ```js -assert(/\(.*(\)\(|\}\(\))\)/.test(code.replace(/[\s;]/g, ''))); +assert(/\(.*(\)\(|\}\(\))\)/.test(__helpers.removeJSComments(code).replace(/[\s;]/g, ''))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md index 1ee203a745f..7cca4c8aa9f 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md @@ -42,7 +42,7 @@ Modify the code to show the correct prototype chain. Your code should show that `Object.prototype` is the prototype of `Dog.prototype` ```js -assert(/Object\.prototype\.isPrototypeOf/.test(code)); +assert(/Object\.prototype\.isPrototypeOf/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md index ce7ed680ff0..4174c9b679e 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md @@ -35,7 +35,7 @@ Use `isPrototypeOf` to check the `prototype` of `beagle`. You should show that `Dog.prototype` is the `prototype` of `beagle` ```js -assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code)); +assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md index 122fcb9a59b..60d7ba24dbe 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md @@ -52,7 +52,7 @@ assert(hound instanceof Dog); Your code should use the `new` operator to create an instance of `Dog`. ```js -assert(code.match(/new/g)); +assert(__helpers.removeJSComments(code).match(/new/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md index 8441ee648aa..34f472c9bce 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md @@ -43,7 +43,7 @@ Change how `weight` is declared in the `Bird` function so it is a private variab The `weight` property should be a private variable and should be assigned the value of `15`. ```js -assert(code.match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); ``` Your code should create a method in `Bird` called `getWeight` that returns the value of the private variable `weight`. @@ -55,7 +55,7 @@ assert(new Bird().getWeight() === 15); Your `getWeight` function should return the private variable `weight`. ```js -assert(code.match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); +assert(__helpers.removeJSComments(code).match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md index c2a6b1700b5..0811bdb7f7a 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md @@ -29,13 +29,13 @@ Print both properties of the `dog` object to your console. Your code should use `console.log` to print the value for the `name` property of the `dog` object. ```js -assert(/console.log\(.*dog\.name.*\)/g.test(code)); +assert(/console.log\(.*dog\.name.*\)/g.test(__helpers.removeJSComments(code))); ``` Your code should use `console.log` to print the value for the `numLegs` property of the `dog` object. ```js -assert(/console.log\(.*dog\.numLegs.*\)/g.test(code)); +assert(/console.log\(.*dog\.numLegs.*\)/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md index 232e29ed517..02be676721b 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md @@ -53,7 +53,7 @@ assert(typeof myHouse.numBedrooms === 'number'); You should verify that `myHouse` is an instance of `House` using the `instanceof` operator. ```js -assert(/myHouse\s*instanceof\s*House/.test(code)); +assert(/myHouse\s*instanceof\s*House/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md index 54896bca102..3be5622cf5d 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md @@ -75,7 +75,7 @@ assert(!myRegex.test('EleanorRoosevelt')); You should use `.test()` to test the regex. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` Your result should return `true`. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md index 76ce1c896b6..94fcddf2360 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md @@ -51,7 +51,7 @@ assert(codingRegex.source === 'coding'); You should use the `.match()` method. ```js -assert(code.match(/\.match\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.match\(.*\)/)); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md index 3306cfb8c76..0df9ec3ba3b 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md @@ -31,7 +31,7 @@ Complete the regex `unRegex` so that it matches the strings `run`, `sun`, `fun`, You should use the `.test()` method. ```js -assert(code.match(/\.test\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.test\(.*\)/)); ``` You should use the wildcard character in your regex `unRegex` diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index fdd712a81ff..edbaaaf5134 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -52,7 +52,7 @@ assert(!waldoRegex.test('Somewhere is hiding in this text.')); You should perform a literal string match with your regex. ```js -assert(!/\/.*\/i/.test(code)); +assert(!/\/.*\/i/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md index bb35ed6c031..7e6c1eb0a7a 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md @@ -27,13 +27,13 @@ assert(result === 'Hello, World!'); Your solution should not use the `String.prototype.trim()` method. ```js -assert(!code.match(/\.?[\s\S]*?trim/)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?trim/)); ``` The `result` variable should not directly be set to a string ```js -assert(!code.match(/result\s*=\s*["'`].*?["'`]/)); +assert(!__helpers.removeJSComments(code).match(/result\s*=\s*["'`].*?["'`]/)); ``` The value of the `hello` variable should not be changed. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md index 6b1d6b05924..e4b529c5eca 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md @@ -37,7 +37,7 @@ Write a regex `fixRegex` using three capture groups that will search for each wo You should use `.replace()` to search and replace. ```js -assert(code.match(/\.replace\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.replace\(.*\)/)); ``` Your regex should change the string `one two three` to the string `three two one` @@ -49,7 +49,7 @@ assert(result === 'three two one'); You should not change the last line. ```js -assert(code.match(/result\s*=\s*str\.replace\(.*?\)/)); +assert(__helpers.removeJSComments(code).match(/result\s*=\s*str\.replace\(.*?\)/)); ``` `fixRegex` should use at least three capture groups. diff --git a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md index dddb321ec55..5a04d2617d9 100644 --- a/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md +++ b/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md @@ -31,7 +31,7 @@ Apply the regex `myRegex` on the string `myString` using the `.test()` method. You should use `.test()` to test the regex. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` Your result should return `true`. diff --git a/curriculum/challenges/korean/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md b/curriculum/challenges/korean/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md index e08d494d3f5..70a0e61b19d 100644 --- a/curriculum/challenges/korean/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md +++ b/curriculum/challenges/korean/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md @@ -15,12 +15,9 @@ You should have `if number >= 10:` within the `for` loop. ```js ({ - test: () => { - const transformedCode = code.replace(/\r/g, ""); - const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); - const { function_body } = verify_card_number; - - assert.match(function_body, /if +number +>= +10:/); + test: () => + { + assert(runPython(`_Node(_code).find_function("verify_card_number").find_for_loops()[1].find_ifs()[0].find_conditions()[0].is_equivalent("number >= 10")`)); } }) ``` diff --git a/curriculum/challenges/korean/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md b/curriculum/challenges/korean/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md index 67ac4c0e173..9127855203d 100644 --- a/curriculum/challenges/korean/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md +++ b/curriculum/challenges/korean/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md @@ -115,7 +115,10 @@ from importlib import reload reload(probability_calculator) probability_calculator.random.seed(95) -def test_hat_draw(self): + +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw(self): hat = probability_calculator.Hat(red=5,blue=2) actual = hat.draw(2) expected = ['blue', 'red'] @@ -140,6 +143,49 @@ t.result.wasSuccessful() }); ``` +The `draw` method should behave correctly when the number of balls to extract is bigger than the number of balls in the hat. + +```js +({ + test: () => { + pyodide.FS.writeFile("/home/pyodide/probability_calculator.py", code); + pyodide.FS.writeFile( + "/home/pyodide/test_module.py", + ` +import unittest +import probability_calculator +from importlib import reload + +reload(probability_calculator) + +probability_calculator.random.seed(95) +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw_2(self): + hat = probability_calculator.Hat(yellow=5,red=1,green=3,blue=9,test=1) + actual = hat.draw(20) + expected = ['yellow', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'green', 'green', 'green', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'test'] + self.assertEqual(actual, expected, 'Expected hat draw to return all items from hat contents.') + actual = len(hat.contents) + expected = 0 + self.assertEqual(actual, expected, 'Expected hat draw to leave no items in contents.') + ` + ); + const testCode = ` +from unittest import main +import test_module +from importlib import reload + +reload(test_module) +t = main(module='test_module', exit=False) +t.result.wasSuccessful() +`; + const out = __pyodide.runPython(testCode); + assert(out); + }, +}); +``` + The `experiment` method should return a different probability. @@ -221,7 +267,8 @@ class Hat: def draw(self, number): drawn = [] if number >= len(self.contents): - return self.contents + drawn.extend(self.contents) + self.contents = [] else: for i in range(number): drawn.append( @@ -229,8 +276,7 @@ class Hat: ) return drawn -def experiment(hat, expected_balls, num_balls_drawn, num_experiments): - +def experiment(hat, expected_balls, num_balls_drawn, num_experiments): expected_balls_list = [] drawn_list = [] success = 0 @@ -248,12 +294,7 @@ def experiment(hat, expected_balls, num_balls_drawn, num_experiments): except: continue if len(exp_ball_list_copy) == 0: - success += 1 - - - - - probability = success/num_experiments - + success += 1 + probability = success/num_experiments return probability ``` diff --git a/curriculum/challenges/korean/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md b/curriculum/challenges/korean/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md index 19ea0d3c265..397f8d13d67 100644 --- a/curriculum/challenges/korean/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md +++ b/curriculum/challenges/korean/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md @@ -48,9 +48,9 @@ The initial declaration of the `homeworkStack` should not be changed. ```js assert( - code.match(/=/g).length === 1 && + __helpers.removeJSComments(code).match(/=/g).length === 1 && /homeworkStack\s*=\s*\["BIO12"\s*,\s*"HIS80"\s*,\s*"MAT122"\s*,\s*"PSY44"\]/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/korean/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md b/curriculum/challenges/korean/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md index 82012ae3d4b..b4cce805660 100644 --- a/curriculum/challenges/korean/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md +++ b/curriculum/challenges/korean/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md @@ -2,7 +2,6 @@ id: 5f356ed60a5decd94ab66986 title: Step 22 challengeType: 0 -removeComments: false dashedName: step-22 --- diff --git a/curriculum/challenges/korean/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md b/curriculum/challenges/korean/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md index fac990dcb91..340e36a5af3 100644 --- a/curriculum/challenges/korean/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md +++ b/curriculum/challenges/korean/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md @@ -40,15 +40,15 @@ assert(canvasFilter === 'blur(2px)'); ## --seed-contents-- ```css +--fcc-editable-region-- .canvas { width: 500px; height: 600px; background-color: #4d0f00; overflow: hidden; ---fcc-editable-region-- ---fcc-editable-region-- } +--fcc-editable-region-- .frame { border: 50px solid black; diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md index 34fdc27ecd6..64886ee7c7a 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md @@ -7,7 +7,7 @@ dashedName: step-55 # --description-- -Inside, the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. +Inside the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. Now, you should see a category displayed underneath each post topic. diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md index eca279b42fe..b69803b87d0 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md @@ -7,9 +7,11 @@ dashedName: step-43 # --description-- -Notice how the `10` value is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. +Notice how the number `10` is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the numbers values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. -To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. Leave the function empty for now. +To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. The parameters of `a` and `b` represent the number values in the array that will be sorted. + +Leave the function empty for now. # --hints-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md index d253c95b6c6..ee57c994e55 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md @@ -26,7 +26,7 @@ assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\( Your callback function should return `a - b`. ```js -assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+a\s*-\s*b\s*;?\s*}\s*\)/); +assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+(?:parseInt)?(?:Number)?\(?a\)?\s*-\s*(?:parseInt)?(?:Number)?\(?b\)?\s*;?\s*}\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b514741ae01..b1b54dda895 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -11,6 +11,8 @@ In your `evalFormula`, declare an `idToText` arrow function which takes an `id` Your `idToText` function should return the result of calling `.find()` on the `cells` array with a callback function that takes an `cell` parameter and returns `cell.id === id`. +Both of your functions should use implicit returns. + # --hints-- You should declare an `idToText` variable in your `evalFormula` function. diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md index 57110b715a9..37487b1771c 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md @@ -23,13 +23,7 @@ Open up the console to see the result. # --hints-- -You should call `.repeat()` on your two `" "` strings. - -```js -assert.lengthOf(code.match(/" ".repeat/g), 2); -``` - -Your `" "` strings should be repeated `rowCount - rowNumber` times. +You should call `.repeat()` on your `" "` strings to repeat them `rowCount - rowNumber` times. ```js assert.equal(padRow(1, 3), " # "); diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md index 3306b1a478b..4170d3bd12b 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md @@ -3,7 +3,6 @@ id: 660f3ce51f70571e1c5227c8 title: Step 69 challengeType: 1 dashedName: step-69 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md index ea0a831040f..7a939244a7c 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md @@ -3,7 +3,6 @@ id: 660f3dd626be3a1ffe27e5d1 title: Step 70 challengeType: 1 dashedName: step-70 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md index e30d808ccb6..b676558ec74 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md @@ -3,7 +3,6 @@ id: 660f4f79e2a82a4e92290f44 title: Step 101 challengeType: 1 dashedName: step-101 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md index dc683e61ce5..3f088de2c91 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md @@ -3,7 +3,6 @@ id: 660f53ad3d39175c5d4335ac title: Step 108 challengeType: 1 dashedName: step-108 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md new file mode 100644 index 00000000000..286128cc2cf --- /dev/null +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md @@ -0,0 +1,74 @@ +--- +id: 662693f82c91a66be46c881b +title: Step 1 +challengeType: 1 +dashedName: step-1 +--- + +# --description-- + +A teacher has finished grading their students' tests and needs your help to calculate the average score for the class. + +Complete the `getAverage` function which takes in an array of test scores and returns the average score. + +The average is calculated by adding up all the scores and dividing by the total number of scores. + +```js +average = sum of all scores / total number of scores +``` + +A couple of function calls have been provided for you so you can test out your code. + +**Tips** + +- You can use a loop to iterate over the `scores` array and add up all the scores. +- You can use the `length` property to get the total number of scores. + +# --hints-- + +Your `getAverage` function should return a number. + +```js +assert.strictEqual(typeof getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 'number'); +``` + +`getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])` should return `71.7`. + +```js +assert.strictEqual(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 71.7); +``` + +`getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])` should return `85.4`. + +```js +assert.strictEqual(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]), 85.4); +``` + +`getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100])` should return `92.4`. + +```js +assert.strictEqual(getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100]), 92.4); +``` + +Your `getAverage` function should return the average score of the test scores. + +```js +assert.strictEqual(getAverage([52, 56, 60, 65, 70, 75, 80, 85, 90, 95]), 72.8); +assert.strictEqual(getAverage([45, 50, 55, 60, 65, 70, 75, 80, 85, 90]), 67.5); +assert.strictEqual(getAverage([38, 42, 46, 50, 54, 58, 62, 66, 70, 74]), 56); +``` + +# --seed-- + +## --seed-contents-- + +```js +--fcc-editable-region-- +function getAverage(scores) { + +} + +console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])); +console.log(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md new file mode 100644 index 00000000000..f7e9253a5a5 --- /dev/null +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md @@ -0,0 +1,104 @@ +--- +id: 6626a060c4006f793e10cb33 +title: Step 2 +challengeType: 1 +dashedName: step-2 +--- + +# --description-- + +Now the teacher needs your help converting the student score to a letter grade. + +Complete the `getGrade` function that takes a number `score` as a parameter. Your function should return a string representing a letter grade based on the score. + +Here are the scores and their corresponding letter grades: + +| Score Range | Grade | +| ----------- | ------- | +| `100` | `"A++"` | +| `90 - 99` | `"A"` | +| `80 - 89` | `"B"` | +| `70 - 79` | `"C"` | +| `60 - 69` | `"D"` | +| `0 - 59` | `"F"` | + + +**Tips** + +- Remember that you learned about conditional statements(`if`, `else if`, and `else`). +- Remember that you learned about comparison operators (`>`, `<`, `>=`, `<=`, `===`). + +# --hints-- + +Your `getGrade` function should return `"A++"` if the score is `100`. + +```js +assert.strictEqual(getGrade(100), "A++"); +``` + +Your `getGrade` function should return `"A"` if the score is `94`. + +```js +assert.strictEqual(getGrade(94), "A"); +``` + +Your `getGrade` function should return `"B"` if the score is between `80` and `89`. + +```js +assert.strictEqual(getGrade(80), "B"); +assert.strictEqual(getGrade(83), "B"); +assert.strictEqual(getGrade(88), "B"); +``` + +Your `getGrade` function should return `"C"` if the score is `78`. + +```js +assert.strictEqual(getGrade(75), "C"); +``` + +Your `getGrade` function should return `"D"` if the score is between `60` and `69`. + +```js +assert.strictEqual(getGrade(60), "D"); +assert.strictEqual(getGrade(63), "D"); +assert.strictEqual(getGrade(68), "D"); +``` + +Your `getGrade` function should return `"F"` if the score is `57`. + +```js +assert.strictEqual(getGrade(57), "F"); +``` + +Your `getGrade` function should return `"F"` if the score is between `0` and `59`. + +```js +assert.strictEqual(getGrade(0), "F"); +assert.strictEqual(getGrade(30), "F"); +assert.strictEqual(getGrade(43), "F"); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} +--fcc-editable-region-- +function getGrade(score) { + +} + +console.log(getGrade(96)); +console.log(getGrade(82)); +console.log(getGrade(56)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md new file mode 100644 index 00000000000..b168e1325fc --- /dev/null +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md @@ -0,0 +1,88 @@ +--- +id: 6626b4c58c027d86478ff5eb +title: Step 3 +challengeType: 1 +dashedName: step-3 +--- + +# --description-- + +The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an `"F"`. + +Complete the function `hasPassingGrade` that takes a student score as a parameter. Your function should return `true` if the student has a passing grade and `false` if they do not. + +**Tips** + +- Use the `getGrade` function to get the student's grade. Then check if the grade is passing or not. + +# --hints-- + +Your `hasPassingGrade` function should return a boolean value. + +```js +assert.strictEqual(typeof hasPassingGrade(100), "boolean"); +``` + +Your `hasPassingGrade` function should return `true` if the grade is an `"A"`. + +```js +assert.isTrue(hasPassingGrade(100)); +``` + +Your `hasPassingGrade` function should return `false` if the grade is an `"F"`. + +```js +assert.isFalse(hasPassingGrade(53)); +``` + +Your `hasPassingGrade` function should return `true` for all passing grades. + +```js +assert.isTrue(hasPassingGrade(87)); +assert.isTrue(hasPassingGrade(60)); +assert.isTrue(hasPassingGrade(73)); +assert.isTrue(hasPassingGrade(96)); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +--fcc-editable-region-- +function hasPassingGrade(score) { + +} + + +console.log(hasPassingGrade(100)); +console.log(hasPassingGrade(53)); +console.log(hasPassingGrade(87)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md new file mode 100644 index 00000000000..08ee3cea27b --- /dev/null +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md @@ -0,0 +1,143 @@ +--- +id: 6626b8dcf5057f896f948440 +title: Step 4 +challengeType: 1 +dashedName: step-4 +--- + +# --description-- + +Now that the teacher has all of the information they need, they want to be able to message the student with the results. + +Complete the `studentMsg` function with `totalScores` and `studentScore` for parameters. The function should return a string representing a message to the student. + +If the student passed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You passed the course. +``` + +If the student failed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You failed the course. +``` + +Replace `average-goes-here` with the average of the total scores. Replace `grade-goes-here` with the student's grade. + +**Tips** + +- Use the `getAverage` function to get the class average. +- Use the `getGrade` function to get the student's grade. +- Use string concatenation (`+`) to build the message. +- Be careful with the punctuation and spaces in the message. + +# --hints-- + +Your function call of `studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)` should return the following message: `"Class average: 71.7. Your grade: F. You failed the course."`. + +```js +assert.strictEqual(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37), "Class average: 71.7. Your grade: F. You failed the course."); +``` + +Your function call of `studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)` should return the following message: `"Class average: 50.8. Your grade: A++. You passed the course."`. + +```js +assert.strictEqual(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100), "Class average: 50.8. Your grade: A++. You passed the course."); +``` + +Your `studentMsg` function should return a the correct message based on the student's score and the class average. + +```js +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 92), "Class average: 70.25. Your grade: A. You passed the course."); +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 57), "Class average: 70.25. Your grade: F. You failed the course."); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +--fcc-editable-region-- +function studentMsg(totalScores, studentScore) { + +} +console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)); +--fcc-editable-region-- + +``` + + +# --solutions-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +function studentMsg(totalScores, studentScore) { + let average = getAverage(totalScores); + let grade = getGrade(studentScore); + + return `Class average: ${average}. Your grade: ${grade}. You ${ + hasPassingGrade(studentScore) ? "passed" : "failed" + } the course.`; +} + +``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md index 20af8b4c141..f873d585641 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md @@ -87,7 +87,7 @@ assert(confirmEnding('Abstraction', 'action') === true); Seu código não deve usar o método integrado `.endsWith()` para resolver o desafio. ```js -assert(!/\.endsWith\(.*?\)\s*?;?/.test(code) && !/\['endsWith'\]/.test(code)); +assert(!/\.endsWith\(.*?\)\s*?;?/.test(__helpers.removeJSComments(code)) && !/\['endsWith'\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md index 68f9159031f..64d5f65de8c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md @@ -51,7 +51,7 @@ assert(repeatStringNumTimes('abc', -2) === ''); O método integrado `repeat()` não deve ser usado. ```js -assert(!/\.repeat/g.test(code)); +assert(!/\.repeat/g.test(__helpers.removeJSComments(code))); ``` `repeatStringNumTimes("abc", 0)` deve retornar `""`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md index 13098915943..97badc52273 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md @@ -53,19 +53,19 @@ assert.deepEqual( A função `htmlColorNames` deve utilizar o método `splice()` ```js -assert(/.splice/.test(code)); +assert(/.splice/.test(__helpers.removeJSComments(code))); ``` Você não deve usar `shift()` ou `unshift()`. ```js -assert(!/shift|unshift/.test(code)); +assert(!/shift|unshift/.test(__helpers.removeJSComments(code))); ``` Você não deve usar a notação de colchetes de array. ```js -assert(!/\[\d\]\s*=/.test(code)); +assert(!/\[\d\]\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md index 3b44689cbe1..c52558154e9 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md @@ -85,8 +85,8 @@ A definição do objeto `foods` não deve ser alterada. ```js assert( - code.search(/let foods/) === -1 && - code.search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ + __helpers.removeJSComments(code).search(/let foods/) === -1 && + __helpers.removeJSComments(code).search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ ) !== -1 ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md index 7079519b9e3..f633025021a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md @@ -27,7 +27,7 @@ O objeto `users` não deve ser acessado diretamente ```js -assert(code.match(/users/gm).length <= 2) +assert(__helpers.removeJSComments(code).match(/users/gm).length <= 2) ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index ee5255e0658..386aa7666f8 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ A função `copyMachine` deve utilizar o operador `spread` com array `arr` ```js -assert(code.match(/\.\.\.\s*arr/)); +assert(__helpers.removeJSComments(__helpers.removeJSComments(code)).match(/\.\.\.\s*arr/)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md index 9f1b1720bb2..6743367e347 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md @@ -38,7 +38,7 @@ assert.deepEqual( A função `forecast` deve usar o método `slice()` ```js -assert(/\.slice\(/.test(code)); +assert(/\.slice\(/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index e414f684ee5..d3203fc5613 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -51,7 +51,7 @@ A função `countOnline` deve usar a instrução `for in` para iterar através d ```js assert( - code.match( + __helpers.removeJSComments(code).match( /for\s*\(\s*(var|let|const)\s+[a-zA-Z_$]\w*\s+in\s+[a-zA-Z_$]\w*\s*\)/ ) ); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md index a4322ae608a..5cd2a881994 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md @@ -61,7 +61,7 @@ assert(userActivity.data.online === 45); A propriedade `online` deve ser definindo usando a notação de ponto ou de colchetes. ```js -assert.strictEqual(code.search(/online: 45/), -1); +assert.strictEqual(__helpers.removeJSComments(code).search(/online: 45/), -1); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md index 45df35126e0..bde707df818 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md @@ -40,7 +40,7 @@ Você não deve alterar a linha original: `const arr = [2, 4, 5, 1, 7, 5, 2, 1]; ```js assert( - __helpers.removeWhiteSpace(code).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) ); ``` @@ -56,14 +56,14 @@ assert.strictEqual( Seu código deve utilizar o método `splice()` em `arr`. ```js -assert(__helpers.removeWhiteSpace(code).match(/arr\.splice\(/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(/)); ``` O splice deve remover apenas os elementos de `arr` e não adicionar qualquer elemento a mais para `arr`. ```js assert( - !__helpers.removeWhiteSpace(code).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) + !__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md index 6c4692b4c21..8fa1199ccb2 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md @@ -39,9 +39,9 @@ As chaves `oranges`, `plums` e `strawberries` devem ser removidos usando `delete ```js assert( - code.search(/oranges:/) !== -1 && - code.search(/plums:/) !== -1 && - code.search(/strawberries:/) !== -1 + __helpers.removeJSComments(code).search(/oranges:/) !== -1 && + __helpers.removeJSComments(code).search(/plums:/) !== -1 && + __helpers.removeJSComments(code).search(/strawberries:/) !== -1 ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md index 911d88c1561..682505d09d5 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md @@ -54,7 +54,7 @@ O dado na variável `myArray` deve ser acessado usando notação de colchetes. ```js assert( (function () { - if (code.match(/\s*=\s*myArray\[0\]/g)) { + if (__helpers.removeJSComments(code).match(/\s*=\s*myArray\[0\]/g)) { return true; } else { return false; diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md index a1e0dc5899f..637b10e5bb8 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md @@ -45,7 +45,7 @@ assert(myData === 8); Você deve usar notação de colchetes para ler o valor correto de `myArray`. ```js -assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code))); +assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md index 524acae295a..d306bcd9402 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md @@ -54,7 +54,7 @@ assert(secondTree === 'pine'); O código deve usar notação de ponto e colchetes para acessar `myPlants`. ```js -assert(/=\s*myPlants\[1\].list\[1\]/.test(code)); +assert(/=\s*myPlants\[1\].list\[1\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md index 5986eb8a2e1..e3bf54a43e2 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md @@ -64,7 +64,7 @@ assert(drinkValue === 'water'); Você deve usar a notação de colchetes duas vezes ```js -assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md index e905c56a2a2..6fe7c92e4ee 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md @@ -60,7 +60,7 @@ assert(shirtValue === 'jersey'); Você deve usar notação de ponto duas vezes ```js -assert(code.match(/testObj\.\w+/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\.\w+/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md index 37ee4b413d1..1f7549ed766 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md @@ -56,19 +56,19 @@ assert(player === 'Montana'); Você deve usar a notação de colchetes para acessar `testObj` ```js -assert(/testObj\s*?\[.*?\]/.test(code)); +assert(/testObj\s*?\[.*?\]/.test(__helpers.removeJSComments(code))); ``` Você não deve usar o valor `Montana` diretamente para a variável `player`. ```js -assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); +assert(!__helpers.removeJSComments(code).match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); ``` Você deve estar usando a variável `playerNumber` na sua notação de colchetes ```js -assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code)); +assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md index 7c321d33e3e..ed0d61cbac4 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md @@ -53,7 +53,7 @@ assert(myDog.bark !== undefined); Você não deve adicionar `bark` na inicialização de `myDog`. ```js -assert(!/bark[^\n]:/.test(code)); +assert(!/bark[^\n]:/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md index d9d0552b855..61b6304805c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md @@ -38,7 +38,7 @@ assert(sum === 20); Você deve usar o operador `+`. ```js -assert(/\+/.test(code)); +assert(/\+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md index beffc0750b1..de5e0c2ab7c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md @@ -71,7 +71,7 @@ assert(switchOfStuff(4) === 'stuff'); Você não deve usar nenhuma instrução do tipo `if` ou `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Você deve usar a instrução `default` @@ -83,7 +83,7 @@ assert(switchOfStuff('string-to-trigger-default-case') === 'stuff'); Você deve ter pelo menos 3 instruções `break` ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md index 06d6a5f57ad..9579842855a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md @@ -36,7 +36,7 @@ assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2); Você deve adicionar `someAdjective` para `myStr` usando o operador `+=`. ```js -assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md index 85a21e36984..59081122d19 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md @@ -29,7 +29,7 @@ Atribua o conteúdo de `a` para a variável `b`. Você não deve alterar o código acima do comentário especificado. ```js -assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code))); ``` `b` deve ter um valor de `7`. @@ -41,7 +41,7 @@ assert(typeof b === 'number' && b === 7); `a` deve ser atribuído para `b` com `=`. ```js -assert(/b\s*=\s*a\s*/g.test(code)); +assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md index fae27bb7b41..2a4a8ba831f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md @@ -34,7 +34,7 @@ assert(processed === 2); Você deve atribuir `processArg` para `processed` ```js -assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code)); +assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md index df613db9894..81f74b4838e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md @@ -39,19 +39,19 @@ Escreva instruções encadeadas `if`/`else if` para atender às seguintes condi Você deve ter pelo menos quatro instruções `else` ```js -assert(code.match(/else/g).length > 3); +assert(__helpers.removeJSComments(code).match(/else/g).length > 3); ``` Você deve ter pelo menos quatro instruções `if` ```js -assert(code.match(/if/g).length > 3); +assert(__helpers.removeJSComments(code).match(/if/g).length > 3); ``` Você deve ter pelo menos um comando `return` ```js -assert(code.match(/return/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/return/g).length >= 1); ``` `testSize(0)` deve retornar a string `Tiny` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index d9dc0e1ad7e..7e80462241c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -2,7 +2,6 @@ id: bd7123c9c441eddfaeb4bdef title: Comentar seu código JavaScript challengeType: 1 -removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' forumTopicId: 16783 dashedName: comment-your-javascript-code diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index 6913dfbc735..41235d68fcc 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -58,7 +58,7 @@ assert(testEqual('12') === 'Equal'); Você deve utilizar o operador `==` ```js -assert(code.match(/==/g) && !code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/==/g) && !__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index b061cf5726b..f2b127f4e14 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -73,7 +73,7 @@ assert(testGreaterThan(150) === 'Over 100'); Você deve usar o operador `>` pelo menos duas vezes ```js -assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index 9265ed044ec..6389ba37dee 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -73,7 +73,7 @@ assert(testGreaterOrEqual(21) === '20 or Over'); Você deve usar o operador `>=` pelo menos duas vezes ```js -assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index 8ab62817a30..573e5214ed1 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -60,7 +60,7 @@ assert(testNotEqual('bob') === 'Not Equal'); Você deve usar o operador `!=` ```js -assert(code.match(/(?!!==)!=/)); +assert(__helpers.removeJSComments(code).match(/(?!!==)!=/)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index 8ed11f83140..b28b8b26900 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -66,7 +66,7 @@ assert(testLessThan(99) === '55 or Over'); Você deve usar o operador `<` pelo menos duas vezes ```js -assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index fd35ccf26a6..06f4f78ffb8 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -72,7 +72,7 @@ assert(testLessOrEqual(55) === 'More Than 24'); Você deve usar o operador `<=` pelo menos duas vezes ```js -assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index 9ebd7fbfd76..826e0ec28d2 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -49,7 +49,7 @@ assert(testStrict('7') === 'Not Equal'); Você deve usar o operador `===` ```js -assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index 868fc2481d3..fed7a8b59a9 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -52,7 +52,7 @@ assert(testStrictNotEqual('bob') === 'Not Equal'); Você deve usar o operador `!==` ```js -assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md index 63007438729..ea857e4c1d7 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md @@ -40,13 +40,13 @@ Substitua as duas instruções if por uma declaração, usando o operador `&&`, Você deve usar o operador `&&` uma vez ```js -assert(code.match(/&&/g).length === 1); +assert(__helpers.removeJSComments(code).match(/&&/g).length === 1); ``` Você deve ter apenas um comando `if` ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalAnd(0)` deve retornar a string `No` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md index 26bf611687d..8cca56a8d53 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md @@ -43,13 +43,13 @@ Combine as duas instruções `if` em uma mesma instrução a qual retorna a stri Você deve usar o operador `||` uma vez ```js -assert(code.match(/\|\|/g).length === 1); +assert(__helpers.removeJSComments(code).match(/\|\|/g).length === 1); ``` Você deve ter apenas uma instrução `if` ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalOr(0)` deve retornar a string `Outside` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md index efb651fb177..0d8bec7f89e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md @@ -54,16 +54,16 @@ assert(c === 19); Você deve usar o operador `+=` para cada variável. ```js -assert(code.match(/\+=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\+=/g).length === 3); ``` Você não deve modificar o código acima do comentário especificado. ```js assert( - /let a = 3;/.test(code) && - /let b = 17;/.test(code) && - /let c = 12;/.test(code) + /let a = 3;/.test(__helpers.removeJSComments(code)) && + /let b = 17;/.test(__helpers.removeJSComments(code)) && + /let c = 12;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md index 79574ac77de..60d58231dc1 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md @@ -48,16 +48,16 @@ assert(c === 3); Você deve usar o operador `/=` para cada variável. ```js -assert(code.match(/\/=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\/=/g).length === 3); ``` Você não deve modificar o código acima do comentário especificado. ```js assert( - /let a = 48;/.test(code) && - /let b = 108;/.test(code) && - /let c = 33;/.test(code) + /let a = 48;/.test(__helpers.removeJSComments(code)) && + /let b = 108;/.test(__helpers.removeJSComments(code)) && + /let c = 33;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md index 9ab507cf2c5..76a7ea7d6db 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md @@ -48,16 +48,16 @@ assert(c === 46); Você deve usar o operador `*=` para cada variável. ```js -assert(code.match(/\*=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\*=/g).length === 3); ``` Você não deve modificar o código acima do comentário especificado. ```js assert( - /let a = 5;/.test(code) && - /let b = 12;/.test(code) && - /let c = 4\.6;/.test(code) + /let a = 5;/.test(__helpers.removeJSComments(code)) && + /let b = 12;/.test(__helpers.removeJSComments(code)) && + /let c = 4\.6;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md index 2dae4695cdc..40b34048897 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md @@ -48,14 +48,14 @@ assert(c === 2); Você deve usar o operador `-=` para cada variável. ```js -assert(code.match(/-=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/-=/g).length === 3); ``` Você não deve modificar o código acima do comentário especificado. ```js assert( - /let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code) + /let a = 11;/.test(__helpers.removeJSComments(code)) && /let b = 9;/.test(__helpers.removeJSComments(code)) && /let c = 3;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md index 276efb3e7af..ced4bcc3b1e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md @@ -47,19 +47,19 @@ assert(myStr === 'This is the start. This is the end.'); Você deve usar o operador `+` para criar `myStr`. ```js -assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g)); +assert(__helpers.removeJSComments(code).match(/(["']).*\1\s*\+\s*(["']).*\2/g)); ``` `myStr` deve ser criada usando a palavra-chave `const`. ```js -assert(/const\s+myStr/.test(code)); +assert(/const\s+myStr/.test(__helpers.removeJSComments(code))); ``` Você deve atribuir o resultado à variável `myStr`. ```js -assert(/myStr\s*=/.test(code)); +assert(/myStr\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index e9f1d491bd7..50343343b5b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -43,7 +43,7 @@ assert(myStr === 'This is the first sentence. This is the second sentence.'); Você deve usar o operador `+=` para criar `myStr`. ```js -assert(code.match(/myStr\s*\+=\s*(["']).*\1/g)); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*(["']).*\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md index 908f3a99065..f98912dd48f 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md @@ -35,7 +35,7 @@ assert(typeof myName !== 'undefined' && myName.length > 2); Você deve usar dois operadores `+` para criar `myStr` com `myName` dentro dela. ```js -assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); +assert(__helpers.removeJSComments(code).match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md index 7d28fc1c77d..17d53fd3120 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md @@ -34,13 +34,13 @@ Adicione (push) os números ímpares de 9 até 1 para `myArray` usando um laço Você deve estar usando um laço `for` para isso. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` Você deve usar o método de array `push`. ```js -assert(code.match(/myArray.push/)); +assert(__helpers.removeJSComments(code).match(/myArray.push/)); ``` `myArray` deve ser igual a `[9, 7, 5, 3, 1]`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md index dcfd486c73b..4db7d122a49 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md @@ -37,7 +37,7 @@ Olhe o exemplo acima de `ourName` se você ficar travado. Você deve declarar `myName` com a palavra-chave `var`, terminando com ponto e vírgula ```js -assert(/var\s+myName\s*;/.test(code)); +assert(/var\s+myName\s*;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md index 661078e2419..a7e5a2140f7 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md @@ -38,25 +38,25 @@ assert(myVar === 10); `myVar = myVar - 1;` deve ser alterado. ```js -assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); ``` Você não deve atribuir a `myVar` o valor `10`. ```js -assert(!code.match(/myVar\s*=\s*10.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*10.*?;?/)); ``` Você deve usar o operador `--` na variável `myVar`. ```js -assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code)); +assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(__helpers.removeJSComments(code))); ``` Você não deve alterar o código acima do comentário especificado. ```js -assert(/let myVar = 11;/.test(code)); +assert(/let myVar = 11;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md index 0934dfc7581..49b62f34de6 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md @@ -55,7 +55,7 @@ assert(typeof myDog === 'object' && myDog.tails === undefined); Você não deve modificar a configuração de `myDog`. ```js -assert(code.match(/"tails": 1/g).length > 0); +assert(__helpers.removeJSComments(code).match(/"tails": 1/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md index 2a8c34f3c5d..5ef0ff1c491 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md @@ -26,13 +26,13 @@ assert(quotient === 2.2); Você deve usar o operador `/` para dividir 4.4 por 2 ```js -assert(/4\.40*\s*\/\s*2\.*0*/.test(code)); +assert(/4\.40*\s*\/\s*2\.*0*/.test(__helpers.removeJSComments(code))); ``` A variável quotient deve ser atribuída apenas uma vez ```js -assert(code.match(/quotient\s*=/g).length === 1); +assert(__helpers.removeJSComments(code).match(/quotient\s*=/g).length === 1); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md index 0fe66dbf7d9..39d4e02a208 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md @@ -35,7 +35,7 @@ assert(quotient === 2); Você deve usar o operador `/`. ```js -assert(/\d+\s*\/\s*\d+/.test(code)); +assert(/\d+\s*\/\s*\d+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md index 8f69291841e..5444c848f30 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md @@ -36,7 +36,7 @@ I am a "double quoted" string inside "double quotes". Você deve usar aspas duplas (`"`) e quatro aspas duplas escapadas (`\"`). ```js -assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2); +assert(__helpers.removeJSComments(code).match(/\\"/g).length === 4 && __helpers.removeJSComments(code).match(/[^\\]"/g).length === 2); ``` Variável `myStr` deve conter a string: `I am a "double quoted" string inside "double quotes".` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md index c934ace0472..ab3b3d774cd 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md @@ -29,8 +29,8 @@ Você não deve alterar as declarações de variáveis na seção `// Setup`. ```js assert( - code.match(/let lastNameLength = 0;/) && - code.match(/const lastName = "Lovelace";/) + __helpers.removeJSComments(code).match(/let lastNameLength = 0;/) && + __helpers.removeJSComments(code).match(/const lastName = "Lovelace";/) ); ``` @@ -43,7 +43,7 @@ assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8); Você deve estar recebendo o tamanho de `lastName` ao usar `.length` dessa forma: `lastName.length`. ```js -assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/)); +assert(__helpers.removeJSComments(code).match(/=\s*lastName\.length/g) && !__helpers.removeJSComments(code).match(/lastName\s*=\s*8/)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md index 45ab85eda47..ea3b6172408 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md @@ -39,7 +39,7 @@ Define `remainder` como o resto da divisão de `11` por `3` usando o operador de A variável `remainder` deve ser inicializada ```js -assert(/(const|let|var)\s+?remainder/.test(code)); +assert(/(const|let|var)\s+?remainder/.test(__helpers.removeJSComments(code))); ``` O valor de `remainder` deve ser `2` @@ -51,7 +51,7 @@ assert(remainder === 2); Você deve usar o operador `%` ```js -assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code)); +assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md index 4f87c277fee..cc634db7ef8 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md @@ -36,7 +36,7 @@ assert((randomFraction() + '').match(/\./g)); Você deve estar usando `Math.random` para gerar o número decimal aleatório. ```js -assert(code.match(/Math\.random/g).length >= 0); +assert(__helpers.removeJSComments(code).match(/Math\.random/g).length >= 0); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md index c27c6757df9..62ca6334cfb 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md @@ -46,22 +46,22 @@ assert( Você deve usar `Math.random` para gerar um número aleatório. ```js -assert(code.match(/Math.random/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.random/g).length >= 1); ``` Você deve ter multiplicado o resultado de `Math.random` por 10 para torná-lo um número entre zero e nove. ```js assert( - code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || - code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) + __helpers.removeJSComments(code).match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || + __helpers.removeJSComments(code).match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) ); ``` Você deve usar `Math.floor` para remover a parte decimal do número. ```js -assert(code.match(/Math.floor/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.floor/g).length >= 1); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md index f8c76d94ee6..0af27902640 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md @@ -49,10 +49,10 @@ assert(randomRange(0, 1) % 1 === 0); assert( (function () { if ( - code.match(/myMax/g).length > 1 && - code.match(/myMin/g).length > 2 && - code.match(/Math.floor/g) && - code.match(/Math.random/g) + __helpers.removeJSComments(code).match(/myMax/g).length > 1 && + __helpers.removeJSComments(code).match(/myMin/g).length > 2 && + __helpers.removeJSComments(code).match(/Math.floor/g) && + __helpers.removeJSComments(code).match(/Math.random/g) ) { return true; } else { diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md index 2b672b394e5..d6e80190e2b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md @@ -36,7 +36,7 @@ assert(myGlobal === 10); `myGlobal` deve ser declarada usando a palavra-chave `let` ou `const` ```js -assert(/(let|const)\s+myGlobal/.test(code)); +assert(/(let|const)\s+myGlobal/.test(__helpers.removeJSComments(code))); ``` `oopsGlobal` deve ser uma variável global e ter o valor de `5` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md index d1a03237e60..1b494f24500 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md @@ -45,7 +45,7 @@ assert(myOutfit() === 'sweater'); Você não deve alterar a instrução de retorno. ```js -assert(/return outerWear/.test(code)); +assert(/return outerWear/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md index 936e21280b0..89d3cc969ec 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md @@ -39,20 +39,20 @@ Você não deve usar o operador de atribuição. ```js assert( - /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(code) + /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(__helpers.removeJSComments(code)) ); ``` Você deve usar o operador `++`. ```js -assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code)); +assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(__helpers.removeJSComments(code))); ``` Você não deve alterar o código acima do comentário especificado. ```js -assert(/let myVar = 87;/.test(code)); +assert(/let myVar = 87;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md index 2de792c0249..ace68edc8e0 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md @@ -26,7 +26,7 @@ Defina uma variável `a` com `var` e a inicialize com o valor de `9`. Você deve inicializar `a` para o valor de `9`. ```js -assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code)); +assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md index 4fc57735314..4a4c2f967e0 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md @@ -30,20 +30,20 @@ Converta a lógica para usar instruções `else if`. Você deve ter pelo menos duas instruções `else` ```js -assert(code.match(/else/g).length > 1); +assert(__helpers.removeJSComments(code).match(/else/g).length > 1); ``` Você deve ter pelo menos duas instruções `if` ```js -assert(code.match(/if/g).length > 1); +assert(__helpers.removeJSComments(code).match(/if/g).length > 1); ``` Você deve ter chaves de abertura e fechamento para cada bloco de código de `if else`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/ ) ); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md index 874d3ed9a34..c6704ccb269 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md @@ -28,13 +28,13 @@ Combine as instruções `if` em uma única instrução `if/else`. Você deve ter apenas uma instrução `if` no editor ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` Você deve usar uma instrução `else` ```js -assert(/else/g.test(code)); +assert(/else/g.test(__helpers.removeJSComments(code))); ``` `testElse(4)` deve retornar a string `5 or Smaller` @@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5'); Você não deve alterar o código acima ou abaixo dos comentários especificados. ```js -assert(/let result = "";/.test(code) && /return result;/.test(code)); +assert(/let result = "";/.test(__helpers.removeJSComments(code)) && /return result;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md index e3f57901640..c4d786213f5 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md @@ -32,7 +32,7 @@ Adicione (push) os números ímpares de 9 até 1 para `myArray` usando um laço Você deve estar usando um laço `for` para isso. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` deve ser igual a `[1, 3, 5, 7, 9]`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md index 4860c8cfdea..d0402875137 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md @@ -30,7 +30,7 @@ Declare e inicialize uma variável `total` como `0`. Use um laço `for` para adi `total` deve ser declarado e inicializado como 0. ```js -assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); ``` `total` deve ser igual a 20. @@ -42,13 +42,13 @@ assert(total === 20); Você deve usar um laço `for` para iterar através de `myArr`. ```js -assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code)); +assert(/for\s*\(/g.test(__helpers.removeJSComments(code)) && /myArr\s*\[/g.test(__helpers.removeJSComments(code))); ``` Você não deve tentar atribuir diretamente o valor 20 para `total`. ```js -assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm)); +assert(!__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/total[=+-]0*[1-9]+/gm)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md index 9baabe516fe..b8465b46542 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md @@ -56,7 +56,7 @@ Altere o laço `while` no código para um laço `do...while` para que o laço ad Você deve usar um laço `do...while` nesse exercício. ```js -assert(code.match(/do/g)); +assert(__helpers.removeJSComments(code).match(/do/g)); ``` `myArray` deve ser igual a `[10]`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md index af4e9b93222..131915c5a52 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md @@ -44,7 +44,7 @@ Use o laço `for` para adicionar os valores de 1 até 5 dentro de `myArray`. Você deve usar um laço `for` para isso. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` deve ser igual a `[1, 2, 3, 4, 5]`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md index 24e9a1f0c8b..000350d92f3 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md @@ -36,7 +36,7 @@ Adicione os números de 5 até 0 (inclusive) em ordem descendente para `myArray` Você deve usar um laço `while` para isso. ```js -assert(code.match(/while/g)); +assert(__helpers.removeJSComments(code).match(/while/g)); ``` `myArray` deve ser igual a `[5, 4, 3, 2, 1, 0]`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index 150f03d3231..9a617b4d37e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -48,7 +48,7 @@ Você deve adicionar a variável local `myVar`. ```js assert( /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( - __helpers.removeWhiteSpace(code) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)) ) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md index 71a48912df0..843b67884c8 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md @@ -47,7 +47,7 @@ assert( Você deve usar `pop()` em `myArray`. ```js -assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code)); +assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(__helpers.removeJSComments(code))); ``` `removedFromMyArray` deve conter apenas `["cat", 2]`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md index 3efe28abda2..dec90c77bea 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md @@ -52,7 +52,7 @@ Você deve usar o índice correto para modificar o valor em `myArray`. ```js assert( (function () { - if (code.match(/myArray\[0\]\s*=\s*/g)) { + if (__helpers.removeJSComments(code).match(/myArray\[0\]\s*=\s*/g)) { return true; } else { return false; diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md index 03b92f71309..b787ed732dc 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md @@ -94,13 +94,13 @@ assert(sequentialSizes(9) === 'High'); Você não deve usar nenhuma instrução do tipo `if` ou `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Você deve ter nove instruções `case` ```js -assert(code.match(/case/g).length === 9); +assert(__helpers.removeJSComments(code).match(/case/g).length === 9); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md index 168604e8d19..a4fb8b8f4dc 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md @@ -28,7 +28,7 @@ assert(product === 5.0); Você deve usar o operador `*` ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md index 1260f4b802b..b807243e71d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md @@ -36,7 +36,7 @@ assert(product === 80); Você deve usar o operador `*`. ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md index 655969e5614..f328be054d1 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md @@ -60,7 +60,7 @@ Você deve chamar a função `functionWithArgs` com dois números depois de defi ```js assert( /functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test( - code.replace(/\s/g, '') + __helpers.removeJSComments(code).replace(/\s/g, '') ) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md index b3411e8d865..3d1632143e4 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md @@ -47,7 +47,7 @@ assert(compareEquality('20', 20) === 'Not Equal'); Você deve usar o operador `===` ```js -assert(code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index edd2e8495a1..e421f45b28a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -47,7 +47,7 @@ Você deve remover todas as barras invertidas (`\`). ```js assert( - !/\\/g.test(code) && + !/\\/g.test(__helpers.removeJSComments(code)) && myStr.match( '\\s*\\s*Link\\s*\\s*' ) @@ -57,7 +57,7 @@ assert( Você deve ter duas aspas simples `'` e quatro aspas duplas `"`. ```js -assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2); +assert(__helpers.removeJSComments(code).match(/"/g).length === 4 && __helpers.removeJSComments(code).match(/'/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index c15779f5e04..df91dcaef57 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,7 +66,7 @@ O código não deve depender de nenhum laço (`for` ou `while` ou funções de o ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md index ecd4f427674..e51b3d4b503 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md @@ -45,19 +45,19 @@ Altere a cadeia de instruções `if`/`else if` por um comando `switch`. Você não deve usar nenhuma instrução `else` em nenhum lugar no editor ```js -assert(!/else/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code))); ``` Você não deve usar nenhuma instrução `if` em nenhum lugar no editor ```js -assert(!/if/g.test(code)); +assert(!/if/g.test(__helpers.removeJSComments(code))); ``` Você deve ter pelo menos instruções `break` ```js -assert(code.match(/break/g).length >= 4); +assert(__helpers.removeJSComments(code).match(/break/g).length >= 4); ``` `chainToSwitch("bob")` deve retornar a string `Marley` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md index cd29b7e8f62..35e5ad52d18 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md @@ -52,7 +52,7 @@ assert(isLess(15, 10) === false); Você não deve usar nenhuma instrução do tipo `if` ou `else` ```js -assert(!/if|else/g.test(code)); +assert(!/if|else/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md index 57654c57c01..bf9ab0d99c5 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md @@ -63,13 +63,13 @@ assert(caseInSwitch(4) === 'delta'); Você não deve usar nenhuma instrução `if` ou `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Você deve ter pelo menos 3 instruções `break` ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md index 126bb71d2ea..41e9af0e331 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md @@ -35,7 +35,7 @@ Atribua o valor `7` para a variável `a`. Você não deve alterar o código acima do comentário especificado. ```js -assert(/var a;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code))); ``` `a` deve ter o valor de 7. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md index ae1432943a1..67176f4abd1 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md @@ -35,7 +35,7 @@ assert(difference === 12); Você só deve subtrair um número de `45`. ```js -assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code))); +assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md index 385bb79a96c..a9c02cf2649 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md @@ -40,7 +40,7 @@ assert(myStr === 'Hello World'); Você não deve alterar o código acima do comentário especificado. ```js -assert(/myStr = "Jello World"/.test(code)); +assert(/myStr = "Jello World"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md index 2f8b53d7877..53f81a76b9d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md @@ -56,19 +56,19 @@ assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000); `studlyCapVar` deve usar camelCase em ambas as seções de declaração e atribuição. ```js -assert(code.match(/studlyCapVar/g).length === 2); +assert(__helpers.removeJSComments(code).match(/studlyCapVar/g).length === 2); ``` `properCamelCase` deve usar camelCase em ambas as seções de declaração e atribuição. ```js -assert(code.match(/properCamelCase/g).length === 2); +assert(__helpers.removeJSComments(code).match(/properCamelCase/g).length === 2); ``` `titleCaseOver` deve usar camelCase em ambas as seções de declaração e atribuição. ```js -assert(code.match(/titleCaseOver/g).length === 2); +assert(__helpers.removeJSComments(code).match(/titleCaseOver/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index 703d02438fd..53c3f65a851 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -39,9 +39,9 @@ Você não deve mudar o código abaixo do comentário especificado. ```js assert( - /a = a \+ 1;/.test(code) && - /b = b \+ 5;/.test(code) && - /c = c \+ " String!";/.test(code) + /a = a \+ 1;/.test(__helpers.removeJSComments(code)) && + /b = b \+ 5;/.test(__helpers.removeJSComments(code)) && + /c = c \+ " String!";/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md index 27e558a6bf1..3c8a12e9d56 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md @@ -39,7 +39,7 @@ assert(/happy coder/gi.test(myDog.name)); Você não deve editar a definição de `myDog`. ```js -assert(/"name": "Coder"/.test(code)); +assert(/"name": "Coder"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md index 9eedd37abf7..85759e4bdab 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md @@ -41,7 +41,7 @@ assert(firstLetterOfLastName === 'L'); Você deve usar a notação de colchetes. ```js -assert(code.match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md index 2dbfa7fb9ed..209e10098c3 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(lastLetterOfLastName === 'e'); Você deve usar `.length` para pegar a última letra. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md index b00cd2a46fd..34c6fc33c00 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md @@ -39,7 +39,7 @@ assert(thirdLetterOfLastName === 'v'); Você deve usar notação de colchetes. ```js -assert(code.match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md index 07a0c21dfcb..c9759bc42eb 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(secondToLastLetterOfLastName === 'c'); Você deve usar `.length` para pegar a penúltima letra. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md index 5742fccda0e..eb9ed8a4455 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md @@ -54,7 +54,7 @@ Na função `checkSign`, use operadores de múltiplas condições - seguindo o f `checkSign` deve usar operadores de múltiplas condições ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(__helpers.removeJSComments(code))); ``` `checkSign(10)` deve retornar a string `positive`. Observe que a capitalização importa diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index a9d54c237d1..4e1a7c4c8fa 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,7 +59,7 @@ O código não deve depender de nenhum laço (`for` ou `while` ou funções de o ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index c77f06a0883..b36722c5388 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,7 +26,7 @@ O código não deve depender de nenhum laço (`for` ou `while` ou funções de o ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index f40ecd4bf91..f8829135806 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -42,7 +42,7 @@ Use o operador condicional na função `checkEqual` para verificar se dois núme `checkEqual` deve usar o operador condicional ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(__helpers.removeJSComments(code))); ``` `checkEqual(1, 2)` deve retornar a string `Not Equal` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md index 0ff735c10d9..25d6a41aa64 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md @@ -34,7 +34,7 @@ Use `parseInt()` na função `convertToInteger` para que ela converta um número `convertToInteger` deve usar a função `parseInt()` ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("10011")` deve retornar um número diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md index 6cad3010f54..1d4e861cbff 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md @@ -26,7 +26,7 @@ Use `parseInt()` na função `convertToInteger` para que ela converta a string d `convertToInteger` deve usar a função `parseInt()` ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("56")` deve retornar um número diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md index e8b54d4a5d7..f12d03f5b19 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md @@ -83,14 +83,14 @@ assert(typeof phoneticLookup('') === 'undefined'); Você não deve modificar a instrução `return` ```js -assert(code.match(/return\sresult;/)); +assert(__helpers.removeJSComments(code).match(/return\sresult;/)); ``` Você não deve usar as instruções `case`, `switch` ou `if` ```js assert( - !/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) + !/case|switch|if/g.test(__helpers.removeJSComments(code).replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md index aa8b841a7db..672c6743569 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md @@ -53,7 +53,7 @@ assert( Você não deve usar diretamente os valores `dog`, `ran`, `big` ou `quickly` para criar `wordBlanks`. ```js -const newCode = removeAssignments(code); +const newCode = removeAssignments(__helpers.removeJSComments(code)); assert( !/dog/.test(newCode) && !/ran/.test(newCode) && diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md index 05ed903dd42..208f14afaec 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md @@ -50,7 +50,7 @@ Você deve chamar `reusableFunction` uma vez que for definida. ```js const functionStr = reusableFunction && __helpers.removeWhiteSpace(reusableFunction.toString()); -const codeWithoutFunction = __helpers.removeWhiteSpace(code).replace(/reusableFunction\(\)\{/g, ''); +const codeWithoutFunction = __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).replace(/reusableFunction\(\)\{/g, ''); assert(/reusableFunction\(\)/.test(codeWithoutFunction)); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md index 84165f16f94..ed21fd96e6a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md @@ -25,7 +25,7 @@ assert(power == 8); O código deve usar a ordem correta dos argumentos para a chamada da função `raiseToPower`. ```js -assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); +assert(__helpers.removeJSComments(code).match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md index 832d1776532..fa84556605c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md @@ -37,7 +37,7 @@ assert(result == 9); O código deve chamar a função `getNine`. ```js -assert(code.match(/getNine\(\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/getNine\(\)/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md index a09dadfa9ed..d694225801e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md @@ -27,25 +27,25 @@ assert(netWorkingCapital === 2); Não deve haver instâncias de variáveis com ortografia incorreta no código. ```js -assert(!code.match(/recievables/g)); +assert(!__helpers.removeJSComments(code).match(/recievables/g)); ``` A variável `receivables` deve ser declarada e usada corretamente no código. ```js -assert(code.match(/receivables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/receivables/g).length == 2); ``` Não deve haver instâncias de variáveis com ortografia incorreta no código. ```js -assert(!code.match(/payable;/g)); +assert(!__helpers.removeJSComments(code).match(/payable;/g)); ``` A variável `payables` deve ser declarada e usada corretamente no código. ```js -assert(code.match(/payables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/payables/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index e8ad1865461..3362709d756 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -37,13 +37,13 @@ Corrija a string para que use aspas diferentes para o valor de `href` ou escape O código deve corrigir as aspas em torno do valor de `href`: `#Home` mudando-as ou escapando-as. ```js -assert(code.match(//g)); +assert(__helpers.removeJSComments(code).match(//g)); ``` O código deve manter as aspas duplas ao redor de toda a string. ```js -assert(code.match(/"

.*?<\/p>";/g)); +assert(__helpers.removeJSComments(code).match(/"

.*?<\/p>";/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md index 5b241f07014..39f39637e7b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md @@ -37,25 +37,25 @@ Corrija os dois erros de índices nas funções seguintes para que todos os núm O código deve definir a condição inicial do laço para começar do primeiro índice. ```js -assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?=\s*?0\s*?;/g).length == 1); ``` O código deve corrigir a condição inicial do laço para que o índice comece em 0. ```js -assert(!code.match(/i\s?=\s*?1\s*?;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s?=\s*?1\s*?;/g)); ``` O código deve definir a condição de parada do laço, a fim de parar no último índice. ```js -assert(code.match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); ``` O código deve corrigir a condição de parada do laço, a fim de parar no tamanho menos 1. ```js -assert(!code.match(/i\s*?<=\s*?len;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?<=\s*?len;/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md index b80bbe3192e..2e44322ae90 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md @@ -21,7 +21,7 @@ Corrija os dois erros de pares no código. O código deve corrigir o pedaço que falta do array. ```js -assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); +assert(__helpers.removeJSComments(code).match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); ``` O código deve corrigir o pedaço que falta do método `.reduce()`. A saída no console deve mostrar que `Sum of array value is: 6`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md index 4d09d8cedc5..4b28e6fe485 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md @@ -43,7 +43,7 @@ assert(result == 'Not equal!'); A condição deve usar `==` ou `===` para verificar a igualdade. ```js -assert(code.match(/x\s*?===?\s*?y/g)); +assert(__helpers.removeJSComments(code).match(/x\s*?===?\s*?y/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md index 651f9a17346..45bcba54f55 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md @@ -31,13 +31,13 @@ A função `myFunc()` contém um laço infinito porque a condição de parada `i O código deve alterar o operador de comparação na condição de parada (parte do meio) do laço `for`. ```js -assert(code.match(/i\s*?<=\s*?4;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?<=\s*?4;/g).length == 1); ``` O código deve corrigir o operador de comparação na condição de parada do laço. ```js -assert(!code.match(/i\s*?!=\s*?4;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?!=\s*?4;/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index db5a7e25c5e..1ab67780ebd 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -23,7 +23,7 @@ Depois disso, use `console.log` para registrar a variável `output`. Veja os doi Você deve usar `console.log()` para imprimir a variável `output`. ```js -assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/console\.log\(output\)/)); ``` Você deve usar `console.clear()` para limpar o console do navegador. @@ -31,7 +31,7 @@ Você deve usar `console.clear()` para limpar o console do navegador. ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console.clear\(\)/) ); ``` @@ -41,7 +41,7 @@ Você deve limpar o console após o registro (log). ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console\.log\(output\)[\s\S]*console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md index 24861fbe281..73162e56347 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md @@ -29,7 +29,7 @@ Use o método `console.log()` para imprimir o valor da variável `a` aonde anoto O código deve usar `console.log()` para verificar o valor da variável `a`. ```js -assert(code.match(/console\.log\(a\)/g)); +assert(__helpers.removeJSComments(code).match(/console\.log\(a\)/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md index 390a8ed9694..9d724fe2d98 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md @@ -32,19 +32,19 @@ Adicione duas instruções `console.log()` para verificar o `typeof` de cada uma O código deve usar `typeof` em duas instruções `console.log()` para verificar o tipo das variáveis. ```js -assert(code.match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); ``` O código deve usar `typeof` para verificar o tipo da variável `seven`. ```js -assert(code.match(/typeof[\( ]seven\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]seven\)?/g)); ``` O código deve usar `typeof` para verificar o tipo da variável `three`. ```js -assert(code.match(/typeof[\( ]three\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]three\)?/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index ca0d1ad2361..ebab2396334 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -87,13 +87,13 @@ Este exercício foi projetado para ilustrar a diferença ente como as palavras-c `var` não deve existir no código. ```js -assert(!code.match(/var/g)); +assert(!__helpers.removeJSComments(code).match(/var/g)); ``` A variável `i` declarada dentro do corpo do comando `if` deve ser igual a string `block scope`. ```js -assert(code.match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); +assert(__helpers.removeJSComments(code).match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); ``` `checkScope()` deve retornar a string `function scope` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index 7e40f899090..f6682812334 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,7 +32,7 @@ O método `resolve` deve ser chamado com a string informada anteriormente quando ```js assert( - code.match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) ); ``` @@ -40,7 +40,7 @@ O método `reject` deve ser chamado com a string informada anteriormente quando ```js assert( - code.match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md index 65f30cc7408..eeb1a106193 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md @@ -32,7 +32,7 @@ A promessa deve receber uma função com os parâmetros `resolve` e `reject`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /Promise\s*\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g ) ); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md index 3ae1f1860f5..5265153da3d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md @@ -25,14 +25,14 @@ Adicione uma tag script ao documento HTML do tipo `module` e dê a ela o caminho Você deve criar uma tag `script`. ```js -assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); +assert(__helpers.removeJSComments(code).match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); ``` A tag `script` deve ter o atributo `type` com o valor `module`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g ) ); @@ -42,7 +42,7 @@ A tag `script` deve ter o atributo `src` com o valor `index.js`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g ) ); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md index 12b00c4defe..25b3ebe5c03 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md @@ -38,7 +38,7 @@ Você deve usar a sintaxe alternativa ao `export`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g ) ); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md index 12a2762897a..c8f02c19f68 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md @@ -75,7 +75,7 @@ assert.match(code, /(`.*\${.*}.*`)/); Você deve usar um loop. ```js -assert(code.match(/for|map|reduce|forEach|while/)); +assert(__helpers.removeJSComments(code).match(/for|map|reduce|forEach|while/)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md index b6284e2d051..fc96cf75c3c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md @@ -34,7 +34,7 @@ Você deve chamar o método `then` na promessa. ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.then\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.then\(/g) ); ``` @@ -50,7 +50,7 @@ Você deve exibir o valor do parâmetro `result` no console. assert( resultIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.then\(.*?result.*?console.log\(result\).*?\)/) ); ``` @@ -60,7 +60,7 @@ assert( ## --after-user-code-- ```js -const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(code)); +const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md index a1546f89c98..9503d047e93 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md @@ -28,7 +28,7 @@ Você deve chamar o método `catch` na promessa. ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.catch\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.catch\(/g) ); ``` @@ -44,7 +44,7 @@ Você deve exibir o valor de `error` no console. assert( errorIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.catch\(.*?error.*?console.log\(error\).*?\)/) ); ``` @@ -54,7 +54,7 @@ assert( ## --after-user-code-- ```js -const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(code)); +const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md index c383b39fb19..4704b89c942 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md @@ -25,7 +25,7 @@ No código a seguir, importe a exportação padrão do arquivo `math_functions.j A única coisa que você precisa fazer é importar `subtract` do arquivo `math_functions.js`. ```js -assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); +assert(__helpers.removeJSComments(code).match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md index accedf30549..ed9edcd1825 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md @@ -36,19 +36,19 @@ Um array é declarado: `const s = [5, 7, 2]`. Modifique o array para `[2, 5, 7]` Você não deve substituir a palavra-chave `const`. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `s` deve ser uma variável constante (use `const`). ```js -assert(code.match(/const\s+s/g)); +assert(__helpers.removeJSComments(code).match(/const\s+s/g)); ``` Você não deve alterar modificar o array original manualmente. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g )); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md index a9b7217a60e..4f068575780 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md @@ -34,19 +34,19 @@ Nesse desafio, você usará o método `Object.freeze` para prevenir a mudança d Você não deve substituir a palavra-chave `const`. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `MATH_CONSTANTS` deve ser uma variável constante (use `const`). ```js -assert(code.match(/const\s+MATH_CONSTANTS/g)); +assert(__helpers.removeJSComments(code).match(/const\s+MATH_CONSTANTS/g)); ``` Você não deve alterar a declaração original de `MATH_CONSTANTS`. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g )); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md index 0f47be47d88..41dc373a235 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md @@ -32,7 +32,7 @@ Você deve importar a função `uppercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); @@ -42,7 +42,7 @@ Você deve importar a função `lowercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index 25d018bb1de..f3a8e0b0f7d 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -44,7 +44,7 @@ assert(increment(5) === 6); O parâmetro padrão (`value`) deve receber o valor `1`. ```js -assert(code.match(/value\s*=\s*1/g)); +assert(__helpers.removeJSComments(code).match(/value\s*=\s*1/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md index 2e5cb2fce8d..79363215330 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md @@ -31,7 +31,7 @@ Você deve usar a sintaxe `import * as`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g ) ); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index faeccfc811a..555362b6cae 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -66,7 +66,7 @@ assert( A palavra-chave `class` deve ser usada. ```js -assert(code.match(/class/g)); +assert(__helpers.removeJSComments(code).match(/class/g)); ``` A classe `Vegetable` deve poder ser instanciada. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md index d979905654c..2d85d5f05fb 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md @@ -51,7 +51,7 @@ assert(b === 8); Você deve usar desestruturação de array para trocar `a` e `b`. ```js -assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code)); +assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index 37cb8ffc5a5..2f0f19e1917 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -43,8 +43,8 @@ Você deve remover a sintaxe de atribuição do ES5. ```js assert( - !code.match(/lowToday = LOCAL_FORECAST\.today\.low/g) && - !code.match(/highToday = LOCAL_FORECAST\.today.high/g) + !__helpers.removeJSComments(code).match(/lowToday = LOCAL_FORECAST\.today\.low/g) && + !__helpers.removeJSComments(code).match(/highToday = LOCAL_FORECAST\.today.high/g) ); ``` @@ -52,7 +52,7 @@ Você deve usar desestruturação para criar a variável `lowToday`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(low\s*:\s*lowToday[^}]*|[^,]*,\s*low\s*:\s*lowToday\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); @@ -62,7 +62,7 @@ Você deve usar desestruturação para criar a variável `highToday`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday,?\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index c75ad95d367..c50b9369f09 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -34,8 +34,8 @@ Você deve remover a sintaxe da atribuição ES5. ```js assert( - !code.match(/highToday = HIGH_TEMPERATURES\.today/g) && - !code.match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) + !__helpers.removeJSComments(code).match(/highToday = HIGH_TEMPERATURES\.today/g) && + !__helpers.removeJSComments(code).match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) ); ``` @@ -43,7 +43,7 @@ Você deve usar desestruturação para criar a variável `highToday`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(today\s*:\s*highToday[^}]*|[^,]*,\s*today\s*:\s*highToday\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); @@ -53,7 +53,7 @@ Você deve usar desestruturação para criar a variável `highTomorrow`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(tomorrow\s*:\s*highTomorrow[^}]*|[^,]*,\s*tomorrow\s*:\s*highTomorrow\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 757fffa9655..97f86654da8 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,7 +43,7 @@ Você deve remover a sintaxe de atribuição do ES5. ```js assert( - !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !__helpers.removeJSComments(code).match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -51,7 +51,7 @@ Você deve usar desestruturação para criar a variável `today`. ```js assert( - code.match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` @@ -59,7 +59,7 @@ Você deve usar desestruturação para criar a variável `tomorrow`. ```js assert( - code.match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md index e4d29e24459..2aa0910f4eb 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md @@ -50,13 +50,13 @@ assert(half(stats) === 28.015); Desestruturação deve ser usado. ```js -assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/half=\({\w+,\w+}\)/)); ``` O parâmetro desestruturado deve ser usado. ```js -assert(!code.match(/stats\.max|stats\.min/)); +assert(!__helpers.removeJSComments(code).match(/stats\.max|stats\.min/)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index faa0824ed67..364bf836b57 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -47,7 +47,7 @@ assert.deepEqual(_testArr, [1, 2, 3, 4, 5]) `Array.slice()` não deve ser usado. ```js -assert(!code.match(/\.\s*slice\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*slice\s*\(/)); ``` Você deve usar a sintaxe de rest. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md index 1de5ca2f36f..2fcabe0483c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md @@ -42,7 +42,7 @@ Você deve exportar corretamente `uppercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+uppercaseString|export\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)})/g ) ); @@ -52,7 +52,7 @@ Você deve exportar corretamente `lowercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+lowercaseString|export\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)})/g ) ); diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md index d521a9b74f2..8dee1b07552 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md @@ -57,7 +57,7 @@ assert(sum() === 0); `sum` deve ser uma arrow function que usa a sintaxe de parâmetro rest (`...`) no parâmetro `args`. ```js -assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/sum=\(\.\.\.args\)=>/)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md index c04bd4e3dd9..67e49928299 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md @@ -55,7 +55,7 @@ assert(arr2.every((v, i) => v === arr1[i]) && arr2.length); O operador spread `...` deve ser usado para duplicar `arr1`. ```js -assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); +assert(__helpers.removeJSComments(code).match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); ``` `arr2` deve continuar inalterado quando `arr1` é modificado=. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md index cbbe8e0f25f..c01b1233fba 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md @@ -54,7 +54,7 @@ assert.match(code, /const\s+myConcat/g); ```js assert( - /myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) && + /myConcat=\(\w+,\w+\)=>/.test(__helpers.removeJSComments(code).replace(/\s/g, '')) && typeof myConcat === 'function' ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 2e578f53bbd..a46fe8ce5c1 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,14 +39,14 @@ Refatore a função `setGear` dentro do objeto `bicycle` para usar a sintaxe cur Expressão tradicional de função não deve ser usado. ```js -assert(!code.match(/function/)); +assert(!__helpers.removeJSComments(code).match(/function/)); ``` `setGear` deve ser uma função declarativa. ```js assert( - typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/) + typeof bicycle.setGear === 'function' && __helpers.removeJSComments(code).match(/setGear\s*\(.+\)\s*\{/) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md index 2a3c3579026..4af0b2016a8 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md @@ -43,7 +43,7 @@ assert.deepEqual( O código deve usar `key:value`. ```js -assert(!code.match(/:/g)) +assert(!__helpers.removeJSComments(code).match(/:/g)) ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md index 46cb0763317..d896fc5816a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md @@ -30,13 +30,13 @@ Modifique a função `nonMutatingPush` de modo que ela use `concat` para mesclar O código deve usar o método `concat`. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` O código não deve usar o método `push`. ```js -assert(!code.match(/\.?[\s\S]*?push/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?push/g)); ``` O primeiro array, `first`, não deve ser modificado. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md index 47fa2ffd36f..420df103367 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md @@ -31,7 +31,7 @@ A saída não deve conter espaços Você não pode usar o método `replace` neste desafio. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `urlSlug("Winter Is Coming")` deve retornar a string `winter-is-coming`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md index d44460fcffc..d499d5f1756 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md @@ -27,13 +27,13 @@ Use o método `join` (entre outros) dentro da função `sentensify` para criar u Você deve usar o método `join`. ```js -assert(code.match(/\.join/g)); +assert(__helpers.removeJSComments(code).match(/\.join/g)); ``` Você não deve usar o método `replace`. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `sentensify("May-the-force-be-with-you")` deve retornar uma string. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md index 159f3802901..e9b7a1ed6e7 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md @@ -25,7 +25,7 @@ Use o método `concat` na função `nonMutatingConcat` para concatenar `attach` Você deve usar o método `concat`. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` O primeiro array, `first`, não deve ser alterado. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md index 421dac54a14..b96543adda1 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md @@ -47,7 +47,7 @@ assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_ Você não deve usar o método `map`. ```js -assert(!code.match(/\.?[\s\S]*?map/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?map/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md index 6190816d359..429965afd73 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md @@ -43,7 +43,7 @@ assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFi Você não deve usar o método `filter`. ```js -assert(!code.match(/\.?[\s\S]*?filter/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?filter/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md index 26826046c7f..722c69c0803 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md @@ -77,7 +77,7 @@ assert(add(11)(22)(33) === 66); No código deve haver uma instrução final que retorna `x + y + z`. ```js -assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); +assert(__helpers.removeJSComments(code).match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md index e69053a8cbb..1c1a15d8a61 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md @@ -30,13 +30,13 @@ Não modifique o array original passado à função. Você deve usar o método `slice`. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` Você não deve usar o método `splice`. ```js -assert(!code.match(/\.?[\s\S]*?splice/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?splice/g)); ``` Você não deve modificar o array original passado à função. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md index 884d555ac4d..32643da8ab2 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md @@ -28,7 +28,7 @@ Use o método `slice` na função `sliceArray` para retornar parte do array `ani Você deve usar o método `slice`. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` A variável `inputAnim` não deve ser alterada. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md index 33c39df3bbb..fd58b65fd20 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md @@ -47,7 +47,7 @@ Use o método `sort` na função `alphabeticalOrder` para ordenar os elementos d Você deve usar o método `sort`. ```js -assert(code.match(/\.sort/g)); +assert(__helpers.removeJSComments(code).match(/\.sort/g)); ``` `alphabeticalOrder(["a", "d", "c", "a", "z", "g"])` deve retornar `["a", "a", "c", "d", "g", "z"]`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md index b0c70d668dc..3192e6ea327 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md @@ -33,7 +33,7 @@ Use o método `split` na função `splitify` para dividir `str` em um array de p Você deve usar o método `split`. ```js -assert(code.match(/\.split/g)); +assert(__helpers.removeJSComments(code).match(/\.split/g)); ``` `splitify("Hello World,I-am code")` deve retornar `["Hello", "World", "I", "am", "code"]`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index 93ec2e4d4f7..ff39126869e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), Loops `for`, `while`e a função `forEach` não devem ser usados. ```js -assert(!code.match(/for|while|forEach/g)); +assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ``` `map`, `filter` ou `reduce` deve ser usado. @@ -36,7 +36,7 @@ assert(!code.match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md index e060ee8e5d0..074763d86e8 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md @@ -31,7 +31,7 @@ Use o método `every` dentro da função `checkPositive` para checar se todos os Você deve usar o método `every`. ```js -assert(code.match(/\.every/g)); +assert(__helpers.removeJSComments(code).match(/\.every/g)); ``` `checkPositive([1, 2, 3, -4, 5])` deve retornar `false`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md index 81fc5b74e7b..a4a6399cbe9 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md @@ -46,13 +46,13 @@ assert( Você deve usar o método `filter`. ```js -assert(code.match(/\s*\.\s*filter/g)); +assert(__helpers.removeJSComments(code).match(/\s*\.\s*filter/g)); ``` Você não deve usar loops `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` `filteredList` deve ser igual a `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"}, {"title": "Batman Begins", "rating": "8.3"}]`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index e6e428235ca..03f1b837f81 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,13 +52,13 @@ assert( Você não deve usar loops `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); ``` Você deve usar o método `map`. ```js -assert(code.match(/\.map/g)); +assert(__helpers.removeJSComments(code).match(/\.map/g)); ``` `ratings` deve ser igual a `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"},{"title": "Batman Begins", "rating": "8.3"}, {"title": "Avatar", "rating": "7.9"}]`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md index be659f648a1..6a9050c21c2 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md @@ -66,7 +66,7 @@ assert( Você deve usar o método `reduce`. ```js -assert(code.match(/\.reduce/g)); +assert(__helpers.removeJSComments(code).match(/\.reduce/g)); ``` `getRating(watchList)` deve ser igual a 8.675. @@ -78,7 +78,7 @@ assert(getRating(watchList) === 8.675); Você não deve usar loops `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` Você deve retornar o resultado correto após a modificação do objeto `watchList`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md index a2d55337a22..54034614f10 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md @@ -31,7 +31,7 @@ Use o método `some` na função `checkPositive` para verificar se algum element Você deve usar o método `some`. ```js -assert(code.match(/\.some/g)); +assert(__helpers.removeJSComments(code).match(/\.some/g)); ``` `checkPositive([1, 2, 3, -4, 5])` deve retornar `true`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md index 390e389fb0b..b325b9d614c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md @@ -39,7 +39,7 @@ assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4]); A solução não deve usar os métodos `Array.prototype.flat()` ou `Array.prototype.flatMap()`. ```js -assert(!code.match(/\.\s*flat\s*\(/) && !code.match(/\.\s*flatMap\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*flat\s*\(/) && !__helpers.removeJSComments(code).match(/\.\s*flatMap\s*\(/)); ``` As variáveis globais não devem ser utilizadas. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md index 9695fa49c66..36ba39dba58 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md @@ -49,7 +49,7 @@ Adiciona a propriedade `numLegs` e os dois métodos `eat()` e `describe()` para `Dog.prototype` deve ser definido para um novo objeto. ```js -assert(/Dog\.prototype\s*?=\s*?{/.test(code)); +assert(/Dog\.prototype\s*?=\s*?{/.test(__helpers.removeJSComments(code))); ``` `Dog.prototype` deve ter a propriedade `numLegs`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md index b79bc89eac5..cfaacb6e64a 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md @@ -61,7 +61,7 @@ A variável `duck` deve ser inicializada com `Object.create`. ```js assert( /(let|const|var)\s{1,}duck\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` @@ -71,7 +71,7 @@ A variável `beagle` deve ser inicializada com `Object.create`. ```js assert( /(let|const|var)\s{1,}beagle\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md index fc9233488d1..bca6c33581b 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md @@ -61,7 +61,7 @@ assert.deepEqual(prototypeProps, ['numLegs']); Você deve resolver este desafio sem utilizar o método nativo `Object.keys()`. ```js -assert(!/\Object.keys/.test(code)); +assert(!/\Object.keys/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md index b37e2a84f51..0080c4ddb9e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md @@ -43,7 +43,7 @@ assert(dog.sayLegs() === 'This dog has 4 legs.'); O código deve utilizar a palavra-chave `this` para acessar a propriedade `numLegs` de `dog`. ```js -assert(code.match(/this\.numLegs/g)); +assert(__helpers.removeJSComments(code).match(/this\.numLegs/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md index 4b152172b16..65c17c2aadd 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md @@ -51,7 +51,7 @@ assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1); Você deve resolver este desafio sem utilizar o método nativo `Object.keys()`. ```js -assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); +assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(__helpers.removeJSComments(code))); ``` Você deve resolver este desafio sem definir o array `ownProps` de forma fixa no código. @@ -59,7 +59,7 @@ Você deve resolver este desafio sem definir o array `ownProps` de forma fixa no ```js assert( !/\[\s*(?:'|")(?:name|numLegs)|(?:push|concat)\(\s*(?:'|")(?:name|numLegs)/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md index 3b0962b2d4f..c50a6a6fff4 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md @@ -55,7 +55,7 @@ assert(joinDogFraternity(new Dog('')) === true); `joinDogFraternity` deve utilizar a propriedade `construtor`. ```js -assert(/\.constructor/.test(code) && !/instanceof/.test(code)); +assert(/\.constructor/.test(__helpers.removeJSComments(code)) && !/instanceof/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md index 01563d9d1af..4af9a18eed9 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md @@ -29,13 +29,13 @@ Rescreva a função `makeNest` e remova a chamada a ela para que no lugar seja u A função deve ser anônima. ```js -assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, ''))); +assert(/\((function|\(\))(=>|\(\)){?/.test(__helpers.removeJSComments(code).replace(/\s/g, ''))); ``` A função deve ter parênteses no final da expressão para chamar ela imediatamente. ```js -assert(/\(.*(\)\(|\}\(\))\)/.test(code.replace(/[\s;]/g, ''))); +assert(/\(.*(\)\(|\}\(\))\)/.test(__helpers.removeJSComments(code).replace(/[\s;]/g, ''))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md index f9b80e09622..c31a67a3043 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md @@ -42,7 +42,7 @@ Modifique o código para mostrar corretamente a cadeia de protótipo. O código deve mostrar que `Object.prototype` é o protótipo de `Dog.prototype` ```js -assert(/Object\.prototype\.isPrototypeOf/.test(code)); +assert(/Object\.prototype\.isPrototypeOf/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md index caf9198c963..da3e4be690c 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md @@ -35,7 +35,7 @@ Utilize `isPrototypeOf` para verificar o `prototype` de `beagle`. Você deve mostrar que o `Dog.prototype` é um `protótipo` de `beagle` ```js -assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code)); +assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md index 43f81b184aa..349b7e16f40 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md @@ -52,7 +52,7 @@ assert(hound instanceof Dog); O código deve utilizar o operador `new` para criar uma instância de `Dog`. ```js -assert(code.match(/new/g)); +assert(__helpers.removeJSComments(code).match(/new/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md index 13558f204e8..3d8edd2c638 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md @@ -43,7 +43,7 @@ Modifique como `weight` é declarado na função `Bird` para que seja uma variá A propriedade `weight` deve ser uma variável privada e deve ser atribuída a ela o valor `15`. ```js -assert(code.match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); ``` O código deve criar o método dentro de `Bird` chamado `getWeight` que retorna o valor da variável privada `weight`. @@ -55,7 +55,7 @@ assert(new Bird().getWeight() === 15); A função `getWeight` deve retornar a variável privada `weight`. ```js -assert(code.match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); +assert(__helpers.removeJSComments(code).match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md index 5859b2b5da2..35d000f6525 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md @@ -29,13 +29,13 @@ Exiba ambas as propriedades do objeto `dog` no seu console. Seu código deve usar `console.log` para exibir o valor da propriedade `name` do objeto `dog`. ```js -assert(/console.log\(.*dog\.name.*\)/g.test(code)); +assert(/console.log\(.*dog\.name.*\)/g.test(__helpers.removeJSComments(code))); ``` Seu código deve usar `console.log` para exibir o valor para a propriedade `numLegs` do objeto `dog`. ```js -assert(/console.log\(.*dog\.numLegs.*\)/g.test(code)); +assert(/console.log\(.*dog\.numLegs.*\)/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md index e47db9ad8f5..e4e44f3b18e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md @@ -53,7 +53,7 @@ assert(typeof myHouse.numBedrooms === 'number'); Você deve verificar que `myHouse` é uma instância de `House` utilizando o operador `instanceof`. ```js -assert(/myHouse\s*instanceof\s*House/.test(code)); +assert(/myHouse\s*instanceof\s*House/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md index e8791765986..d73eb3c9667 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md @@ -75,7 +75,7 @@ assert(!myRegex.test('EleanorRoosevelt')); Você deve usar `.test()` para testar a regex. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` O resultado deve ser `true`. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md index 5158680f13c..6e345a63505 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md @@ -51,7 +51,7 @@ assert(codingRegex.source === 'coding'); Você deve usar o método `.match()`. ```js -assert(code.match(/\.match\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.match\(.*\)/)); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md index 2bf588e0f16..64b7c2333b3 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md @@ -31,7 +31,7 @@ Complete a regex `unRegex` para que ela encontre as strings `run`, `sun`, `fun`, Você deve usar o método `.test()`. ```js -assert(code.match(/\.test\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.test\(.*\)/)); ``` Você deve usar o caractere curinga na regex `unRegex` diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index 0a7242637e0..0284981ce7e 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -52,7 +52,7 @@ assert(!waldoRegex.test('Somewhere is hiding in this text.')); A busca com a regex deve ser por uma string literal. ```js -assert(!/\/.*\/i/.test(code)); +assert(!/\/.*\/i/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md index 2922d410dfb..8826eb5c9fe 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md @@ -27,13 +27,13 @@ assert(result === 'Hello, World!'); Você não deve usar o método `String.prototype.trim()` no seu código. ```js -assert(!code.match(/\.?[\s\S]*?trim/)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?trim/)); ``` Você não deve atribuir uma string diretamente à variável `result` ```js -assert(!code.match(/result\s*=\s*["'`].*?["'`]/)); +assert(!__helpers.removeJSComments(code).match(/result\s*=\s*["'`].*?["'`]/)); ``` O valor da variável `hello` não deve ser alterado. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md index 4fb3229cc94..84ce3d3a0ec 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md @@ -37,7 +37,7 @@ Escreva uma regex, `fixRegex`, que usa três grupos de captura para procurar cad Você deve usar `.replace()` para buscar e substituir. ```js -assert(code.match(/\.replace\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.replace\(.*\)/)); ``` A regex deve mudar a string `one two three` para `three two one` @@ -49,7 +49,7 @@ assert(result === 'three two one'); Você não deve alterar a última linha. ```js -assert(code.match(/result\s*=\s*str\.replace\(.*?\)/)); +assert(__helpers.removeJSComments(code).match(/result\s*=\s*str\.replace\(.*?\)/)); ``` `fixRegex` deve usar pelo menos três grupos de captura. diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md index 1c6ef4f9c47..d550ee52804 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md @@ -31,7 +31,7 @@ Aplique a regex `myRegex` na string `myString` usando o método `.test()`. Você deve usar `.test()` para testar a regex. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` O resultado deve ser `true`. diff --git a/curriculum/challenges/portuguese/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md b/curriculum/challenges/portuguese/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md index 6109e6ac25b..6c65b20dc02 100644 --- a/curriculum/challenges/portuguese/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md +++ b/curriculum/challenges/portuguese/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md @@ -15,12 +15,9 @@ You should have `if number >= 10:` within the `for` loop. ```js ({ - test: () => { - const transformedCode = code.replace(/\r/g, ""); - const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); - const { function_body } = verify_card_number; - - assert.match(function_body, /if +number +>= +10:/); + test: () => + { + assert(runPython(`_Node(_code).find_function("verify_card_number").find_for_loops()[1].find_ifs()[0].find_conditions()[0].is_equivalent("number >= 10")`)); } }) ``` diff --git a/curriculum/challenges/portuguese/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md b/curriculum/challenges/portuguese/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md index d3a48b1782e..2498bc73a46 100644 --- a/curriculum/challenges/portuguese/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md +++ b/curriculum/challenges/portuguese/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md @@ -115,7 +115,10 @@ from importlib import reload reload(probability_calculator) probability_calculator.random.seed(95) -def test_hat_draw(self): + +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw(self): hat = probability_calculator.Hat(red=5,blue=2) actual = hat.draw(2) expected = ['blue', 'red'] @@ -140,6 +143,49 @@ t.result.wasSuccessful() }); ``` +The `draw` method should behave correctly when the number of balls to extract is bigger than the number of balls in the hat. + +```js +({ + test: () => { + pyodide.FS.writeFile("/home/pyodide/probability_calculator.py", code); + pyodide.FS.writeFile( + "/home/pyodide/test_module.py", + ` +import unittest +import probability_calculator +from importlib import reload + +reload(probability_calculator) + +probability_calculator.random.seed(95) +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw_2(self): + hat = probability_calculator.Hat(yellow=5,red=1,green=3,blue=9,test=1) + actual = hat.draw(20) + expected = ['yellow', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'green', 'green', 'green', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'test'] + self.assertEqual(actual, expected, 'Expected hat draw to return all items from hat contents.') + actual = len(hat.contents) + expected = 0 + self.assertEqual(actual, expected, 'Expected hat draw to leave no items in contents.') + ` + ); + const testCode = ` +from unittest import main +import test_module +from importlib import reload + +reload(test_module) +t = main(module='test_module', exit=False) +t.result.wasSuccessful() +`; + const out = __pyodide.runPython(testCode); + assert(out); + }, +}); +``` + The `experiment` method should return a different probability. @@ -221,7 +267,8 @@ class Hat: def draw(self, number): drawn = [] if number >= len(self.contents): - return self.contents + drawn.extend(self.contents) + self.contents = [] else: for i in range(number): drawn.append( @@ -229,8 +276,7 @@ class Hat: ) return drawn -def experiment(hat, expected_balls, num_balls_drawn, num_experiments): - +def experiment(hat, expected_balls, num_balls_drawn, num_experiments): expected_balls_list = [] drawn_list = [] success = 0 @@ -248,12 +294,7 @@ def experiment(hat, expected_balls, num_balls_drawn, num_experiments): except: continue if len(exp_ball_list_copy) == 0: - success += 1 - - - - - probability = success/num_experiments - + success += 1 + probability = success/num_experiments return probability ``` diff --git a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md index 3576c5adf58..3fbadd4b60a 100644 --- a/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md +++ b/curriculum/challenges/portuguese/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md @@ -48,9 +48,9 @@ A declaração inicial de `homeworkStack` não deve ser alterada. ```js assert( - code.match(/=/g).length === 1 && + __helpers.removeJSComments(code).match(/=/g).length === 1 && /homeworkStack\s*=\s*\["BIO12"\s*,\s*"HIS80"\s*,\s*"MAT122"\s*,\s*"PSY44"\]/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md index d8e60500aa5..73dd577ecbb 100644 --- a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md @@ -2,7 +2,6 @@ id: 5f356ed60a5decd94ab66986 title: Passo 22 challengeType: 0 -removeComments: false dashedName: step-22 --- diff --git a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md index 6f1d38fd054..bff288b48ce 100644 --- a/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md +++ b/curriculum/challenges/portuguese/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md @@ -40,15 +40,15 @@ assert(canvasFilter === 'blur(2px)'); ## --seed-contents-- ```css +--fcc-editable-region-- .canvas { width: 500px; height: 600px; background-color: #4d0f00; overflow: hidden; ---fcc-editable-region-- ---fcc-editable-region-- } +--fcc-editable-region-- .frame { border: 50px solid black; diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md index 23265b45ed3..5f928fc5aef 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md @@ -7,7 +7,7 @@ dashedName: step-55 # --description-- -Inside, the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. +Inside the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. Now, you should see a category displayed underneath each post topic. diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md index 52afbe08628..da8b77b3d1e 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md @@ -7,9 +7,11 @@ dashedName: step-43 # --description-- -Perceba como o valor `10` é colocado no início do array. Isso ocorre porque o comportamento padrão de `.sort()` é converter os valores em strings e ordená-los alfabeticamente. `10` vem antes de `2` alfabeticamente. +Notice how the number `10` is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the numbers values to strings, and sort them alphabetically. `10` vem antes de `2` alfabeticamente. -Para corrigir isso, você pode passar uma função de callback para o método `.sort()`. The callback function has two parameters - for yours, use `a` and `b`. Deixe a função em branco, por enquanto. +Para corrigir isso, você pode passar uma função de callback para o método `.sort()`. The callback function has two parameters - for yours, use `a` and `b`. The parameters of `a` and `b` represent the number values in the array that will be sorted. + +Deixe a função em branco, por enquanto. # --hints-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md index 3efa73429f5..0fd6eff4061 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md @@ -26,7 +26,7 @@ assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\( A função de callback deve retornar `a - b`. ```js -assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+a\s*-\s*b\s*;?\s*}\s*\)/); +assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+(?:parseInt)?(?:Number)?\(?a\)?\s*-\s*(?:parseInt)?(?:Number)?\(?b\)?\s*;?\s*}\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index 8fd9e5bcdd7..b917bbfeb4f 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -11,6 +11,8 @@ Em `evalFormula`, declare uma arrow function `idToText`, que recebe um parâmetr A função `idToText` deve retornar o resultado da chamada de `.find()` no array `cells` com uma função de callback que receba um parâmetro `cell` e retorne `cell.id === id`. +Both of your functions should use implicit returns. + # --hints-- Você deve declarar uma variável `idToText` na função `evalFormula`. diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md index 57110b715a9..37487b1771c 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md @@ -23,13 +23,7 @@ Open up the console to see the result. # --hints-- -You should call `.repeat()` on your two `" "` strings. - -```js -assert.lengthOf(code.match(/" ".repeat/g), 2); -``` - -Your `" "` strings should be repeated `rowCount - rowNumber` times. +You should call `.repeat()` on your `" "` strings to repeat them `rowCount - rowNumber` times. ```js assert.equal(padRow(1, 3), " # "); diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md index 3306b1a478b..4170d3bd12b 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md @@ -3,7 +3,6 @@ id: 660f3ce51f70571e1c5227c8 title: Step 69 challengeType: 1 dashedName: step-69 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md index ea0a831040f..7a939244a7c 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md @@ -3,7 +3,6 @@ id: 660f3dd626be3a1ffe27e5d1 title: Step 70 challengeType: 1 dashedName: step-70 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md index e30d808ccb6..b676558ec74 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md @@ -3,7 +3,6 @@ id: 660f4f79e2a82a4e92290f44 title: Step 101 challengeType: 1 dashedName: step-101 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md index dc683e61ce5..3f088de2c91 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md @@ -3,7 +3,6 @@ id: 660f53ad3d39175c5d4335ac title: Step 108 challengeType: 1 dashedName: step-108 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md new file mode 100644 index 00000000000..286128cc2cf --- /dev/null +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md @@ -0,0 +1,74 @@ +--- +id: 662693f82c91a66be46c881b +title: Step 1 +challengeType: 1 +dashedName: step-1 +--- + +# --description-- + +A teacher has finished grading their students' tests and needs your help to calculate the average score for the class. + +Complete the `getAverage` function which takes in an array of test scores and returns the average score. + +The average is calculated by adding up all the scores and dividing by the total number of scores. + +```js +average = sum of all scores / total number of scores +``` + +A couple of function calls have been provided for you so you can test out your code. + +**Tips** + +- You can use a loop to iterate over the `scores` array and add up all the scores. +- You can use the `length` property to get the total number of scores. + +# --hints-- + +Your `getAverage` function should return a number. + +```js +assert.strictEqual(typeof getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 'number'); +``` + +`getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])` should return `71.7`. + +```js +assert.strictEqual(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 71.7); +``` + +`getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])` should return `85.4`. + +```js +assert.strictEqual(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]), 85.4); +``` + +`getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100])` should return `92.4`. + +```js +assert.strictEqual(getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100]), 92.4); +``` + +Your `getAverage` function should return the average score of the test scores. + +```js +assert.strictEqual(getAverage([52, 56, 60, 65, 70, 75, 80, 85, 90, 95]), 72.8); +assert.strictEqual(getAverage([45, 50, 55, 60, 65, 70, 75, 80, 85, 90]), 67.5); +assert.strictEqual(getAverage([38, 42, 46, 50, 54, 58, 62, 66, 70, 74]), 56); +``` + +# --seed-- + +## --seed-contents-- + +```js +--fcc-editable-region-- +function getAverage(scores) { + +} + +console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])); +console.log(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md new file mode 100644 index 00000000000..f7e9253a5a5 --- /dev/null +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md @@ -0,0 +1,104 @@ +--- +id: 6626a060c4006f793e10cb33 +title: Step 2 +challengeType: 1 +dashedName: step-2 +--- + +# --description-- + +Now the teacher needs your help converting the student score to a letter grade. + +Complete the `getGrade` function that takes a number `score` as a parameter. Your function should return a string representing a letter grade based on the score. + +Here are the scores and their corresponding letter grades: + +| Score Range | Grade | +| ----------- | ------- | +| `100` | `"A++"` | +| `90 - 99` | `"A"` | +| `80 - 89` | `"B"` | +| `70 - 79` | `"C"` | +| `60 - 69` | `"D"` | +| `0 - 59` | `"F"` | + + +**Tips** + +- Remember that you learned about conditional statements(`if`, `else if`, and `else`). +- Remember that you learned about comparison operators (`>`, `<`, `>=`, `<=`, `===`). + +# --hints-- + +Your `getGrade` function should return `"A++"` if the score is `100`. + +```js +assert.strictEqual(getGrade(100), "A++"); +``` + +Your `getGrade` function should return `"A"` if the score is `94`. + +```js +assert.strictEqual(getGrade(94), "A"); +``` + +Your `getGrade` function should return `"B"` if the score is between `80` and `89`. + +```js +assert.strictEqual(getGrade(80), "B"); +assert.strictEqual(getGrade(83), "B"); +assert.strictEqual(getGrade(88), "B"); +``` + +Your `getGrade` function should return `"C"` if the score is `78`. + +```js +assert.strictEqual(getGrade(75), "C"); +``` + +Your `getGrade` function should return `"D"` if the score is between `60` and `69`. + +```js +assert.strictEqual(getGrade(60), "D"); +assert.strictEqual(getGrade(63), "D"); +assert.strictEqual(getGrade(68), "D"); +``` + +Your `getGrade` function should return `"F"` if the score is `57`. + +```js +assert.strictEqual(getGrade(57), "F"); +``` + +Your `getGrade` function should return `"F"` if the score is between `0` and `59`. + +```js +assert.strictEqual(getGrade(0), "F"); +assert.strictEqual(getGrade(30), "F"); +assert.strictEqual(getGrade(43), "F"); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} +--fcc-editable-region-- +function getGrade(score) { + +} + +console.log(getGrade(96)); +console.log(getGrade(82)); +console.log(getGrade(56)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md new file mode 100644 index 00000000000..b168e1325fc --- /dev/null +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md @@ -0,0 +1,88 @@ +--- +id: 6626b4c58c027d86478ff5eb +title: Step 3 +challengeType: 1 +dashedName: step-3 +--- + +# --description-- + +The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an `"F"`. + +Complete the function `hasPassingGrade` that takes a student score as a parameter. Your function should return `true` if the student has a passing grade and `false` if they do not. + +**Tips** + +- Use the `getGrade` function to get the student's grade. Then check if the grade is passing or not. + +# --hints-- + +Your `hasPassingGrade` function should return a boolean value. + +```js +assert.strictEqual(typeof hasPassingGrade(100), "boolean"); +``` + +Your `hasPassingGrade` function should return `true` if the grade is an `"A"`. + +```js +assert.isTrue(hasPassingGrade(100)); +``` + +Your `hasPassingGrade` function should return `false` if the grade is an `"F"`. + +```js +assert.isFalse(hasPassingGrade(53)); +``` + +Your `hasPassingGrade` function should return `true` for all passing grades. + +```js +assert.isTrue(hasPassingGrade(87)); +assert.isTrue(hasPassingGrade(60)); +assert.isTrue(hasPassingGrade(73)); +assert.isTrue(hasPassingGrade(96)); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +--fcc-editable-region-- +function hasPassingGrade(score) { + +} + + +console.log(hasPassingGrade(100)); +console.log(hasPassingGrade(53)); +console.log(hasPassingGrade(87)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md new file mode 100644 index 00000000000..08ee3cea27b --- /dev/null +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md @@ -0,0 +1,143 @@ +--- +id: 6626b8dcf5057f896f948440 +title: Step 4 +challengeType: 1 +dashedName: step-4 +--- + +# --description-- + +Now that the teacher has all of the information they need, they want to be able to message the student with the results. + +Complete the `studentMsg` function with `totalScores` and `studentScore` for parameters. The function should return a string representing a message to the student. + +If the student passed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You passed the course. +``` + +If the student failed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You failed the course. +``` + +Replace `average-goes-here` with the average of the total scores. Replace `grade-goes-here` with the student's grade. + +**Tips** + +- Use the `getAverage` function to get the class average. +- Use the `getGrade` function to get the student's grade. +- Use string concatenation (`+`) to build the message. +- Be careful with the punctuation and spaces in the message. + +# --hints-- + +Your function call of `studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)` should return the following message: `"Class average: 71.7. Your grade: F. You failed the course."`. + +```js +assert.strictEqual(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37), "Class average: 71.7. Your grade: F. You failed the course."); +``` + +Your function call of `studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)` should return the following message: `"Class average: 50.8. Your grade: A++. You passed the course."`. + +```js +assert.strictEqual(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100), "Class average: 50.8. Your grade: A++. You passed the course."); +``` + +Your `studentMsg` function should return a the correct message based on the student's score and the class average. + +```js +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 92), "Class average: 70.25. Your grade: A. You passed the course."); +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 57), "Class average: 70.25. Your grade: F. You failed the course."); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +--fcc-editable-region-- +function studentMsg(totalScores, studentScore) { + +} +console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)); +--fcc-editable-region-- + +``` + + +# --solutions-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +function studentMsg(totalScores, studentScore) { + let average = getAverage(totalScores); + let grade = getGrade(studentScore); + + return `Class average: ${average}. Your grade: ${grade}. You ${ + hasPassingGrade(studentScore) ? "passed" : "failed" + } the course.`; +} + +``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md index 4ad1e2c7910..b87f5fc9928 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md @@ -87,7 +87,7 @@ assert(confirmEnding('Abstraction', 'action') === true); Your code should not use the built-in method `.endsWith()` to solve the challenge. ```js -assert(!/\.endsWith\(.*?\)\s*?;?/.test(code) && !/\['endsWith'\]/.test(code)); +assert(!/\.endsWith\(.*?\)\s*?;?/.test(__helpers.removeJSComments(code)) && !/\['endsWith'\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md index 84b4b5dc65f..dbae3dde019 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md @@ -51,7 +51,7 @@ assert(repeatStringNumTimes('abc', -2) === ''); The built-in `repeat()` method should not be used. ```js -assert(!/\.repeat/g.test(code)); +assert(!/\.repeat/g.test(__helpers.removeJSComments(code))); ``` `repeatStringNumTimes("abc", 0)` should return `""`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md index ec9575f325c..8477ae22407 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md @@ -53,19 +53,19 @@ assert.deepEqual( The `htmlColorNames` function should utilize the `splice()` method ```js -assert(/.splice/.test(code)); +assert(/.splice/.test(__helpers.removeJSComments(code))); ``` You should not use `shift()` or `unshift()`. ```js -assert(!/shift|unshift/.test(code)); +assert(!/shift|unshift/.test(__helpers.removeJSComments(code))); ``` You should not use array bracket notation. ```js -assert(!/\[\d\]\s*=/.test(code)); +assert(!/\[\d\]\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md index 99f116debcc..8158c3eea52 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md @@ -85,8 +85,8 @@ The definition of the `foods` object should not be changed. ```js assert( - code.search(/let foods/) === -1 && - code.search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ + __helpers.removeJSComments(code).search(/let foods/) === -1 && + __helpers.removeJSComments(code).search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ ) !== -1 ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md index cd848ed5010..441b90c9776 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md @@ -27,7 +27,7 @@ The `users` object should not be accessed directly ```js -assert(code.match(/users/gm).length <= 2) +assert(__helpers.removeJSComments(code).match(/users/gm).length <= 2) ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index 7c0b9f2ea0f..6f20c63f701 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ The `copyMachine` function should utilize the `spread operator` with array `arr` ```js -assert(code.match(/\.\.\.\s*arr/)); +assert(__helpers.removeJSComments(__helpers.removeJSComments(code)).match(/\.\.\.\s*arr/)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md index 325439ea9a2..53005bd00eb 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md @@ -38,7 +38,7 @@ assert.deepEqual( The `forecast` function should utilize the `slice()` method ```js -assert(/\.slice\(/.test(code)); +assert(/\.slice\(/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index 5ce682a372c..7374a1198e2 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -51,7 +51,7 @@ The function `countOnline` should use a `for in` statement to iterate through th ```js assert( - code.match( + __helpers.removeJSComments(code).match( /for\s*\(\s*(var|let|const)\s+[a-zA-Z_$]\w*\s+in\s+[a-zA-Z_$]\w*\s*\)/ ) ); diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md index 731f95ff6ae..7bc4adb5993 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md @@ -61,7 +61,7 @@ assert(userActivity.data.online === 45); The `online` property should be set using dot or bracket notation. ```js -assert.strictEqual(code.search(/online: 45/), -1); +assert.strictEqual(__helpers.removeJSComments(code).search(/online: 45/), -1); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md index 5c5f1f6d3a9..e2fed1627cc 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md @@ -40,7 +40,7 @@ You should not change the original line of `const arr = [2, 4, 5, 1, 7, 5, 2, 1] ```js assert( - __helpers.removeWhiteSpace(code).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) ); ``` @@ -56,14 +56,14 @@ assert.strictEqual( Your code should utilize the `splice()` method on `arr`. ```js -assert(__helpers.removeWhiteSpace(code).match(/arr\.splice\(/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(/)); ``` The splice should only remove elements from `arr` and not add any additional elements to `arr`. ```js assert( - !__helpers.removeWhiteSpace(code).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) + !__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md index 575e41f90aa..627ed9a5948 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md @@ -39,9 +39,9 @@ The `oranges`, `plums`, and `strawberries` keys should be removed using `delete` ```js assert( - code.search(/oranges:/) !== -1 && - code.search(/plums:/) !== -1 && - code.search(/strawberries:/) !== -1 + __helpers.removeJSComments(code).search(/oranges:/) !== -1 && + __helpers.removeJSComments(code).search(/plums:/) !== -1 && + __helpers.removeJSComments(code).search(/strawberries:/) !== -1 ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md index 774a661f7f5..5d5e9200567 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md @@ -54,7 +54,7 @@ The data in variable `myArray` should be accessed using bracket notation. ```js assert( (function () { - if (code.match(/\s*=\s*myArray\[0\]/g)) { + if (__helpers.removeJSComments(code).match(/\s*=\s*myArray\[0\]/g)) { return true; } else { return false; diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md index 4921bfa8f02..c05662a8423 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md @@ -45,7 +45,7 @@ assert(myData === 8); You should be using bracket notation to read the correct value from `myArray`. ```js -assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code))); +assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md index 525977abeac..e5cf4fc9ef1 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md @@ -54,7 +54,7 @@ assert(secondTree === 'pine'); Your code should use dot and bracket notation to access `myPlants`. ```js -assert(/=\s*myPlants\[1\].list\[1\]/.test(code)); +assert(/=\s*myPlants\[1\].list\[1\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md index 41c08ea866f..6b15dffd25f 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md @@ -64,7 +64,7 @@ assert(drinkValue === 'water'); You should use bracket notation twice ```js -assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md index db9d63d3bb8..86dcd740f80 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md @@ -60,7 +60,7 @@ assert(shirtValue === 'jersey'); You should use dot notation twice ```js -assert(code.match(/testObj\.\w+/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\.\w+/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md index f509f03e7e7..dc370d28fb0 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md @@ -56,19 +56,19 @@ assert(player === 'Montana'); You should use bracket notation to access `testObj` ```js -assert(/testObj\s*?\[.*?\]/.test(code)); +assert(/testObj\s*?\[.*?\]/.test(__helpers.removeJSComments(code))); ``` You should not assign the value `Montana` to the variable `player` directly. ```js -assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); +assert(!__helpers.removeJSComments(code).match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); ``` You should be using the variable `playerNumber` in your bracket notation ```js -assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code)); +assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md index ab0a9969e9b..a0281239d92 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md @@ -53,7 +53,7 @@ assert(myDog.bark !== undefined); You should not add `bark` to the initialization of `myDog`. ```js -assert(!/bark[^\n]:/.test(code)); +assert(!/bark[^\n]:/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md index fc107f1b587..1d742e4d667 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md @@ -38,7 +38,7 @@ assert(sum === 20); You should use the `+` operator. ```js -assert(/\+/.test(code)); +assert(/\+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md index 319770d14b9..48d98bf34e6 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md @@ -71,7 +71,7 @@ assert(switchOfStuff(4) === 'stuff'); You should not use any `if` or `else` statements ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` You should use a `default` statement @@ -83,7 +83,7 @@ assert(switchOfStuff('string-to-trigger-default-case') === 'stuff'); You should have at least 3 `break` statements ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md index 053bc60f7e3..b6658b7ea6f 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md @@ -36,7 +36,7 @@ assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2); You should append `someAdjective` to `myStr` using the `+=` operator. ```js -assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md index ad5a0371ab8..ed896f479f2 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md @@ -29,7 +29,7 @@ Assign the contents of `a` to variable `b`. You should not change code above the specified comment. ```js -assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code))); ``` `b` should have a value of `7`. @@ -41,7 +41,7 @@ assert(typeof b === 'number' && b === 7); `a` should be assigned to `b` with `=`. ```js -assert(/b\s*=\s*a\s*/g.test(code)); +assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md index a825bdf453a..e6e1ffcffe6 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md @@ -34,7 +34,7 @@ assert(processed === 2); You should assign `processArg` to `processed` ```js -assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code)); +assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md index 608723120c6..df451278269 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md @@ -39,19 +39,19 @@ Write chained `if`/`else if` statements to fulfill the following conditions: You should have at least four `else` statements ```js -assert(code.match(/else/g).length > 3); +assert(__helpers.removeJSComments(code).match(/else/g).length > 3); ``` You should have at least four `if` statements ```js -assert(code.match(/if/g).length > 3); +assert(__helpers.removeJSComments(code).match(/if/g).length > 3); ``` You should have at least one `return` statement ```js -assert(code.match(/return/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/return/g).length >= 1); ``` `testSize(0)` should return the string `Tiny` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index a5f59ff63f0..5b6a9e09cc1 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -2,7 +2,6 @@ id: bd7123c9c441eddfaeb4bdef title: Comment Your JavaScript Code challengeType: 1 -removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' forumTopicId: 16783 dashedName: comment-your-javascript-code diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index 8ef2dc27b8e..276b4c19d00 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -58,7 +58,7 @@ assert(testEqual('12') === 'Equal'); You should use the `==` operator ```js -assert(code.match(/==/g) && !code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/==/g) && !__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index 544d9f86fdb..292700753db 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -73,7 +73,7 @@ assert(testGreaterThan(150) === 'Over 100'); You should use the `>` operator at least twice ```js -assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index 3c0c64a793b..faf108fb241 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -73,7 +73,7 @@ assert(testGreaterOrEqual(21) === '20 or Over'); You should use the `>=` operator at least twice ```js -assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index c8260cfe2fe..8a8f79c4b84 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -60,7 +60,7 @@ assert(testNotEqual('bob') === 'Not Equal'); You should use the `!=` operator ```js -assert(code.match(/(?!!==)!=/)); +assert(__helpers.removeJSComments(code).match(/(?!!==)!=/)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index 8b7c5158fd8..d9b6893c63c 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -66,7 +66,7 @@ assert(testLessThan(99) === '55 or Over'); You should use the `<` operator at least twice ```js -assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index 55db0c27c7a..37e028eb9f7 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -72,7 +72,7 @@ assert(testLessOrEqual(55) === 'More Than 24'); You should use the `<=` operator at least twice ```js -assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index d0d14f64778..09d6fb81ad2 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -49,7 +49,7 @@ assert(testStrict('7') === 'Not Equal'); You should use the `===` operator ```js -assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index 9d2266e4636..c49a23991a0 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -52,7 +52,7 @@ assert(testStrictNotEqual('bob') === 'Not Equal'); You should use the `!==` operator ```js -assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md index e6433fac0ad..c557b1056d3 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md @@ -40,13 +40,13 @@ Replace the two if statements with one statement, using the `&&` operator, which You should use the `&&` operator once ```js -assert(code.match(/&&/g).length === 1); +assert(__helpers.removeJSComments(code).match(/&&/g).length === 1); ``` You should only have one `if` statement ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalAnd(0)` should return the string `No` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md index dba13a7dbc5..36178a26975 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md @@ -43,13 +43,13 @@ Combine the two `if` statements into one statement which returns the string `Out You should use the `||` operator once ```js -assert(code.match(/\|\|/g).length === 1); +assert(__helpers.removeJSComments(code).match(/\|\|/g).length === 1); ``` You should only have one `if` statement ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalOr(0)` should return the string `Outside` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md index 5e1db2e1405..f966d7484dd 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md @@ -54,16 +54,16 @@ assert(c === 19); You should use the `+=` operator for each variable. ```js -assert(code.match(/\+=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\+=/g).length === 3); ``` You should not modify the code above the specified comment. ```js assert( - /let a = 3;/.test(code) && - /let b = 17;/.test(code) && - /let c = 12;/.test(code) + /let a = 3;/.test(__helpers.removeJSComments(code)) && + /let b = 17;/.test(__helpers.removeJSComments(code)) && + /let c = 12;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md index dc48677b84b..2e3c8f71086 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md @@ -48,16 +48,16 @@ assert(c === 3); You should use the `/=` operator for each variable. ```js -assert(code.match(/\/=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\/=/g).length === 3); ``` You should not modify the code above the specified comment. ```js assert( - /let a = 48;/.test(code) && - /let b = 108;/.test(code) && - /let c = 33;/.test(code) + /let a = 48;/.test(__helpers.removeJSComments(code)) && + /let b = 108;/.test(__helpers.removeJSComments(code)) && + /let c = 33;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md index 6d3a4fe3ee5..a9de30a6364 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md @@ -48,16 +48,16 @@ assert(c === 46); You should use the `*=` operator for each variable. ```js -assert(code.match(/\*=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\*=/g).length === 3); ``` You should not modify the code above the specified comment. ```js assert( - /let a = 5;/.test(code) && - /let b = 12;/.test(code) && - /let c = 4\.6;/.test(code) + /let a = 5;/.test(__helpers.removeJSComments(code)) && + /let b = 12;/.test(__helpers.removeJSComments(code)) && + /let c = 4\.6;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md index c81bab787b6..8fce85b5742 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md @@ -48,14 +48,14 @@ assert(c === 2); You should use the `-=` operator for each variable. ```js -assert(code.match(/-=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/-=/g).length === 3); ``` You should not modify the code above the specified comment. ```js assert( - /let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code) + /let a = 11;/.test(__helpers.removeJSComments(code)) && /let b = 9;/.test(__helpers.removeJSComments(code)) && /let c = 3;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md index 3aaeab380f7..78410226b6f 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md @@ -47,19 +47,19 @@ assert(myStr === 'This is the start. This is the end.'); You should use the `+` operator to build `myStr`. ```js -assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g)); +assert(__helpers.removeJSComments(code).match(/(["']).*\1\s*\+\s*(["']).*\2/g)); ``` `myStr` should be created using the `const` keyword. ```js -assert(/const\s+myStr/.test(code)); +assert(/const\s+myStr/.test(__helpers.removeJSComments(code))); ``` You should assign the result to the `myStr` variable. ```js -assert(/myStr\s*=/.test(code)); +assert(/myStr\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index 94201b36790..d47ee7fa973 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -43,7 +43,7 @@ assert(myStr === 'This is the first sentence. This is the second sentence.'); You should use the `+=` operator to build `myStr`. ```js -assert(code.match(/myStr\s*\+=\s*(["']).*\1/g)); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*(["']).*\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md index 9a09a1d5cd2..dc485253fa7 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md @@ -35,7 +35,7 @@ assert(typeof myName !== 'undefined' && myName.length > 2); You should use two `+` operators to build `myStr` with `myName` inside it. ```js -assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); +assert(__helpers.removeJSComments(code).match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md index fe00f54d76b..5b84a8227cf 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md @@ -34,13 +34,13 @@ Push the odd numbers from 9 through 1 to `myArray` using a `for` loop. You should be using a `for` loop for this. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` You should be using the array method `push`. ```js -assert(code.match(/myArray.push/)); +assert(__helpers.removeJSComments(code).match(/myArray.push/)); ``` `myArray` should equal `[9, 7, 5, 3, 1]`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md index 9d41fe9503c..102e882e976 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md @@ -37,7 +37,7 @@ Look at the `ourName` example above if you get stuck. You should declare `myName` with the `var` keyword, ending with a semicolon ```js -assert(/var\s+myName\s*;/.test(code)); +assert(/var\s+myName\s*;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md index 3c5cb464e6a..ff957dabcfc 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md @@ -38,25 +38,25 @@ assert(myVar === 10); `myVar = myVar - 1;` should be changed. ```js -assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); ``` You should not assign `myVar` with `10`. ```js -assert(!code.match(/myVar\s*=\s*10.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*10.*?;?/)); ``` You should use the `--` operator on `myVar`. ```js -assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code)); +assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(__helpers.removeJSComments(code))); ``` You should not change code above the specified comment. ```js -assert(/let myVar = 11;/.test(code)); +assert(/let myVar = 11;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md index 1933fab7b41..cd57b180606 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md @@ -55,7 +55,7 @@ assert(typeof myDog === 'object' && myDog.tails === undefined); You should not modify the `myDog` setup. ```js -assert(code.match(/"tails": 1/g).length > 0); +assert(__helpers.removeJSComments(code).match(/"tails": 1/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md index 90732f0bd7d..0cc61567576 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md @@ -26,13 +26,13 @@ assert(quotient === 2.2); You should use the `/` operator to divide 4.4 by 2 ```js -assert(/4\.40*\s*\/\s*2\.*0*/.test(code)); +assert(/4\.40*\s*\/\s*2\.*0*/.test(__helpers.removeJSComments(code))); ``` The quotient variable should only be assigned once ```js -assert(code.match(/quotient\s*=/g).length === 1); +assert(__helpers.removeJSComments(code).match(/quotient\s*=/g).length === 1); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md index f5e9875ac42..38427a994fb 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md @@ -35,7 +35,7 @@ assert(quotient === 2); You should use the `/` operator. ```js -assert(/\d+\s*\/\s*\d+/.test(code)); +assert(/\d+\s*\/\s*\d+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md index 21fcd4fe6eb..3f33d49c525 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md @@ -36,7 +36,7 @@ I am a "double quoted" string inside "double quotes". You should use two double quotes (`"`) and four escaped double quotes (`\"`). ```js -assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2); +assert(__helpers.removeJSComments(code).match(/\\"/g).length === 4 && __helpers.removeJSComments(code).match(/[^\\]"/g).length === 2); ``` Variable `myStr` should contain the string: `I am a "double quoted" string inside "double quotes".` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md index 28e463a453d..d17daa4c773 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md @@ -29,8 +29,8 @@ You should not change the variable declarations in the `// Setup` section. ```js assert( - code.match(/let lastNameLength = 0;/) && - code.match(/const lastName = "Lovelace";/) + __helpers.removeJSComments(code).match(/let lastNameLength = 0;/) && + __helpers.removeJSComments(code).match(/const lastName = "Lovelace";/) ); ``` @@ -43,7 +43,7 @@ assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8); You should be getting the length of `lastName` by using `.length` like this: `lastName.length`. ```js -assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/)); +assert(__helpers.removeJSComments(code).match(/=\s*lastName\.length/g) && !__helpers.removeJSComments(code).match(/lastName\s*=\s*8/)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md index c680879a8b2..6b5ba558c6e 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md @@ -39,7 +39,7 @@ Set `remainder` equal to the remainder of `11` divided by `3` using the rem The variable `remainder` should be initialized ```js -assert(/(const|let|var)\s+?remainder/.test(code)); +assert(/(const|let|var)\s+?remainder/.test(__helpers.removeJSComments(code))); ``` The value of `remainder` should be `2` @@ -51,7 +51,7 @@ assert(remainder === 2); You should use the `%` operator ```js -assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code)); +assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md index 0a93e330620..b8bc6c1778b 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md @@ -36,7 +36,7 @@ assert((randomFraction() + '').match(/\./g)); You should be using `Math.random` to generate the random decimal number. ```js -assert(code.match(/Math\.random/g).length >= 0); +assert(__helpers.removeJSComments(code).match(/Math\.random/g).length >= 0); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md index df5743e2d44..04d87ba9c83 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md @@ -46,22 +46,22 @@ assert( You should use `Math.random` to generate a random number. ```js -assert(code.match(/Math.random/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.random/g).length >= 1); ``` You should have multiplied the result of `Math.random` by 10 to make it a number in the range from zero to nine. ```js assert( - code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || - code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) + __helpers.removeJSComments(code).match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || + __helpers.removeJSComments(code).match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) ); ``` You should use `Math.floor` to remove the decimal part of the number. ```js -assert(code.match(/Math.floor/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.floor/g).length >= 1); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md index f9d999395ac..9f55b7dea17 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md @@ -49,10 +49,10 @@ assert(randomRange(0, 1) % 1 === 0); assert( (function () { if ( - code.match(/myMax/g).length > 1 && - code.match(/myMin/g).length > 2 && - code.match(/Math.floor/g) && - code.match(/Math.random/g) + __helpers.removeJSComments(code).match(/myMax/g).length > 1 && + __helpers.removeJSComments(code).match(/myMin/g).length > 2 && + __helpers.removeJSComments(code).match(/Math.floor/g) && + __helpers.removeJSComments(code).match(/Math.random/g) ) { return true; } else { diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md index 5ee2aea4e86..cf501ba85f1 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md @@ -36,7 +36,7 @@ assert(myGlobal === 10); `myGlobal` should be declared using the `let` or `const` keywords ```js -assert(/(let|const)\s+myGlobal/.test(code)); +assert(/(let|const)\s+myGlobal/.test(__helpers.removeJSComments(code))); ``` `oopsGlobal` should be a global variable and have a value of `5` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md index d4ae646f40e..bf48ff49d1e 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md @@ -45,7 +45,7 @@ assert(myOutfit() === 'sweater'); You should not change the return statement. ```js -assert(/return outerWear/.test(code)); +assert(/return outerWear/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md index 6f1b0031438..c11ae000e52 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md @@ -39,20 +39,20 @@ You should not use the assignment operator. ```js assert( - /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(code) + /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(__helpers.removeJSComments(code)) ); ``` You should use the `++` operator. ```js -assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code)); +assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(__helpers.removeJSComments(code))); ``` You should not change code above the specified comment. ```js -assert(/let myVar = 87;/.test(code)); +assert(/let myVar = 87;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md index 1fd59cdfff7..74dba02c291 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md @@ -26,7 +26,7 @@ Define a variable `a` with `var` and initialize it to a value of `9`. You should initialize `a` to a value of `9`. ```js -assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code)); +assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md index 803a30f9c84..b844174c40f 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md @@ -30,20 +30,20 @@ Convert the logic to use `else if` statements. You should have at least two `else` statements ```js -assert(code.match(/else/g).length > 1); +assert(__helpers.removeJSComments(code).match(/else/g).length > 1); ``` You should have at least two `if` statements ```js -assert(code.match(/if/g).length > 1); +assert(__helpers.removeJSComments(code).match(/if/g).length > 1); ``` You should have closing and opening curly braces for each `if else` code block. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/ ) ); diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md index 683f9a30b18..7348b6448eb 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md @@ -28,13 +28,13 @@ Combine the `if` statements into a single `if/else` statement. You should only have one `if` statement in the editor ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` You should use an `else` statement ```js -assert(/else/g.test(code)); +assert(/else/g.test(__helpers.removeJSComments(code))); ``` `testElse(4)` should return the string `5 or Smaller` @@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5'); You should not change the code above or below the specified comments. ```js -assert(/let result = "";/.test(code) && /return result;/.test(code)); +assert(/let result = "";/.test(__helpers.removeJSComments(code)) && /return result;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md index af1764e1738..47f86402e34 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md @@ -32,7 +32,7 @@ Push the odd numbers from 1 through 9 to `myArray` using a `for` loop. You should be using a `for` loop for this. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` should equal `[1, 3, 5, 7, 9]`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md index 9b1799d7840..36bbd457c0b 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md @@ -30,7 +30,7 @@ Declare and initialize a variable `total` to `0`. Use a `for` loop to add the va `total` should be declared and initialized to 0. ```js -assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); ``` `total` should equal 20. @@ -42,13 +42,13 @@ assert(total === 20); You should use a `for` loop to iterate through `myArr`. ```js -assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code)); +assert(/for\s*\(/g.test(__helpers.removeJSComments(code)) && /myArr\s*\[/g.test(__helpers.removeJSComments(code))); ``` You should not attempt to directly assign the value 20 to `total`. ```js -assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm)); +assert(!__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/total[=+-]0*[1-9]+/gm)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md index af005afe4f1..84f8c48bf65 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md @@ -56,7 +56,7 @@ Change the `while` loop in the code to a `do...while` loop so the loop will push You should be using a `do...while` loop for this exercise. ```js -assert(code.match(/do/g)); +assert(__helpers.removeJSComments(code).match(/do/g)); ``` `myArray` should equal `[10]`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md index b530a42a31a..16d2ac028c2 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md @@ -44,7 +44,7 @@ Use a `for` loop to push the values 1 through 5 onto `myArray`. You should be using a `for` loop for this. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` should equal `[1, 2, 3, 4, 5]`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md index 27a209e3775..236f2fa714c 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md @@ -36,7 +36,7 @@ Add the numbers 5 through 0 (inclusive) in descending order to `myArray` using a You should be using a `while` loop for this. ```js -assert(code.match(/while/g)); +assert(__helpers.removeJSComments(code).match(/while/g)); ``` `myArray` should equal `[5, 4, 3, 2, 1, 0]`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index eb73b0f20f6..e36c0ab3819 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -48,7 +48,7 @@ You should add a local `myVar` variable. ```js assert( /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( - __helpers.removeWhiteSpace(code) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)) ) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md index d6f5760b016..b449b95ab25 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md @@ -47,7 +47,7 @@ assert( You should use `pop()` on `myArray`. ```js -assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code)); +assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(__helpers.removeJSComments(code))); ``` `removedFromMyArray` should only contain `["cat", 2]`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md index e2af9ff7abd..4f440c3c1d4 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md @@ -52,7 +52,7 @@ You should be using correct index to modify the value in `myArray`. ```js assert( (function () { - if (code.match(/myArray\[0\]\s*=\s*/g)) { + if (__helpers.removeJSComments(code).match(/myArray\[0\]\s*=\s*/g)) { return true; } else { return false; diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md index 3d1d4276242..a922470d8e2 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md @@ -94,13 +94,13 @@ assert(sequentialSizes(9) === 'High'); You should not use any `if` or `else` statements ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` You should have nine `case` statements ```js -assert(code.match(/case/g).length === 9); +assert(__helpers.removeJSComments(code).match(/case/g).length === 9); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md index c1118c349f3..158c361ecdb 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md @@ -28,7 +28,7 @@ assert(product === 5.0); You should use the `*` operator ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md index 98cff459984..94383a301e5 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md @@ -36,7 +36,7 @@ assert(product === 80); You should use the `*` operator. ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md index 62795ccd42f..53f2940b537 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md @@ -60,7 +60,7 @@ You should call `functionWithArgs` with two numbers after you define it. ```js assert( /functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test( - code.replace(/\s/g, '') + __helpers.removeJSComments(code).replace(/\s/g, '') ) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md index ee683c59fa1..a124c651b08 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md @@ -47,7 +47,7 @@ assert(compareEquality('20', 20) === 'Not Equal'); You should use the `===` operator ```js -assert(code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index dc6b0959b9f..fa18defa6f7 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -47,7 +47,7 @@ You should remove all the backslashes (`\`). ```js assert( - !/\\/g.test(code) && + !/\\/g.test(__helpers.removeJSComments(code)) && myStr.match( '\\s*\\s*Link\\s*\\s*' ) @@ -57,7 +57,7 @@ assert( You should have two single quotes `'` and four double quotes `"`. ```js -assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2); +assert(__helpers.removeJSComments(code).match(/"/g).length === 4 && __helpers.removeJSComments(code).match(/'/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index e30e0a3018d..b38246305c5 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,7 +66,7 @@ Your code should not rely on any kind of loops (`for` or `while` or higher order ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md index b43ee5c811a..9b239123f07 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md @@ -45,19 +45,19 @@ Change the chained `if`/`else if` statements into a `switch` statement. You should not use any `else` statements anywhere in the editor ```js -assert(!/else/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code))); ``` You should not use any `if` statements anywhere in the editor ```js -assert(!/if/g.test(code)); +assert(!/if/g.test(__helpers.removeJSComments(code))); ``` You should have at least four `break` statements ```js -assert(code.match(/break/g).length >= 4); +assert(__helpers.removeJSComments(code).match(/break/g).length >= 4); ``` `chainToSwitch("bob")` should return the string `Marley` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md index fbca53af739..862523365ac 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md @@ -52,7 +52,7 @@ assert(isLess(15, 10) === false); You should not use any `if` or `else` statements ```js -assert(!/if|else/g.test(code)); +assert(!/if|else/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md index 87f0ade0359..dd61469c08d 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md @@ -63,13 +63,13 @@ assert(caseInSwitch(4) === 'delta'); You should not use any `if` or `else` statements ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` You should have at least 3 `break` statements ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md index 8c946f1c2d2..22ab4be5e44 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md @@ -35,7 +35,7 @@ Assign the value `7` to variable `a`. You should not change code above the specified comment. ```js -assert(/var a;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code))); ``` `a` should have a value of 7. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md index 83508131f07..5ef318c8e56 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md @@ -35,7 +35,7 @@ assert(difference === 12); You should only subtract one number from `45`. ```js -assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code))); +assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md index 2564240ae8c..8e189327f7a 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md @@ -40,7 +40,7 @@ assert(myStr === 'Hello World'); You should not change the code above the specified comment. ```js -assert(/myStr = "Jello World"/.test(code)); +assert(/myStr = "Jello World"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md index 93c8577ac67..1645b3846f6 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md @@ -56,19 +56,19 @@ assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000); `studlyCapVar` should use camelCase in both declaration and assignment sections. ```js -assert(code.match(/studlyCapVar/g).length === 2); +assert(__helpers.removeJSComments(code).match(/studlyCapVar/g).length === 2); ``` `properCamelCase` should use camelCase in both declaration and assignment sections. ```js -assert(code.match(/properCamelCase/g).length === 2); +assert(__helpers.removeJSComments(code).match(/properCamelCase/g).length === 2); ``` `titleCaseOver` should use camelCase in both declaration and assignment sections. ```js -assert(code.match(/titleCaseOver/g).length === 2); +assert(__helpers.removeJSComments(code).match(/titleCaseOver/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index 27fe3157eec..1d6dc81ef4e 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -39,9 +39,9 @@ You should not change code below the specified comment. ```js assert( - /a = a \+ 1;/.test(code) && - /b = b \+ 5;/.test(code) && - /c = c \+ " String!";/.test(code) + /a = a \+ 1;/.test(__helpers.removeJSComments(code)) && + /b = b \+ 5;/.test(__helpers.removeJSComments(code)) && + /c = c \+ " String!";/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md index 1fed807aff3..730c224be61 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md @@ -39,7 +39,7 @@ assert(/happy coder/gi.test(myDog.name)); You should not edit the `myDog` definition. ```js -assert(/"name": "Coder"/.test(code)); +assert(/"name": "Coder"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md index ff334faf2cf..bb362ea62b1 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md @@ -41,7 +41,7 @@ assert(firstLetterOfLastName === 'L'); You should use bracket notation. ```js -assert(code.match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md index b2c4ce8d478..e433f67a70a 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(lastLetterOfLastName === 'e'); You should use `.length` to get the last letter. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md index b5cd43bef41..6d208672baf 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md @@ -39,7 +39,7 @@ assert(thirdLetterOfLastName === 'v'); You should use bracket notation. ```js -assert(code.match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md index db3391361ed..7f507243a94 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(secondToLastLetterOfLastName === 'c'); You should use `.length` to get the second last letter. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md index 48521473393..fb4eb8b0386 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md @@ -54,7 +54,7 @@ In the `checkSign` function, use multiple conditional operators - following the `checkSign` should use multiple conditional operators ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(__helpers.removeJSComments(code))); ``` `checkSign(10)` should return the string `positive`. Note that capitalization matters diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index 36dd7bcbf98..e57a13d85af 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,7 +59,7 @@ Your code should not rely on any kind of loops (`for`, `while` or higher order f ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index c1d664f2baf..f0705fa2a4f 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,7 +26,7 @@ Your code should not use any loop syntax (`for` or `while` or higher order funct ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index cca85c335f3..475aeb74a31 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -42,7 +42,7 @@ Use the conditional operator in the `checkEqual` function to check if two number `checkEqual` should use the conditional operator ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(__helpers.removeJSComments(code))); ``` `checkEqual(1, 2)` should return the string `Not Equal` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md index 392131577e9..aadb827669c 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md @@ -34,7 +34,7 @@ Use `parseInt()` in the `convertToInteger` function so it converts a binary numb `convertToInteger` should use the `parseInt()` function ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("10011")` should return a number diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md index ba87355443d..2a1215d02a0 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md @@ -26,7 +26,7 @@ Use `parseInt()` in the `convertToInteger` function so it converts the input str `convertToInteger` should use the `parseInt()` function ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("56")` should return a number diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md index 0f879f74f7b..9f4ec2d2980 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md @@ -83,14 +83,14 @@ assert(typeof phoneticLookup('') === 'undefined'); You should not modify the `return` statement ```js -assert(code.match(/return\sresult;/)); +assert(__helpers.removeJSComments(code).match(/return\sresult;/)); ``` You should not use `case`, `switch`, or `if` statements ```js assert( - !/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) + !/case|switch|if/g.test(__helpers.removeJSComments(code).replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md index 0f519ae9a5d..e9f6883ef80 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md @@ -53,7 +53,7 @@ assert( You should not directly use the values `dog`, `ran`, `big`, or `quickly` to create `wordBlanks`. ```js -const newCode = removeAssignments(code); +const newCode = removeAssignments(__helpers.removeJSComments(code)); assert( !/dog/.test(newCode) && !/ran/.test(newCode) && diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md index 2a62b70ea4f..97fe0e88005 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md @@ -50,7 +50,7 @@ You should call `reusableFunction` once it is defined. ```js const functionStr = reusableFunction && __helpers.removeWhiteSpace(reusableFunction.toString()); -const codeWithoutFunction = __helpers.removeWhiteSpace(code).replace(/reusableFunction\(\)\{/g, ''); +const codeWithoutFunction = __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).replace(/reusableFunction\(\)\{/g, ''); assert(/reusableFunction\(\)/.test(codeWithoutFunction)); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md index 7aea16b1e6b..25744faaff1 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md @@ -25,7 +25,7 @@ assert(power == 8); Your code should use the correct order of the arguments for the `raiseToPower` function call. ```js -assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); +assert(__helpers.removeJSComments(code).match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md index 83f757ada16..fa042698c88 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md @@ -37,7 +37,7 @@ assert(result == 9); Your code should call the `getNine` function. ```js -assert(code.match(/getNine\(\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/getNine\(\)/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md index c0795c6ea6f..bcbfad11dea 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md @@ -27,25 +27,25 @@ assert(netWorkingCapital === 2); There should be no instances of misspelled variables in the code. ```js -assert(!code.match(/recievables/g)); +assert(!__helpers.removeJSComments(code).match(/recievables/g)); ``` The `receivables` variable should be declared and used properly in the code. ```js -assert(code.match(/receivables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/receivables/g).length == 2); ``` There should be no instances of misspelled variables in the code. ```js -assert(!code.match(/payable;/g)); +assert(!__helpers.removeJSComments(code).match(/payable;/g)); ``` The `payables` variable should be declared and used properly in the code. ```js -assert(code.match(/payables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/payables/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index 90d6fcd9581..8cd7fce770f 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -37,13 +37,13 @@ Fix the string so it either uses different quotes for the `href` value, or escap Your code should fix the quotes around the `href` value `#Home` by either changing or escaping them. ```js -assert(code.match(//g)); +assert(__helpers.removeJSComments(code).match(//g)); ``` Your code should keep the double quotes around the entire string. ```js -assert(code.match(/"

.*?<\/p>";/g)); +assert(__helpers.removeJSComments(code).match(/"

.*?<\/p>";/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md index e0ccc7ba4d2..1c29cf7a8ea 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md @@ -37,25 +37,25 @@ Fix the two indexing errors in the following function so all the numbers 1 throu Your code should set the initial condition of the loop so it starts at the first index. ```js -assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?=\s*?0\s*?;/g).length == 1); ``` Your code should fix the initial condition of the loop so that the index starts at 0. ```js -assert(!code.match(/i\s?=\s*?1\s*?;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s?=\s*?1\s*?;/g)); ``` Your code should set the terminal condition of the loop so it stops at the last index. ```js -assert(code.match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); ``` Your code should fix the terminal condition of the loop so that it stops at 1 before the length. ```js -assert(!code.match(/i\s*?<=\s*?len;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?<=\s*?len;/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md index 42ad053023c..174e004e94a 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md @@ -21,7 +21,7 @@ Fix the two pair errors in the code. Your code should fix the missing piece of the array. ```js -assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); +assert(__helpers.removeJSComments(code).match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); ``` Your code should fix the missing piece of the `.reduce()` method. The console output should show that `Sum of array values is: 6`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md index 7fea55d1857..bdb5b446fa0 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md @@ -43,7 +43,7 @@ assert(result == 'Not equal!'); The condition should use either `==` or `===` to test for equality. ```js -assert(code.match(/x\s*?===?\s*?y/g)); +assert(__helpers.removeJSComments(code).match(/x\s*?===?\s*?y/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md index 9455e136450..bc754ef04be 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md @@ -31,13 +31,13 @@ The `myFunc()` function contains an infinite loop because the terminal condition Your code should change the comparison operator in the terminal condition (the middle part) of the `for` loop. ```js -assert(code.match(/i\s*?<=\s*?4;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?<=\s*?4;/g).length == 1); ``` Your code should fix the comparison operator in the terminal condition of the loop. ```js -assert(!code.match(/i\s*?!=\s*?4;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?!=\s*?4;/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index cb849f0678c..e1a156d6d87 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -23,7 +23,7 @@ After that, use `console.log` to log the `output` variable. View the two console You should use `console.log()` to print the `output` variable. ```js -assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/console\.log\(output\)/)); ``` You should use `console.clear()` to clear the browser console. @@ -31,7 +31,7 @@ You should use `console.clear()` to clear the browser console. ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console.clear\(\)/) ); ``` @@ -41,7 +41,7 @@ You should clear the console after your log. ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console\.log\(output\)[\s\S]*console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md index 4e212c27230..e0572d55c49 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md @@ -29,7 +29,7 @@ Use the `console.log()` method to print the value of the variable `a` where note Your code should use `console.log()` to check the value of the variable `a`. ```js -assert(code.match(/console\.log\(a\)/g)); +assert(__helpers.removeJSComments(code).match(/console\.log\(a\)/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md index 4a665970ce0..b4c2503d024 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md @@ -32,19 +32,19 @@ Add two `console.log()` statements to check the `typeof` each of the two variabl Your code should use `typeof` in two `console.log()` statements to check the type of the variables. ```js -assert(code.match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); ``` Your code should use `typeof` to check the type of the variable `seven`. ```js -assert(code.match(/typeof[\( ]seven\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]seven\)?/g)); ``` Your code should use `typeof` to check the type of the variable `three`. ```js -assert(code.match(/typeof[\( ]three\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]three\)?/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index f2fcef3fbbe..5c9235a5625 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -87,13 +87,13 @@ This exercise is designed to illustrate the difference between how `var` and `le `var` should not exist in code. ```js -assert(!code.match(/var/g)); +assert(!__helpers.removeJSComments(code).match(/var/g)); ``` The variable `i` declared in the `if` statement should equal the string `block scope`. ```js -assert(code.match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); +assert(__helpers.removeJSComments(code).match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); ``` `checkScope()` should return the string `function scope` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index aea3b4dd18e..077060dea36 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,7 +32,7 @@ Make the promise handle success and failure. If `responseFromServer` is `true`, ```js assert( - code.match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) ); ``` @@ -40,7 +40,7 @@ assert( ```js assert( - code.match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md index 664d8a09303..d4dd94e7047 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md @@ -32,7 +32,7 @@ Your promise should receive a function with `resolve` and `reject` as parameters ```js assert( - code.match( + __helpers.removeJSComments(code).match( /Promise\s*\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g ) ); diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md index 30959b42a3c..d4964d1b073 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md @@ -25,14 +25,14 @@ Add a script to the HTML document of type `module` and give it the source file o You should create a `script` tag. ```js -assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); +assert(__helpers.removeJSComments(code).match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); ``` Your `script` tag should have the `type` attribute with a value of `module`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g ) ); @@ -42,7 +42,7 @@ Your `script` tag should have a `src` of `index.js`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g ) ); diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md index 0f4d9c3390b..4461a51d4d0 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md @@ -38,7 +38,7 @@ Your code should use an `export` fallback. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g ) ); diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md index 22e02de6657..e3691452a84 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md @@ -75,7 +75,7 @@ assert.match(code, /(`.*\${.*}.*`)/); An iterator should be used. ```js -assert(code.match(/for|map|reduce|forEach|while/)); +assert(__helpers.removeJSComments(code).match(/for|map|reduce|forEach|while/)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md index 8ce7f00b693..15529fa97f0 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md @@ -34,7 +34,7 @@ You should call the `then` method on the promise. ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.then\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.then\(/g) ); ``` @@ -50,7 +50,7 @@ You should log `result` to the console. assert( resultIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.then\(.*?result.*?console.log\(result\).*?\)/) ); ``` @@ -60,7 +60,7 @@ assert( ## --after-user-code-- ```js -const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(code)); +const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md index 9cf7ab11460..4a6b8ef70df 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md @@ -28,7 +28,7 @@ You should call the `catch` method on the promise. ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.catch\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.catch\(/g) ); ``` @@ -44,7 +44,7 @@ You should log `error` to the console. assert( errorIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.catch\(.*?error.*?console.log\(error\).*?\)/) ); ``` @@ -54,7 +54,7 @@ assert( ## --after-user-code-- ```js -const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(code)); +const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md index d8a0a3d465e..2ad5a5f9e0c 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md @@ -25,7 +25,7 @@ In the following code, import the default export from the `math_functions.js` fi You should properly import `subtract` from `math_functions.js`. ```js -assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); +assert(__helpers.removeJSComments(code).match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md index 45e1bf50d4a..b8959ccd03d 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md @@ -36,19 +36,19 @@ An array is declared as `const s = [5, 7, 2]`. Change the array to `[2, 5, 7]` u You should not replace `const` keyword. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `s` should be a constant variable (by using `const`). ```js -assert(code.match(/const\s+s/g)); +assert(__helpers.removeJSComments(code).match(/const\s+s/g)); ``` You should not change the original array declaration. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g )); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md index 81871af4d84..2ccc4562475 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md @@ -34,19 +34,19 @@ In this challenge you are going to use `Object.freeze` to prevent mathematical c You should not replace the `const` keyword. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `MATH_CONSTANTS` should be a constant variable (by using `const`). ```js -assert(code.match(/const\s+MATH_CONSTANTS/g)); +assert(__helpers.removeJSComments(code).match(/const\s+MATH_CONSTANTS/g)); ``` You should not change the original declaration of `MATH_CONSTANTS`. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g )); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md index ff3449dd2f8..f4bc9c5b431 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md @@ -32,7 +32,7 @@ You should properly import `uppercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); @@ -42,7 +42,7 @@ You should properly import `lowercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index 0bb3fd12f27..d274ece607e 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -44,7 +44,7 @@ assert(increment(5) === 6); A default parameter value of `1` should be used for `value`. ```js -assert(code.match(/value\s*=\s*1/g)); +assert(__helpers.removeJSComments(code).match(/value\s*=\s*1/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md index c990788c45a..7c68ab7bc5b 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md @@ -31,7 +31,7 @@ Your code should properly use `import * as` syntax. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g ) ); diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index 6ac1354551d..79757f26c3d 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -66,7 +66,7 @@ assert( The `class` keyword should be used. ```js -assert(code.match(/class/g)); +assert(__helpers.removeJSComments(code).match(/class/g)); ``` `Vegetable` should be able to be instantiated. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md index 06603733844..15fd81f95d8 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md @@ -51,7 +51,7 @@ assert(b === 8); You should use array destructuring to swap `a` and `b`. ```js -assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code)); +assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index 7351036c00a..5e45ea952e3 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -43,8 +43,8 @@ You should remove the ES5 assignment syntax. ```js assert( - !code.match(/lowToday = LOCAL_FORECAST\.today\.low/g) && - !code.match(/highToday = LOCAL_FORECAST\.today.high/g) + !__helpers.removeJSComments(code).match(/lowToday = LOCAL_FORECAST\.today\.low/g) && + !__helpers.removeJSComments(code).match(/highToday = LOCAL_FORECAST\.today.high/g) ); ``` @@ -52,7 +52,7 @@ You should use destructuring to create the `lowToday` variable. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(low\s*:\s*lowToday[^}]*|[^,]*,\s*low\s*:\s*lowToday\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); @@ -62,7 +62,7 @@ You should use destructuring to create the `highToday` variable. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday,?\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index a4d5d900732..9fc0ab09b7b 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -34,8 +34,8 @@ You should remove the ES5 assignment syntax. ```js assert( - !code.match(/highToday = HIGH_TEMPERATURES\.today/g) && - !code.match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) + !__helpers.removeJSComments(code).match(/highToday = HIGH_TEMPERATURES\.today/g) && + !__helpers.removeJSComments(code).match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) ); ``` @@ -43,7 +43,7 @@ You should use destructuring to create the `highToday` variable. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(today\s*:\s*highToday[^}]*|[^,]*,\s*today\s*:\s*highToday\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); @@ -53,7 +53,7 @@ You should use destructuring to create the `highTomorrow` variable. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(tomorrow\s*:\s*highTomorrow[^}]*|[^,]*,\s*tomorrow\s*:\s*highTomorrow\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index 5d71f583488..fa6536ed622 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,7 +43,7 @@ You should remove the ES5 assignment syntax. ```js assert( - !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !__helpers.removeJSComments(code).match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -51,7 +51,7 @@ You should use destructuring to create the `today` variable. ```js assert( - code.match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` @@ -59,7 +59,7 @@ You should use destructuring to create the `tomorrow` variable. ```js assert( - code.match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md index 5e5d98d9ad4..b854c6d6963 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md @@ -50,13 +50,13 @@ assert(half(stats) === 28.015); Destructuring should be used. ```js -assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/half=\({\w+,\w+}\)/)); ``` Destructured parameter should be used. ```js -assert(!code.match(/stats\.max|stats\.min/)); +assert(!__helpers.removeJSComments(code).match(/stats\.max|stats\.min/)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index 31b4e1cecf2..3b292c14093 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -47,7 +47,7 @@ assert.deepEqual(_testArr, [1, 2, 3, 4, 5]) `Array.slice()` should not be used. ```js -assert(!code.match(/\.\s*slice\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*slice\s*\(/)); ``` You should use the rest syntax. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md index cffcbbe642a..aced8c3e666 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md @@ -42,7 +42,7 @@ You should properly export `uppercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+uppercaseString|export\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)})/g ) ); @@ -52,7 +52,7 @@ You should properly export `lowercaseString`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+lowercaseString|export\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)})/g ) ); diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md index 3662a2a5b6a..16419359312 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md @@ -57,7 +57,7 @@ assert(sum() === 0); `sum` should be an arrow function which uses the rest parameter syntax (`...`) on the `args` parameter. ```js -assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/sum=\(\.\.\.args\)=>/)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md index a1459ca284e..fdec08a18ac 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md @@ -55,7 +55,7 @@ assert(arr2.every((v, i) => v === arr1[i]) && arr2.length); `...` spread operator should be used to duplicate `arr1`. ```js -assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); +assert(__helpers.removeJSComments(code).match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); ``` `arr2` should remain unchanged when `arr1` is changed. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md index b69719ca7b6..dacd988e3b1 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md @@ -54,7 +54,7 @@ assert.match(code, /const\s+myConcat/g); ```js assert( - /myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) && + /myConcat=\(\w+,\w+\)=>/.test(__helpers.removeJSComments(code).replace(/\s/g, '')) && typeof myConcat === 'function' ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 358e8df5ea9..973013765c9 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,14 +39,14 @@ Refactor the function `setGear` inside the object `bicycle` to use the shorthand Traditional function expression should not be used. ```js -assert(!code.match(/function/)); +assert(!__helpers.removeJSComments(code).match(/function/)); ``` `setGear` should be a declarative function. ```js assert( - typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/) + typeof bicycle.setGear === 'function' && __helpers.removeJSComments(code).match(/setGear\s*\(.+\)\s*\{/) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md index 5841f2d195e..698e8f8b27b 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md @@ -43,7 +43,7 @@ assert.deepEqual( Your code should not use `key:value`. ```js -assert(!code.match(/:/g)) +assert(!__helpers.removeJSComments(code).match(/:/g)) ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md index f676b7481a9..a0483aa7bd7 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md @@ -30,13 +30,13 @@ Change the `nonMutatingPush` function so it uses `concat` to merge `newItem` to Your code should use the `concat` method. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` Your code should not use the `push` method. ```js -assert(!code.match(/\.?[\s\S]*?push/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?push/g)); ``` The `first` array should not change. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md index 8023a0f9914..a47af76189d 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md @@ -31,7 +31,7 @@ The output should not have any spaces Your code should not use the `replace` method for this challenge. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `urlSlug("Winter Is Coming")` should return the string `winter-is-coming`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md index 639900381dd..48955e87d5a 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md @@ -27,13 +27,13 @@ Use the `join` method (among others) inside the `sentensify` function to make a Your code should use the `join` method. ```js -assert(code.match(/\.join/g)); +assert(__helpers.removeJSComments(code).match(/\.join/g)); ``` Your code should not use the `replace` method. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `sentensify("May-the-force-be-with-you")` should return a string. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md index 9b15f17e549..0d2f0a3460a 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md @@ -25,7 +25,7 @@ Use the `concat` method in the `nonMutatingConcat` function to concatenate `atta Your code should use the `concat` method. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` The `first` array should not change. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md index 5d639253214..2c7324a123d 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md @@ -47,7 +47,7 @@ assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_ Your code should not use the `map` method. ```js -assert(!code.match(/\.?[\s\S]*?map/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?map/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md index 5dd410b9d01..120acd331c2 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md @@ -43,7 +43,7 @@ assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFi Your code should not use the `filter` method. ```js -assert(!code.match(/\.?[\s\S]*?filter/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?filter/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md index f09e2409152..7a3a5b16a31 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md @@ -77,7 +77,7 @@ assert(add(11)(22)(33) === 66); Your code should include a final statement that returns `x + y + z`. ```js -assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); +assert(__helpers.removeJSComments(code).match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md index 810f13ce8a7..1b5c01b526f 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md @@ -30,13 +30,13 @@ Do not mutate the original array provided to the function. Your code should use the `slice` method. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` Your code should not use the `splice` method. ```js -assert(!code.match(/\.?[\s\S]*?splice/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?splice/g)); ``` You should not mutate the original array passed to the function. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md index ad25ac3ca30..3dbbb9c586c 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md @@ -28,7 +28,7 @@ Use the `slice` method in the `sliceArray` function to return part of the `anim` Your code should use the `slice` method. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` The `inputAnim` variable should not change. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md index 0dcf521c245..c57e31d884d 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md @@ -47,7 +47,7 @@ Use the `sort` method in the `alphabeticalOrder` function to sort the elements o Your code should use the `sort` method. ```js -assert(code.match(/\.sort/g)); +assert(__helpers.removeJSComments(code).match(/\.sort/g)); ``` `alphabeticalOrder(["a", "d", "c", "a", "z", "g"])` should return `["a", "a", "c", "d", "g", "z"]`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md index 790a15b15e3..8f6492382c5 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md @@ -33,7 +33,7 @@ Use the `split` method inside the `splitify` function to split `str` into an arr Your code should use the `split` method. ```js -assert(code.match(/\.split/g)); +assert(__helpers.removeJSComments(code).match(/\.split/g)); ``` `splitify("Hello World,I-am code")` should return `["Hello", "World", "I", "am", "code"]`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index 3b80b6677c1..da62f91a2ab 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), `for`, `while`, and `forEach` should not be used. ```js -assert(!code.match(/for|while|forEach/g)); +assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ``` `map`, `filter`, or `reduce` should be used. @@ -36,7 +36,7 @@ assert(!code.match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md index 61942f19549..d9e99d6855b 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md @@ -31,7 +31,7 @@ Use the `every` method inside the `checkPositive` function to check if every ele Your code should use the `every` method. ```js -assert(code.match(/\.every/g)); +assert(__helpers.removeJSComments(code).match(/\.every/g)); ``` `checkPositive([1, 2, 3, -4, 5])` should return `false`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md index cf4b07d73df..4e7bd57545d 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md @@ -46,13 +46,13 @@ assert( Your code should use the `filter` method. ```js -assert(code.match(/\s*\.\s*filter/g)); +assert(__helpers.removeJSComments(code).match(/\s*\.\s*filter/g)); ``` Your code should not use a `for` loop. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` `filteredList` should equal `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"}, {"title": "Batman Begins", "rating": "8.3"}]`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index a256fe48b94..0c4713bb9a6 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,13 +52,13 @@ assert( Your code should not use a `for` loop. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); ``` Your code should use the `map` method. ```js -assert(code.match(/\.map/g)); +assert(__helpers.removeJSComments(code).match(/\.map/g)); ``` `ratings` should equal `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"},{"title": "Batman Begins", "rating": "8.3"}, {"title": "Avatar", "rating": "7.9"}]`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md index 6d3260b0d58..f9b9ef5797c 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md @@ -66,7 +66,7 @@ assert( Your code should use the `reduce` method. ```js -assert(code.match(/\.reduce/g)); +assert(__helpers.removeJSComments(code).match(/\.reduce/g)); ``` The `getRating(watchList)` should equal 8.675. @@ -78,7 +78,7 @@ assert(getRating(watchList) === 8.675); Your code should not use a `for` loop. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` Your code should return the correct output after modifying the `watchList` object. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md index 9e949a9b4b0..393ed21d432 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md @@ -31,7 +31,7 @@ Use the `some` method inside the `checkPositive` function to check if any elemen Your code should use the `some` method. ```js -assert(code.match(/\.some/g)); +assert(__helpers.removeJSComments(code).match(/\.some/g)); ``` `checkPositive([1, 2, 3, -4, 5])` should return `true`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md index e0538763619..e6e2f2ef50c 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md @@ -39,7 +39,7 @@ assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4]); Your solution should not use the `Array.prototype.flat()` or `Array.prototype.flatMap()` methods. ```js -assert(!code.match(/\.\s*flat\s*\(/) && !code.match(/\.\s*flatMap\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*flat\s*\(/) && !__helpers.removeJSComments(code).match(/\.\s*flatMap\s*\(/)); ``` Global variables should not be used. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md index 5313994f242..0fdd4c2bf41 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md @@ -49,7 +49,7 @@ Add the property `numLegs` and the two methods `eat()` and `describe()` to the ` `Dog.prototype` should be set to a new object. ```js -assert(/Dog\.prototype\s*?=\s*?{/.test(code)); +assert(/Dog\.prototype\s*?=\s*?{/.test(__helpers.removeJSComments(code))); ``` `Dog.prototype` should have the property `numLegs`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md index 27fa9f57b7c..07d1f417a7b 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md @@ -61,7 +61,7 @@ The `duck` variable should be initialised with `Object.create`. ```js assert( /(let|const|var)\s{1,}duck\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` @@ -71,7 +71,7 @@ The `beagle` variable should be initialised with `Object.create`. ```js assert( /(let|const|var)\s{1,}beagle\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md index 75444c77126..bad85d4905c 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md @@ -61,7 +61,7 @@ assert.deepEqual(prototypeProps, ['numLegs']); You should solve this challenge without using the built in method `Object.keys()`. ```js -assert(!/\Object.keys/.test(code)); +assert(!/\Object.keys/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md index b0c80c8ee4c..d0c24b5c472 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md @@ -43,7 +43,7 @@ assert(dog.sayLegs() === 'This dog has 4 legs.'); Your code should use the `this` keyword to access the `numLegs` property of `dog`. ```js -assert(code.match(/this\.numLegs/g)); +assert(__helpers.removeJSComments(code).match(/this\.numLegs/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md index 2eb048692a7..4053289b262 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md @@ -51,7 +51,7 @@ assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1); You should solve this challenge without using the built in method `Object.keys()`. ```js -assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); +assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(__helpers.removeJSComments(code))); ``` You should solve this challenge without hardcoding the `ownProps` array. @@ -59,7 +59,7 @@ You should solve this challenge without hardcoding the `ownProps` array. ```js assert( !/\[\s*(?:'|")(?:name|numLegs)|(?:push|concat)\(\s*(?:'|")(?:name|numLegs)/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md index 17b2bf83598..a3cd74fa7f5 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md @@ -55,7 +55,7 @@ assert(joinDogFraternity(new Dog('')) === true); `joinDogFraternity` should use the `constructor` property. ```js -assert(/\.constructor/.test(code) && !/instanceof/.test(code)); +assert(/\.constructor/.test(__helpers.removeJSComments(code)) && !/instanceof/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md index 67ebe4d0e79..6692f8321f8 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md @@ -29,13 +29,13 @@ Rewrite the function `makeNest` and remove its call so instead it's an anonymous The function should be anonymous. ```js -assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, ''))); +assert(/\((function|\(\))(=>|\(\)){?/.test(__helpers.removeJSComments(code).replace(/\s/g, ''))); ``` Your function should have parentheses at the end of the expression to call it immediately. ```js -assert(/\(.*(\)\(|\}\(\))\)/.test(code.replace(/[\s;]/g, ''))); +assert(/\(.*(\)\(|\}\(\))\)/.test(__helpers.removeJSComments(code).replace(/[\s;]/g, ''))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md index 1ee203a745f..7cca4c8aa9f 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md @@ -42,7 +42,7 @@ Modify the code to show the correct prototype chain. Your code should show that `Object.prototype` is the prototype of `Dog.prototype` ```js -assert(/Object\.prototype\.isPrototypeOf/.test(code)); +assert(/Object\.prototype\.isPrototypeOf/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md index ce7ed680ff0..4174c9b679e 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md @@ -35,7 +35,7 @@ Use `isPrototypeOf` to check the `prototype` of `beagle`. You should show that `Dog.prototype` is the `prototype` of `beagle` ```js -assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code)); +assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md index 122fcb9a59b..60d7ba24dbe 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md @@ -52,7 +52,7 @@ assert(hound instanceof Dog); Your code should use the `new` operator to create an instance of `Dog`. ```js -assert(code.match(/new/g)); +assert(__helpers.removeJSComments(code).match(/new/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md index 8441ee648aa..34f472c9bce 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md @@ -43,7 +43,7 @@ Change how `weight` is declared in the `Bird` function so it is a private variab The `weight` property should be a private variable and should be assigned the value of `15`. ```js -assert(code.match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); ``` Your code should create a method in `Bird` called `getWeight` that returns the value of the private variable `weight`. @@ -55,7 +55,7 @@ assert(new Bird().getWeight() === 15); Your `getWeight` function should return the private variable `weight`. ```js -assert(code.match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); +assert(__helpers.removeJSComments(code).match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md index 898566bb3e6..afe934eda65 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md @@ -29,13 +29,13 @@ Print both properties of the `dog` object to your console. Your code should use `console.log` to print the value for the `name` property of the `dog` object. ```js -assert(/console.log\(.*dog\.name.*\)/g.test(code)); +assert(/console.log\(.*dog\.name.*\)/g.test(__helpers.removeJSComments(code))); ``` Your code should use `console.log` to print the value for the `numLegs` property of the `dog` object. ```js -assert(/console.log\(.*dog\.numLegs.*\)/g.test(code)); +assert(/console.log\(.*dog\.numLegs.*\)/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md index 1acb47ab0ea..14a4b133715 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md @@ -53,7 +53,7 @@ assert(typeof myHouse.numBedrooms === 'number'); You should verify that `myHouse` is an instance of `House` using the `instanceof` operator. ```js -assert(/myHouse\s*instanceof\s*House/.test(code)); +assert(/myHouse\s*instanceof\s*House/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md index 54896bca102..3be5622cf5d 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md @@ -75,7 +75,7 @@ assert(!myRegex.test('EleanorRoosevelt')); You should use `.test()` to test the regex. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` Your result should return `true`. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md index 39672d1e78f..57435882bf1 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md @@ -51,7 +51,7 @@ assert(codingRegex.source === 'coding'); You should use the `.match()` method. ```js -assert(code.match(/\.match\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.match\(.*\)/)); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md index 3306cfb8c76..0df9ec3ba3b 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md @@ -31,7 +31,7 @@ Complete the regex `unRegex` so that it matches the strings `run`, `sun`, `fun`, You should use the `.test()` method. ```js -assert(code.match(/\.test\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.test\(.*\)/)); ``` You should use the wildcard character in your regex `unRegex` diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index fdd712a81ff..edbaaaf5134 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -52,7 +52,7 @@ assert(!waldoRegex.test('Somewhere is hiding in this text.')); You should perform a literal string match with your regex. ```js -assert(!/\/.*\/i/.test(code)); +assert(!/\/.*\/i/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md index bb35ed6c031..7e6c1eb0a7a 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md @@ -27,13 +27,13 @@ assert(result === 'Hello, World!'); Your solution should not use the `String.prototype.trim()` method. ```js -assert(!code.match(/\.?[\s\S]*?trim/)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?trim/)); ``` The `result` variable should not directly be set to a string ```js -assert(!code.match(/result\s*=\s*["'`].*?["'`]/)); +assert(!__helpers.removeJSComments(code).match(/result\s*=\s*["'`].*?["'`]/)); ``` The value of the `hello` variable should not be changed. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md index 6b1d6b05924..e4b529c5eca 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md @@ -37,7 +37,7 @@ Write a regex `fixRegex` using three capture groups that will search for each wo You should use `.replace()` to search and replace. ```js -assert(code.match(/\.replace\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.replace\(.*\)/)); ``` Your regex should change the string `one two three` to the string `three two one` @@ -49,7 +49,7 @@ assert(result === 'three two one'); You should not change the last line. ```js -assert(code.match(/result\s*=\s*str\.replace\(.*?\)/)); +assert(__helpers.removeJSComments(code).match(/result\s*=\s*str\.replace\(.*?\)/)); ``` `fixRegex` should use at least three capture groups. diff --git a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md index dddb321ec55..5a04d2617d9 100644 --- a/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md +++ b/curriculum/challenges/swahili/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md @@ -31,7 +31,7 @@ Apply the regex `myRegex` on the string `myString` using the `.test()` method. You should use `.test()` to test the regex. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` Your result should return `true`. diff --git a/curriculum/challenges/swahili/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md b/curriculum/challenges/swahili/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md index 51b79b1a67f..7d706878915 100644 --- a/curriculum/challenges/swahili/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md +++ b/curriculum/challenges/swahili/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md @@ -15,12 +15,9 @@ You should have `if number >= 10:` within the `for` loop. ```js ({ - test: () => { - const transformedCode = code.replace(/\r/g, ""); - const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); - const { function_body } = verify_card_number; - - assert.match(function_body, /if +number +>= +10:/); + test: () => + { + assert(runPython(`_Node(_code).find_function("verify_card_number").find_for_loops()[1].find_ifs()[0].find_conditions()[0].is_equivalent("number >= 10")`)); } }) ``` diff --git a/curriculum/challenges/swahili/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md b/curriculum/challenges/swahili/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md index 67ac4c0e173..9127855203d 100644 --- a/curriculum/challenges/swahili/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md +++ b/curriculum/challenges/swahili/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md @@ -115,7 +115,10 @@ from importlib import reload reload(probability_calculator) probability_calculator.random.seed(95) -def test_hat_draw(self): + +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw(self): hat = probability_calculator.Hat(red=5,blue=2) actual = hat.draw(2) expected = ['blue', 'red'] @@ -140,6 +143,49 @@ t.result.wasSuccessful() }); ``` +The `draw` method should behave correctly when the number of balls to extract is bigger than the number of balls in the hat. + +```js +({ + test: () => { + pyodide.FS.writeFile("/home/pyodide/probability_calculator.py", code); + pyodide.FS.writeFile( + "/home/pyodide/test_module.py", + ` +import unittest +import probability_calculator +from importlib import reload + +reload(probability_calculator) + +probability_calculator.random.seed(95) +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw_2(self): + hat = probability_calculator.Hat(yellow=5,red=1,green=3,blue=9,test=1) + actual = hat.draw(20) + expected = ['yellow', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'green', 'green', 'green', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'test'] + self.assertEqual(actual, expected, 'Expected hat draw to return all items from hat contents.') + actual = len(hat.contents) + expected = 0 + self.assertEqual(actual, expected, 'Expected hat draw to leave no items in contents.') + ` + ); + const testCode = ` +from unittest import main +import test_module +from importlib import reload + +reload(test_module) +t = main(module='test_module', exit=False) +t.result.wasSuccessful() +`; + const out = __pyodide.runPython(testCode); + assert(out); + }, +}); +``` + The `experiment` method should return a different probability. @@ -221,7 +267,8 @@ class Hat: def draw(self, number): drawn = [] if number >= len(self.contents): - return self.contents + drawn.extend(self.contents) + self.contents = [] else: for i in range(number): drawn.append( @@ -229,8 +276,7 @@ class Hat: ) return drawn -def experiment(hat, expected_balls, num_balls_drawn, num_experiments): - +def experiment(hat, expected_balls, num_balls_drawn, num_experiments): expected_balls_list = [] drawn_list = [] success = 0 @@ -248,12 +294,7 @@ def experiment(hat, expected_balls, num_balls_drawn, num_experiments): except: continue if len(exp_ball_list_copy) == 0: - success += 1 - - - - - probability = success/num_experiments - + success += 1 + probability = success/num_experiments return probability ``` diff --git a/curriculum/challenges/swahili/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md b/curriculum/challenges/swahili/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md index 19ea0d3c265..397f8d13d67 100644 --- a/curriculum/challenges/swahili/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md +++ b/curriculum/challenges/swahili/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md @@ -48,9 +48,9 @@ The initial declaration of the `homeworkStack` should not be changed. ```js assert( - code.match(/=/g).length === 1 && + __helpers.removeJSComments(code).match(/=/g).length === 1 && /homeworkStack\s*=\s*\["BIO12"\s*,\s*"HIS80"\s*,\s*"MAT122"\s*,\s*"PSY44"\]/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/swahili/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md b/curriculum/challenges/swahili/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md index 0fa320c4370..f6e4b96a1e8 100644 --- a/curriculum/challenges/swahili/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md +++ b/curriculum/challenges/swahili/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md @@ -2,7 +2,6 @@ id: 5f356ed60a5decd94ab66986 title: Hatua ya 22 challengeType: 0 -removeComments: false dashedName: step-22 --- diff --git a/curriculum/challenges/swahili/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md b/curriculum/challenges/swahili/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md index 0fdf667cb6e..813d0b78cb4 100644 --- a/curriculum/challenges/swahili/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md +++ b/curriculum/challenges/swahili/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md @@ -40,15 +40,15 @@ assert(canvasFilter === 'blur(2px)'); ## --seed-contents-- ```css +--fcc-editable-region-- .canvas { width: 500px; height: 600px; background-color: #4d0f00; overflow: hidden; ---fcc-editable-region-- ---fcc-editable-region-- } +--fcc-editable-region-- .frame { border: 50px solid black; diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md index 069f325867b..40d5daebd58 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md @@ -7,7 +7,7 @@ dashedName: step-55 # --description-- -Inside, the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. +Inside the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. Now, you should see a category displayed underneath each post topic. diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md index eca279b42fe..b69803b87d0 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md @@ -7,9 +7,11 @@ dashedName: step-43 # --description-- -Notice how the `10` value is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. +Notice how the number `10` is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the numbers values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. -To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. Leave the function empty for now. +To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. The parameters of `a` and `b` represent the number values in the array that will be sorted. + +Leave the function empty for now. # --hints-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md index d253c95b6c6..ee57c994e55 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md @@ -26,7 +26,7 @@ assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\( Your callback function should return `a - b`. ```js -assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+a\s*-\s*b\s*;?\s*}\s*\)/); +assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+(?:parseInt)?(?:Number)?\(?a\)?\s*-\s*(?:parseInt)?(?:Number)?\(?b\)?\s*;?\s*}\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b514741ae01..b1b54dda895 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -11,6 +11,8 @@ In your `evalFormula`, declare an `idToText` arrow function which takes an `id` Your `idToText` function should return the result of calling `.find()` on the `cells` array with a callback function that takes an `cell` parameter and returns `cell.id === id`. +Both of your functions should use implicit returns. + # --hints-- You should declare an `idToText` variable in your `evalFormula` function. diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md index 57110b715a9..37487b1771c 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md @@ -23,13 +23,7 @@ Open up the console to see the result. # --hints-- -You should call `.repeat()` on your two `" "` strings. - -```js -assert.lengthOf(code.match(/" ".repeat/g), 2); -``` - -Your `" "` strings should be repeated `rowCount - rowNumber` times. +You should call `.repeat()` on your `" "` strings to repeat them `rowCount - rowNumber` times. ```js assert.equal(padRow(1, 3), " # "); diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md index 3306b1a478b..4170d3bd12b 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md @@ -3,7 +3,6 @@ id: 660f3ce51f70571e1c5227c8 title: Step 69 challengeType: 1 dashedName: step-69 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md index ea0a831040f..7a939244a7c 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md @@ -3,7 +3,6 @@ id: 660f3dd626be3a1ffe27e5d1 title: Step 70 challengeType: 1 dashedName: step-70 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md index e30d808ccb6..b676558ec74 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md @@ -3,7 +3,6 @@ id: 660f4f79e2a82a4e92290f44 title: Step 101 challengeType: 1 dashedName: step-101 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md index dc683e61ce5..3f088de2c91 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md @@ -3,7 +3,6 @@ id: 660f53ad3d39175c5d4335ac title: Step 108 challengeType: 1 dashedName: step-108 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md new file mode 100644 index 00000000000..286128cc2cf --- /dev/null +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md @@ -0,0 +1,74 @@ +--- +id: 662693f82c91a66be46c881b +title: Step 1 +challengeType: 1 +dashedName: step-1 +--- + +# --description-- + +A teacher has finished grading their students' tests and needs your help to calculate the average score for the class. + +Complete the `getAverage` function which takes in an array of test scores and returns the average score. + +The average is calculated by adding up all the scores and dividing by the total number of scores. + +```js +average = sum of all scores / total number of scores +``` + +A couple of function calls have been provided for you so you can test out your code. + +**Tips** + +- You can use a loop to iterate over the `scores` array and add up all the scores. +- You can use the `length` property to get the total number of scores. + +# --hints-- + +Your `getAverage` function should return a number. + +```js +assert.strictEqual(typeof getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 'number'); +``` + +`getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])` should return `71.7`. + +```js +assert.strictEqual(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 71.7); +``` + +`getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])` should return `85.4`. + +```js +assert.strictEqual(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]), 85.4); +``` + +`getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100])` should return `92.4`. + +```js +assert.strictEqual(getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100]), 92.4); +``` + +Your `getAverage` function should return the average score of the test scores. + +```js +assert.strictEqual(getAverage([52, 56, 60, 65, 70, 75, 80, 85, 90, 95]), 72.8); +assert.strictEqual(getAverage([45, 50, 55, 60, 65, 70, 75, 80, 85, 90]), 67.5); +assert.strictEqual(getAverage([38, 42, 46, 50, 54, 58, 62, 66, 70, 74]), 56); +``` + +# --seed-- + +## --seed-contents-- + +```js +--fcc-editable-region-- +function getAverage(scores) { + +} + +console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])); +console.log(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md new file mode 100644 index 00000000000..f7e9253a5a5 --- /dev/null +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md @@ -0,0 +1,104 @@ +--- +id: 6626a060c4006f793e10cb33 +title: Step 2 +challengeType: 1 +dashedName: step-2 +--- + +# --description-- + +Now the teacher needs your help converting the student score to a letter grade. + +Complete the `getGrade` function that takes a number `score` as a parameter. Your function should return a string representing a letter grade based on the score. + +Here are the scores and their corresponding letter grades: + +| Score Range | Grade | +| ----------- | ------- | +| `100` | `"A++"` | +| `90 - 99` | `"A"` | +| `80 - 89` | `"B"` | +| `70 - 79` | `"C"` | +| `60 - 69` | `"D"` | +| `0 - 59` | `"F"` | + + +**Tips** + +- Remember that you learned about conditional statements(`if`, `else if`, and `else`). +- Remember that you learned about comparison operators (`>`, `<`, `>=`, `<=`, `===`). + +# --hints-- + +Your `getGrade` function should return `"A++"` if the score is `100`. + +```js +assert.strictEqual(getGrade(100), "A++"); +``` + +Your `getGrade` function should return `"A"` if the score is `94`. + +```js +assert.strictEqual(getGrade(94), "A"); +``` + +Your `getGrade` function should return `"B"` if the score is between `80` and `89`. + +```js +assert.strictEqual(getGrade(80), "B"); +assert.strictEqual(getGrade(83), "B"); +assert.strictEqual(getGrade(88), "B"); +``` + +Your `getGrade` function should return `"C"` if the score is `78`. + +```js +assert.strictEqual(getGrade(75), "C"); +``` + +Your `getGrade` function should return `"D"` if the score is between `60` and `69`. + +```js +assert.strictEqual(getGrade(60), "D"); +assert.strictEqual(getGrade(63), "D"); +assert.strictEqual(getGrade(68), "D"); +``` + +Your `getGrade` function should return `"F"` if the score is `57`. + +```js +assert.strictEqual(getGrade(57), "F"); +``` + +Your `getGrade` function should return `"F"` if the score is between `0` and `59`. + +```js +assert.strictEqual(getGrade(0), "F"); +assert.strictEqual(getGrade(30), "F"); +assert.strictEqual(getGrade(43), "F"); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} +--fcc-editable-region-- +function getGrade(score) { + +} + +console.log(getGrade(96)); +console.log(getGrade(82)); +console.log(getGrade(56)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md new file mode 100644 index 00000000000..b168e1325fc --- /dev/null +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md @@ -0,0 +1,88 @@ +--- +id: 6626b4c58c027d86478ff5eb +title: Step 3 +challengeType: 1 +dashedName: step-3 +--- + +# --description-- + +The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an `"F"`. + +Complete the function `hasPassingGrade` that takes a student score as a parameter. Your function should return `true` if the student has a passing grade and `false` if they do not. + +**Tips** + +- Use the `getGrade` function to get the student's grade. Then check if the grade is passing or not. + +# --hints-- + +Your `hasPassingGrade` function should return a boolean value. + +```js +assert.strictEqual(typeof hasPassingGrade(100), "boolean"); +``` + +Your `hasPassingGrade` function should return `true` if the grade is an `"A"`. + +```js +assert.isTrue(hasPassingGrade(100)); +``` + +Your `hasPassingGrade` function should return `false` if the grade is an `"F"`. + +```js +assert.isFalse(hasPassingGrade(53)); +``` + +Your `hasPassingGrade` function should return `true` for all passing grades. + +```js +assert.isTrue(hasPassingGrade(87)); +assert.isTrue(hasPassingGrade(60)); +assert.isTrue(hasPassingGrade(73)); +assert.isTrue(hasPassingGrade(96)); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +--fcc-editable-region-- +function hasPassingGrade(score) { + +} + + +console.log(hasPassingGrade(100)); +console.log(hasPassingGrade(53)); +console.log(hasPassingGrade(87)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md new file mode 100644 index 00000000000..08ee3cea27b --- /dev/null +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md @@ -0,0 +1,143 @@ +--- +id: 6626b8dcf5057f896f948440 +title: Step 4 +challengeType: 1 +dashedName: step-4 +--- + +# --description-- + +Now that the teacher has all of the information they need, they want to be able to message the student with the results. + +Complete the `studentMsg` function with `totalScores` and `studentScore` for parameters. The function should return a string representing a message to the student. + +If the student passed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You passed the course. +``` + +If the student failed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You failed the course. +``` + +Replace `average-goes-here` with the average of the total scores. Replace `grade-goes-here` with the student's grade. + +**Tips** + +- Use the `getAverage` function to get the class average. +- Use the `getGrade` function to get the student's grade. +- Use string concatenation (`+`) to build the message. +- Be careful with the punctuation and spaces in the message. + +# --hints-- + +Your function call of `studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)` should return the following message: `"Class average: 71.7. Your grade: F. You failed the course."`. + +```js +assert.strictEqual(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37), "Class average: 71.7. Your grade: F. You failed the course."); +``` + +Your function call of `studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)` should return the following message: `"Class average: 50.8. Your grade: A++. You passed the course."`. + +```js +assert.strictEqual(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100), "Class average: 50.8. Your grade: A++. You passed the course."); +``` + +Your `studentMsg` function should return a the correct message based on the student's score and the class average. + +```js +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 92), "Class average: 70.25. Your grade: A. You passed the course."); +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 57), "Class average: 70.25. Your grade: F. You failed the course."); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +--fcc-editable-region-- +function studentMsg(totalScores, studentScore) { + +} +console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)); +--fcc-editable-region-- + +``` + + +# --solutions-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +function studentMsg(totalScores, studentScore) { + let average = getAverage(totalScores); + let grade = getGrade(studentScore); + + return `Class average: ${average}. Your grade: ${grade}. You ${ + hasPassingGrade(studentScore) ? "passed" : "failed" + } the course.`; +} + +``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md index 20cafa8da13..8697d78f6f1 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/confirm-the-ending.md @@ -87,7 +87,7 @@ assert(confirmEnding('Abstraction', 'action') === true); Ваш код не повинен використовувати вбудований метод `.endsWith()`, щоб розв’язати це завдання. ```js -assert(!/\.endsWith\(.*?\)\s*?;?/.test(code) && !/\['endsWith'\]/.test(code)); +assert(!/\.endsWith\(.*?\)\s*?;?/.test(__helpers.removeJSComments(code)) && !/\['endsWith'\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md index a560e4ff737..d51fc50429c 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/repeat-a-string-repeat-a-string.md @@ -51,7 +51,7 @@ assert(repeatStringNumTimes('abc', -2) === ''); Не використовуйте вбудований метод `repeat()`. ```js -assert(!/\.repeat/g.test(code)); +assert(!/\.repeat/g.test(__helpers.removeJSComments(code))); ``` `repeatStringNumTimes("abc", 0)` має повертати `""`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md index 481785a66e2..9a9ba63f410 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-items-using-splice.md @@ -53,19 +53,19 @@ assert.deepEqual( Функція `htmlColorNames` повинна використовувати метод `splice()` ```js -assert(/.splice/.test(code)); +assert(/.splice/.test(__helpers.removeJSComments(code))); ``` Не використовуйте `shift()` або `unshift()`. ```js -assert(!/shift|unshift/.test(code)); +assert(!/shift|unshift/.test(__helpers.removeJSComments(code))); ``` Не використовуйте дужкову нотацію масиву. ```js -assert(!/\[\d\]\s*=/.test(code)); +assert(!/\[\d\]\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md index 912f72b8df8..9b0ca808aac 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/add-key-value-pairs-to-javascript-objects.md @@ -85,8 +85,8 @@ assert(foods.strawberries === 27); ```js assert( - code.search(/let foods/) === -1 && - code.search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ + __helpers.removeJSComments(code).search(/let foods/) === -1 && + __helpers.removeJSComments(code).search(/const\s+foods\s*=\s*{\s*apples:\s*25,\s*oranges:\s*32,\s*plums:\s*28\s*};/ ) !== -1 ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md index f436ee5a2fa..c97296e95ca 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property.md @@ -27,7 +27,7 @@ users.hasOwnProperty('Alan'); ```js -assert(code.match(/users/gm).length <= 2) +assert(__helpers.removeJSComments(code).match(/users/gm).length <= 2) ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md index 3e035f58ba5..a40b2b7676f 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-an-array-with-the-spread-operator.md @@ -65,7 +65,7 @@ assert.deepEqual(copyMachine(['it works'], 3), [ Функція `copyMachine` повинна використовувати `spread operator` з масивом `arr` ```js -assert(code.match(/\.\.\.\s*arr/)); +assert(__helpers.removeJSComments(__helpers.removeJSComments(code)).match(/\.\.\.\s*arr/)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md index 60ad0695c95..58a533d6d84 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice.md @@ -38,7 +38,7 @@ assert.deepEqual( Функція `forecast` повинна використовувати метод `slice()` ```js -assert(/\.slice\(/.test(code)); +assert(/\.slice\(/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md index 56e2b7e93d8..4725bd7342e 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md @@ -51,7 +51,7 @@ for (const food in refrigerator) { ```js assert( - code.match( + __helpers.removeJSComments(code).match( /for\s*\(\s*(var|let|const)\s+[a-zA-Z_$]\w*\s+in\s+[a-zA-Z_$]\w*\s*\)/ ) ); diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md index 54be4211665..7f6541f0a5b 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.md @@ -61,7 +61,7 @@ assert(userActivity.data.online === 45); Налаштуйте властивість `online` за допомогою точкової або дужкової нотації. ```js -assert.strictEqual(code.search(/online: 45/), -1); +assert.strictEqual(__helpers.removeJSComments(code).search(/online: 45/), -1); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md index 713ea24ec80..d27a94f5bb4 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/remove-items-using-splice.md @@ -40,7 +40,7 @@ let newArray = array.splice(3, 2); ```js assert( - __helpers.removeWhiteSpace(code).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/constarr=\[2,4,5,1,7,5,2,1\];?/) ); ``` @@ -56,14 +56,14 @@ assert.strictEqual( Використайте метод `splice()` на `arr`. ```js -assert(__helpers.removeWhiteSpace(code).match(/arr\.splice\(/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(/)); ``` Метод splice має видалити елементи з `arr`, а не додавати додаткові елементи до `arr`. ```js assert( - !__helpers.removeWhiteSpace(code).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) + !__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/arr\.splice\(\d+,\d+,\d+.*\)/g) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md index fbfc23a9bb3..847b6ba2053 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/use-the-delete-keyword-to-remove-object-properties.md @@ -39,9 +39,9 @@ assert( ```js assert( - code.search(/oranges:/) !== -1 && - code.search(/plums:/) !== -1 && - code.search(/strawberries:/) !== -1 + __helpers.removeJSComments(code).search(/oranges:/) !== -1 && + __helpers.removeJSComments(code).search(/plums:/) !== -1 && + __helpers.removeJSComments(code).search(/strawberries:/) !== -1 ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md index bbd759168d9..de7499a278e 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/access-array-data-with-indexes.md @@ -54,7 +54,7 @@ assert( ```js assert( (function () { - if (code.match(/\s*=\s*myArray\[0\]/g)) { + if (__helpers.removeJSComments(code).match(/\s*=\s*myArray\[0\]/g)) { return true; } else { return false; diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md index 8f90e6e47f1..aed7b0759fc 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/access-multi-dimensional-arrays-with-indexes.md @@ -45,7 +45,7 @@ assert(myData === 8); Ви повинні використати дужкову нотацію, щоб зчитати правильне значення з `myArray`. ```js -assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(code))); +assert(/myData=myArray\[2\]\[1\]/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md index e547578022f..8f6cebfa4ff 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-nested-arrays.md @@ -54,7 +54,7 @@ assert(secondTree === 'pine'); Щоб отримати доступ до `myPlants`, використайте точкову та дужкову нотацію. ```js -assert(/=\s*myPlants\[1\].list\[1\]/.test(code)); +assert(/=\s*myPlants\[1\].list\[1\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md index 6d83b75ed6c..aedab9033fc 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-bracket-notation.md @@ -64,7 +64,7 @@ assert(drinkValue === 'water'); Ви повинні використати дужкову нотацію двічі ```js -assert(code.match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\s*?\[('|")[^'"]+\1\]/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md index 596cc5c9594..8bbe5b498cd 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-dot-notation.md @@ -60,7 +60,7 @@ assert(shirtValue === 'jersey'); Ви повинні використати точкову нотацію двічі ```js -assert(code.match(/testObj\.\w+/g).length > 1); +assert(__helpers.removeJSComments(code).match(/testObj\.\w+/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md index bfeff7d678c..f77cf31585a 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables.md @@ -56,19 +56,19 @@ assert(player === 'Montana'); Щоб отримати доступ до `testObj`, використайте дужкову нотацію ```js -assert(/testObj\s*?\[.*?\]/.test(code)); +assert(/testObj\s*?\[.*?\]/.test(__helpers.removeJSComments(code))); ``` Не присвоюйте значення `Montana` до змінної `player` напряму. ```js -assert(!code.match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); +assert(!__helpers.removeJSComments(code).match(/player\s*=\s*"|\'\s*Montana\s*"|\'\s*;/gi)); ``` Ви повинні використати змінну `playerNumber` у своїй дужковій нотації ```js -assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(code)); +assert(/testObj\s*?\[\s*playerNumber\s*\]/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md index ac9d6e01315..383a46e14ed 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/add-new-properties-to-a-javascript-object.md @@ -53,7 +53,7 @@ assert(myDog.bark !== undefined); Ви не повинні додавати `bark` до ініціалізації `myDog`. ```js -assert(!/bark[^\n]:/.test(code)); +assert(!/bark[^\n]:/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md index aa894db246e..4dd87c2ec96 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/add-two-numbers-with-javascript.md @@ -38,7 +38,7 @@ assert(sum === 20); Ви повинні використати оператор `+`. ```js -assert(/\+/.test(code)); +assert(/\+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md index 6b86d5d393c..e783764edbe 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/adding-a-default-option-in-switch-statements.md @@ -71,7 +71,7 @@ assert(switchOfStuff(4) === 'stuff'); Ви не повинні використовувати інструкції `if` чи `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Ви повинні використати інструкцію `default` @@ -83,7 +83,7 @@ assert(switchOfStuff('string-to-trigger-default-case') === 'stuff'); Ви повинні мати принаймні 3 інструкції `break` ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md index 512ea752f20..62d0e760fef 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/appending-variables-to-strings.md @@ -36,7 +36,7 @@ assert(typeof someAdjective !== 'undefined' && someAdjective.length > 2); Ви повинні додати `someAdjective` до `myStr`, використовуючи оператор `+=`. ```js -assert(code.match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*someAdjective\s*/).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md index ab793483eef..99d25ba628f 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another.md @@ -29,7 +29,7 @@ myNum = myVar; Не змінюйте код над зазначеним коментарем. ```js -assert(/var a;/.test(code) && /a = 7;/.test(code) && /var b;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code)) && /a = 7;/.test(__helpers.removeJSComments(code)) && /var b;/.test(__helpers.removeJSComments(code))); ``` `b` повинна мати значення `7`. @@ -41,7 +41,7 @@ assert(typeof b === 'number' && b === 7); `a` повинна бути присвоєною до `b` за допомогою `=`. ```js -assert(/b\s*=\s*a\s*/g.test(code)); +assert(/b\s*=\s*a\s*/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md index f393f85812e..298a36632f5 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/assignment-with-a-returned-value.md @@ -34,7 +34,7 @@ assert(processed === 2); Ви повинні присвоїти `processArg` до `processed` ```js -assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(code)); +assert(/processed\s*=\s*processArg\(\s*7\s*\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md index 9a7e62728d6..aa8b7e5b85e 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/chaining-if-else-statements.md @@ -39,19 +39,19 @@ if (condition1) { Ви повинні мати принаймні 4 інструкції `else` ```js -assert(code.match(/else/g).length > 3); +assert(__helpers.removeJSComments(code).match(/else/g).length > 3); ``` Ви повинні мати принаймні 4 інструкції `if` ```js -assert(code.match(/if/g).length > 3); +assert(__helpers.removeJSComments(code).match(/if/g).length > 3); ``` Ви повинні мати принаймні 1 інструкцію `return` ```js -assert(code.match(/return/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/return/g).length >= 1); ``` `testSize(0)` має повертати рядок `Tiny` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md index 4bc8c53274f..b7d433922a1 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code.md @@ -2,7 +2,6 @@ id: bd7123c9c441eddfaeb4bdef title: Коментування коду JavaScript challengeType: 1 -removeComments: false videoUrl: 'https://scrimba.com/c/c7ynnTp' forumTopicId: 16783 dashedName: comment-your-javascript-code diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md index 27614744c38..9c5c6a3a041 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator.md @@ -58,7 +58,7 @@ assert(testEqual('12') === 'Equal'); Ви повинні використати оператор `==` ```js -assert(code.match(/==/g) && !code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/==/g) && !__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md index 1ce8b4ba707..c3b47eb8606 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-operator.md @@ -73,7 +73,7 @@ assert(testGreaterThan(150) === 'Over 100'); Ви повинні використати оператор `>` принаймні двічі ```js -assert(code.match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md index 8f46ad3aa16..d22e7dfce33 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-greater-than-or-equal-to-operator.md @@ -73,7 +73,7 @@ assert(testGreaterOrEqual(21) === '20 or Over'); Ви повинні використати оператор `>=` принаймні двічі ```js -assert(code.match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*>=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md index d9c699d3179..1edff5e07d7 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-inequality-operator.md @@ -60,7 +60,7 @@ assert(testNotEqual('bob') === 'Not Equal'); Ви повинні використати оператор `!=` ```js -assert(code.match(/(?!!==)!=/)); +assert(__helpers.removeJSComments(code).match(/(?!!==)!=/)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md index 3c3cf7c0f89..1082b53c318 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-operator.md @@ -66,7 +66,7 @@ assert(testLessThan(99) === '55 or Over'); Ви повинні використати оператор `<` принаймні двічі ```js -assert(code.match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md index 2b1a0587690..57a3d4e813e 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-less-than-or-equal-to-operator.md @@ -72,7 +72,7 @@ assert(testLessOrEqual(55) === 'More Than 24'); Ви повинні використати оператор `<=` принаймні двічі ```js -assert(code.match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); +assert(__helpers.removeJSComments(code).match(/val\s*<=\s*('|")*\d+('|")*/g).length > 1); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md index 212fa0033c5..238d756ac19 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-equality-operator.md @@ -49,7 +49,7 @@ assert(testStrict('7') === 'Not Equal'); Ви повинні використати оператор `===` ```js -assert(code.match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*===\s*\d+)|(\d+\s*===\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md index 9317e7b016a..1575d224145 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-strict-inequality-operator.md @@ -52,7 +52,7 @@ assert(testStrictNotEqual('bob') === 'Not Equal'); Ви повинні використати оператор `!==` ```js -assert(code.match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); +assert(__helpers.removeJSComments(code).match(/(val\s*!==\s*\d+)|(\d+\s*!==\s*val)/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md index fece330ca09..6746f0316d8 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-and-operator.md @@ -40,13 +40,13 @@ return "No"; Ви повинні використати оператор `&&` лише раз ```js -assert(code.match(/&&/g).length === 1); +assert(__helpers.removeJSComments(code).match(/&&/g).length === 1); ``` Ви повинні мати лише одну інструкцію `if` ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalAnd(0)` має повертати рядок `No` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md index 7fd93c48805..b4b54f8a864 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator.md @@ -43,13 +43,13 @@ return "Yes"; Ви повинні використати оператор `||` лише раз ```js -assert(code.match(/\|\|/g).length === 1); +assert(__helpers.removeJSComments(code).match(/\|\|/g).length === 1); ``` Ви повинні мати лише одну інструкцію `if` ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` `testLogicalOr(0)` має повертати рядок `Outside` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md index 04ffa2f3741..62354965a7e 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-addition.md @@ -54,16 +54,16 @@ assert(c === 19); Ви повинні використати оператор `+=` для кожної змінної. ```js -assert(code.match(/\+=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\+=/g).length === 3); ``` Не змінюйте код над зазначеним коментарем. ```js assert( - /let a = 3;/.test(code) && - /let b = 17;/.test(code) && - /let c = 12;/.test(code) + /let a = 3;/.test(__helpers.removeJSComments(code)) && + /let b = 17;/.test(__helpers.removeJSComments(code)) && + /let c = 12;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md index eada8dd7588..a6cd1e28a53 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-division.md @@ -48,16 +48,16 @@ assert(c === 3); Ви повинні використати оператор `/=` для кожної змінної. ```js -assert(code.match(/\/=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\/=/g).length === 3); ``` Не змінюйте код над зазначеним коментарем. ```js assert( - /let a = 48;/.test(code) && - /let b = 108;/.test(code) && - /let c = 33;/.test(code) + /let a = 48;/.test(__helpers.removeJSComments(code)) && + /let b = 108;/.test(__helpers.removeJSComments(code)) && + /let c = 33;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md index 3dfe34fafe2..d1ccfb4a657 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-multiplication.md @@ -48,16 +48,16 @@ assert(c === 46); Ви повинні використати оператор `*=` для кожної змінної. ```js -assert(code.match(/\*=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/\*=/g).length === 3); ``` Не змінюйте код над зазначеним коментарем. ```js assert( - /let a = 5;/.test(code) && - /let b = 12;/.test(code) && - /let c = 4\.6;/.test(code) + /let a = 5;/.test(__helpers.removeJSComments(code)) && + /let b = 12;/.test(__helpers.removeJSComments(code)) && + /let c = 4\.6;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md index 736bff9b8e7..65945524c46 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/compound-assignment-with-augmented-subtraction.md @@ -48,14 +48,14 @@ assert(c === 2); Ви повинні використати оператор `-=` для кожної змінної. ```js -assert(code.match(/-=/g).length === 3); +assert(__helpers.removeJSComments(code).match(/-=/g).length === 3); ``` Не змінюйте код над зазначеним коментарем. ```js assert( - /let a = 11;/.test(code) && /let b = 9;/.test(code) && /let c = 3;/.test(code) + /let a = 11;/.test(__helpers.removeJSComments(code)) && /let b = 9;/.test(__helpers.removeJSComments(code)) && /let c = 3;/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md index 2cf9421a5bf..7bdf31db24d 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-plus-operator.md @@ -47,19 +47,19 @@ assert(myStr === 'This is the start. This is the end.'); Ви повинні використати оператор `+`, щоб побудувати `myStr`. ```js -assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g)); +assert(__helpers.removeJSComments(code).match(/(["']).*\1\s*\+\s*(["']).*\2/g)); ``` Ви повинні використати ключове слово `const`, щоб створити `myStr`. ```js -assert(/const\s+myStr/.test(code)); +assert(/const\s+myStr/.test(__helpers.removeJSComments(code))); ``` Ви повинні присвоїти результат до змінної `myStr`. ```js -assert(/myStr\s*=/.test(code)); +assert(/myStr\s*=/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md index 9c011c5484e..5c67f6c7f08 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/concatenating-strings-with-the-plus-equals-operator.md @@ -43,7 +43,7 @@ assert(myStr === 'This is the first sentence. This is the second sentence.'); Ви повинні використати оператор `+=`, щоб побудувати `myStr`. ```js -assert(code.match(/myStr\s*\+=\s*(["']).*\1/g)); +assert(__helpers.removeJSComments(code).match(/myStr\s*\+=\s*(["']).*\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md index 0131d24234f..df7d9e9201f 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/constructing-strings-with-variables.md @@ -35,7 +35,7 @@ assert(typeof myName !== 'undefined' && myName.length > 2); Ви повинні використати два оператори `+`, щоб побудувати `myStr` з `myName` всередині. ```js -assert(code.match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); +assert(__helpers.removeJSComments(code).match(/["']\s*\+\s*myName\s*\+\s*["']/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md index 641ce9191bf..ff97d029eb4 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/count-backwards-with-a-for-loop.md @@ -34,13 +34,13 @@ for (let i = 10; i > 0; i -= 2) { Ви повинні використати цикл `for`. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` Ви повинні використати метод масиву `push`. ```js -assert(code.match(/myArray.push/)); +assert(__helpers.removeJSComments(code).match(/myArray.push/)); ``` `myArray` має дорівнювати `[9, 7, 5, 3, 1]`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md index 1e60d618fb7..4dbea927f22 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/declare-javascript-variables.md @@ -37,7 +37,7 @@ var ourName; Ви повинні оголосити `myName` з ключовим словом `var`, закінчуючи крапкою з комою ```js -assert(/var\s+myName\s*;/.test(code)); +assert(/var\s+myName\s*;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md index 07d07c3a823..9ebc9f8e456 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/decrement-a-number-with-javascript.md @@ -38,25 +38,25 @@ assert(myVar === 10); `myVar = myVar - 1;` потрібно змінити. ```js -assert(!code.match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*myVar\s*[-]\s*1.*?;?/)); ``` Ви не повинні присвоювати `10` до `myVar`. ```js -assert(!code.match(/myVar\s*=\s*10.*?;?/)); +assert(!__helpers.removeJSComments(code).match(/myVar\s*=\s*10.*?;?/)); ``` Ви повинні використати оператор `--` на `myVar`. ```js -assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(code)); +assert(/[-]{2}\s*myVar|myVar\s*[-]{2}/.test(__helpers.removeJSComments(code))); ``` Не змінюйте код над зазначеним коментарем. ```js -assert(/let myVar = 11;/.test(code)); +assert(/let myVar = 11;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md index 5c91abf9821..37ce7078a17 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/delete-properties-from-a-javascript-object.md @@ -55,7 +55,7 @@ assert(typeof myDog === 'object' && myDog.tails === undefined); Ви не повинні змінювати налаштування `myDog`. ```js -assert(code.match(/"tails": 1/g).length > 0); +assert(__helpers.removeJSComments(code).match(/"tails": 1/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md index 9dc942e0d5b..65e1a397180 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-decimal-by-another-with-javascript.md @@ -26,13 +26,13 @@ assert(quotient === 2.2); Ви повинні використати оператор `/`, щоб поділити 4.4 на 2 ```js -assert(/4\.40*\s*\/\s*2\.*0*/.test(code)); +assert(/4\.40*\s*\/\s*2\.*0*/.test(__helpers.removeJSComments(code))); ``` Змінна-частка повинна бути присвоєна лише раз ```js -assert(code.match(/quotient\s*=/g).length === 1); +assert(__helpers.removeJSComments(code).match(/quotient\s*=/g).length === 1); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md index 1ee29e9c14d..046f5a42ddb 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/divide-one-number-by-another-with-javascript.md @@ -35,7 +35,7 @@ assert(quotient === 2); Ви повинні використати оператор `/`. ```js -assert(/\d+\s*\/\s*\d+/.test(code)); +assert(/\d+\s*\/\s*\d+/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md index f565a0baa10..cb45f30e704 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/escaping-literal-quotes-in-strings.md @@ -36,7 +36,7 @@ I am a "double quoted" string inside "double quotes". Ви повинні використати дві подвійні лапки (`"`) та чотири екрановані подвійні лапки (`\"`). ```js -assert(code.match(/\\"/g).length === 4 && code.match(/[^\\]"/g).length === 2); +assert(__helpers.removeJSComments(code).match(/\\"/g).length === 4 && __helpers.removeJSComments(code).match(/[^\\]"/g).length === 2); ``` Змінна `myStr` повинна містити рядок `I am a "double quoted" string inside "double quotes".` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md index 780d9609bfe..c85ce428681 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.md @@ -29,8 +29,8 @@ console.log("Alan Peter".length); ```js assert( - code.match(/let lastNameLength = 0;/) && - code.match(/const lastName = "Lovelace";/) + __helpers.removeJSComments(code).match(/let lastNameLength = 0;/) && + __helpers.removeJSComments(code).match(/const lastName = "Lovelace";/) ); ``` @@ -43,7 +43,7 @@ assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8); Ви повинні отримати довжину `lastName`, використовуючи `.length`, ось так: `lastName.length`. ```js -assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/)); +assert(__helpers.removeJSComments(code).match(/=\s*lastName\.length/g) && !__helpers.removeJSComments(code).match(/lastName\s*=\s*8/)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md index 41afe4d35e6..25782c44a7b 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/finding-a-remainder-in-javascript.md @@ -39,7 +39,7 @@ dashedName: finding-a-remainder-in-javascript Змінна `remainder` повинна бути ініціалізованою ```js -assert(/(const|let|var)\s+?remainder/.test(code)); +assert(/(const|let|var)\s+?remainder/.test(__helpers.removeJSComments(code))); ``` Значенням `remainder` повинне бути `2` @@ -51,7 +51,7 @@ assert(remainder === 2); Ви повинні використати оператор `%` ```js -assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code)); +assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md index 2a71bd138ca..43af2f9377e 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-fractions-with-javascript.md @@ -36,7 +36,7 @@ assert((randomFraction() + '').match(/\./g)); Ви повинні використати `Math.random`, щоб згенерувати випадкове десяткове число. ```js -assert(code.match(/Math\.random/g).length >= 0); +assert(__helpers.removeJSComments(code).match(/Math\.random/g).length >= 0); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md index 063957aedf9..269fe47d8fc 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-with-javascript.md @@ -46,22 +46,22 @@ assert( Ви повинні використати `Math.random`, щоб згенерувати випадкове число. ```js -assert(code.match(/Math.random/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.random/g).length >= 1); ``` Ви повинні помножити результат `Math.random` на 10, щоб зробити його числом в діапазоні від 0 до 9. ```js assert( - code.match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || - code.match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) + __helpers.removeJSComments(code).match(/\s*?Math.random\s*?\(\s*?\)\s*?\*\s*?10[\D]\s*?/g) || + __helpers.removeJSComments(code).match(/\s*?10\s*?\*\s*?Math.random\s*?\(\s*?\)\s*?/g) ); ``` Ви повинні використати `Math.floor`, щоб видалити десяткову частину числа. ```js -assert(code.match(/Math.floor/g).length >= 1); +assert(__helpers.removeJSComments(code).match(/Math.floor/g).length >= 1); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md index 43a1aa4aef2..2209eabbd1d 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/generate-random-whole-numbers-within-a-range.md @@ -49,10 +49,10 @@ assert(randomRange(0, 1) % 1 === 0); assert( (function () { if ( - code.match(/myMax/g).length > 1 && - code.match(/myMin/g).length > 2 && - code.match(/Math.floor/g) && - code.match(/Math.random/g) + __helpers.removeJSComments(code).match(/myMax/g).length > 1 && + __helpers.removeJSComments(code).match(/myMin/g).length > 2 && + __helpers.removeJSComments(code).match(/Math.floor/g) && + __helpers.removeJSComments(code).match(/Math.random/g) ) { return true; } else { diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md index 43ae68cd8ec..50e0bfdb00d 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/global-scope-and-functions.md @@ -36,7 +36,7 @@ assert(myGlobal === 10); `myGlobal` потрібно оголосити, використовуючи ключове слово `let` або `const` ```js -assert(/(let|const)\s+myGlobal/.test(code)); +assert(/(let|const)\s+myGlobal/.test(__helpers.removeJSComments(code))); ``` `oopsGlobal` повинна бути глобальною змінною і мати значення `5` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md index e82b4a9bd8a..f74c0c37e33 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/global-vs.-local-scope-in-functions.md @@ -45,7 +45,7 @@ assert(myOutfit() === 'sweater'); Ви не повинні змінювати інструкцію повернення. ```js -assert(/return outerWear/.test(code)); +assert(/return outerWear/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md index 851afb435d0..32223c0cca4 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript.md @@ -39,20 +39,20 @@ assert(myVar === 88); ```js assert( - /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(code) + /let\s*myVar\s*=\s*87;\s*\/*.*\s*([+]{2}\s*myVar|myVar\s*[+]{2})/.test(__helpers.removeJSComments(code)) ); ``` Ви повинні використати оператор `++`. ```js -assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(code)); +assert(/[+]{2}\s*myVar|myVar\s*[+]{2}/.test(__helpers.removeJSComments(code))); ``` Не змінюйте код над зазначеним коментарем. ```js -assert(/let myVar = 87;/.test(code)); +assert(/let myVar = 87;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md index d4beb352c44..d0cc9a4f265 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md @@ -26,7 +26,7 @@ var myVar = 0; Ви повинні ініціалізувати `a` зі значенням `9`. ```js -assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code)); +assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md index e1c34ec7a0e..5c17eeeabfd 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-if-statements.md @@ -30,20 +30,20 @@ if (num > 15) { Ви повинні мати принаймні дві інструкції `else` ```js -assert(code.match(/else/g).length > 1); +assert(__helpers.removeJSComments(code).match(/else/g).length > 1); ``` Ви повинні мати принаймні дві інструкції `if` ```js -assert(code.match(/if/g).length > 1); +assert(__helpers.removeJSComments(code).match(/if/g).length > 1); ``` Ви повинні мати початкові та кінцеві фігурні дужки для кожного блоку коду `if else`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s+if\s*\((.+)\)\s*\{[\s\S]+\}\s*else\s*\{[\s\S]+\s*\}/ ) ); diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md index d6800821a8d..5ba747264b1 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/introducing-else-statements.md @@ -28,13 +28,13 @@ if (num > 10) { Ви повинні мати лише одну інструкцію `if` у редакторі ```js -assert(code.match(/if/g).length === 1); +assert(__helpers.removeJSComments(code).match(/if/g).length === 1); ``` Ви повинні використати інструкцію `else` ```js -assert(/else/g.test(code)); +assert(/else/g.test(__helpers.removeJSComments(code))); ``` `testElse(4)` має повертати рядок `5 or Smaller` @@ -64,7 +64,7 @@ assert(testElse(10) === 'Bigger than 5'); Не змінюйте код над/під зазначеним коментарем. ```js -assert(/let result = "";/.test(code) && /return result;/.test(code)); +assert(/let result = "";/.test(__helpers.removeJSComments(code)) && /return result;/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md index 59075e8bc59..e32aa09053b 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-odd-numbers-with-a-for-loop.md @@ -32,7 +32,7 @@ for (let i = 0; i < 10; i += 2) { Ви повинні використати цикл `for`. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` має дорівнювати `[1, 3, 5, 7, 9]`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md index b938326d650..d38e36bf673 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-through-an-array-with-a-for-loop.md @@ -30,7 +30,7 @@ for (let i = 0; i < arr.length; i++) { `total` повинна бути оголошеною та ініціалізованою до 0. ```js -assert(code.match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s*?total\s*=\s*0.*?;?/)); ``` `total` має дорівнювати 20. @@ -42,13 +42,13 @@ assert(total === 20); Ви повинні використати цикл `for`, щоб перебрати `myArr`. ```js -assert(/for\s*\(/g.test(code) && /myArr\s*\[/g.test(code)); +assert(/for\s*\(/g.test(__helpers.removeJSComments(code)) && /myArr\s*\[/g.test(__helpers.removeJSComments(code))); ``` Не потрібно намагатися напряму присвоїти значення 20 до `total`. ```js -assert(!__helpers.removeWhiteSpace(code).match(/total[=+-]0*[1-9]+/gm)); +assert(!__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/total[=+-]0*[1-9]+/gm)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md index 2abd7dd87fc..c922c353749 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-do...while-loops.md @@ -56,7 +56,7 @@ do { Для цього завдання ви повинні використати цикл `do...while`. ```js -assert(code.match(/do/g)); +assert(__helpers.removeJSComments(code).match(/do/g)); ``` `myArray` має дорівнювати `[10]`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md index eadeb184de6..f97d085a9ca 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-for-loops.md @@ -44,7 +44,7 @@ for (let i = 0; i < 5; i++) { Ви повинні використати цикл `for`. ```js -assert(/for\s*\([^)]+?\)/.test(code)); +assert(/for\s*\([^)]+?\)/.test(__helpers.removeJSComments(code))); ``` `myArray` має дорівнювати `[1, 2, 3, 4, 5]`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md index 96d588f00b7..f841bd948cf 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops.md @@ -36,7 +36,7 @@ while (i < 5) { Ви повинні використати цикл `while`. ```js -assert(code.match(/while/g)); +assert(__helpers.removeJSComments(code).match(/while/g)); ``` `myArray` має дорівнювати `[5, 4, 3, 2, 1, 0]`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md index 8b125e10a07..e87563635f4 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/local-scope-and-functions.md @@ -48,7 +48,7 @@ assert.throws(declared, ReferenceError); ```js assert( /functionmyLocalScope\(\)\{.*(var|let|const)myVar[\s\S]*}/.test( - __helpers.removeWhiteSpace(code) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)) ) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md index 165a75feeec..264f1d1e3af 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/manipulate-arrays-with-pop.md @@ -47,7 +47,7 @@ assert( Ви повинні використати `pop()` на `myArray`. ```js -assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(code)); +assert(/removedFromMyArray\s*=\s*myArray\s*.\s*pop\s*(\s*)/.test(__helpers.removeJSComments(code))); ``` `removedFromMyArray` має містити лише `["cat", 2]`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md index 2263c7cbd2e..b0d53a83084 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/modify-array-data-with-indexes.md @@ -52,7 +52,7 @@ assert( ```js assert( (function () { - if (code.match(/myArray\[0\]\s*=\s*/g)) { + if (__helpers.removeJSComments(code).match(/myArray\[0\]\s*=\s*/g)) { return true; } else { return false; diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md index f432035e1e3..2fad1a4ed6f 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/multiple-identical-options-in-switch-statements.md @@ -94,13 +94,13 @@ assert(sequentialSizes(9) === 'High'); Ви не повинні використовувати інструкції `if` або `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Ви повинні мати дев’ять інструкцій `case` ```js -assert(code.match(/case/g).length === 9); +assert(__helpers.removeJSComments(code).match(/case/g).length === 9); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md index c7d89e0eddd..dcbcc2c1e3f 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-decimals-with-javascript.md @@ -28,7 +28,7 @@ assert(product === 5.0); Ви повинні використати оператор `*` ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md index 9883c9dccbc..e097b668eaf 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/multiply-two-numbers-with-javascript.md @@ -36,7 +36,7 @@ assert(product === 80); Ви повинні використати оператор `*`. ```js -assert(/\*/.test(code)); +assert(/\*/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md index 42473d5bff9..3ab5850701b 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/passing-values-to-functions-with-arguments.md @@ -60,7 +60,7 @@ assert(logOutput == 16); ```js assert( /functionWithArgs\([-+]?\d*\.?\d*,[-+]?\d*\.?\d*\)/.test( - code.replace(/\s/g, '') + __helpers.removeJSComments(code).replace(/\s/g, '') ) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md index 1907fedf4a3..2ec084cbffa 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/practice-comparing-different-values.md @@ -47,7 +47,7 @@ assert(compareEquality('20', 20) === 'Not Equal'); Ви повинні використати оператор `===` ```js -assert(code.match(/===/g)); +assert(__helpers.removeJSComments(code).match(/===/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md index 48033e9973b..cf9c7e74f30 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/quoting-strings-with-single-quotes.md @@ -47,7 +47,7 @@ const badStr = 'Finn responds, "Let's go!"'; ```js assert( - !/\\/g.test(code) && + !/\\/g.test(__helpers.removeJSComments(code)) && myStr.match( '\\s*\\s*Link\\s*\\s*' ) @@ -57,7 +57,7 @@ assert( Ви повинні мати дві одинарні лапки `'` та чотири подвійні лапки `"`. ```js -assert(code.match(/"/g).length === 4 && code.match(/'/g).length === 2); +assert(__helpers.removeJSComments(code).match(/"/g).length === 4 && __helpers.removeJSComments(code).match(/'/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md index 4b5c11b0be7..b4997f11e0b 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/replace-loops-using-recursion.md @@ -66,7 +66,7 @@ assert.equal(sum([2, 3, 4, 5], 3), 9); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md index 23d830b43e4..b7bf5af7a9b 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/replacing-if-else-chains-with-switch.md @@ -45,19 +45,19 @@ switch (val) { Ви не повинні використовувати інструкцію `else` в редакторі ```js -assert(!/else/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code))); ``` Ви не повинні використовувати інструкцію `if` в редакторі ```js -assert(!/if/g.test(code)); +assert(!/if/g.test(__helpers.removeJSComments(code))); ``` Ви повинні мати принаймні чотири інструкції `break` ```js -assert(code.match(/break/g).length >= 4); +assert(__helpers.removeJSComments(code).match(/break/g).length >= 4); ``` `chainToSwitch("bob")` має повертати рядок `Marley` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md index b49528afb10..8c03f6734c3 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/returning-boolean-values-from-functions.md @@ -52,7 +52,7 @@ assert(isLess(15, 10) === false); Ви не повинні використовувати інструкції `if` або `else` ```js -assert(!/if|else/g.test(code)); +assert(!/if|else/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md index 6f21afca4cb..d3016c4f750 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/selecting-from-many-options-with-switch-statements.md @@ -63,13 +63,13 @@ assert(caseInSwitch(4) === 'delta'); Ви не повинні використовувати інструкції `if` чи `else` ```js -assert(!/else/g.test(code) || !/if/g.test(code)); +assert(!/else/g.test(__helpers.removeJSComments(code)) || !/if/g.test(__helpers.removeJSComments(code))); ``` Ви повинні мати принаймні 3 інструкції `break` ```js -assert(code.match(/break/g).length > 2); +assert(__helpers.removeJSComments(code).match(/break/g).length > 2); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md index 0b87f73812c..5226ad692dc 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/storing-values-with-the-assignment-operator.md @@ -35,7 +35,7 @@ myVar = 5; Не змінюйте код над зазначеним коментарем. ```js -assert(/var a;/.test(code)); +assert(/var a;/.test(__helpers.removeJSComments(code))); ``` `a` повинна мати значення 7. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md index bc38eab3362..e05a38b24ab 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/subtract-one-number-from-another-with-javascript.md @@ -35,7 +35,7 @@ assert(difference === 12); Ви повинні відняти лише одне число від `45`. ```js -assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(code))); +assert(/difference=45-33;?/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md index 2674ca9871a..099e08d1cf3 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/understand-string-immutability.md @@ -40,7 +40,7 @@ assert(myStr === 'Hello World'); Не змінюйте код над зазначеним коментарем. ```js -assert(/myStr = "Jello World"/.test(code)); +assert(/myStr = "Jello World"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md index 669e194a131..65f231b7296 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-case-sensitivity-in-variables.md @@ -56,19 +56,19 @@ assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000); `studlyCapVar` повинна використовувати верблюдячийРегістр як в оголошенні, так і в присвоєнні. ```js -assert(code.match(/studlyCapVar/g).length === 2); +assert(__helpers.removeJSComments(code).match(/studlyCapVar/g).length === 2); ``` `properCamelCase` повинна використовувати верблюдячийРегістр як в оголошенні, так і в присвоєнні. ```js -assert(code.match(/properCamelCase/g).length === 2); +assert(__helpers.removeJSComments(code).match(/properCamelCase/g).length === 2); ``` `titleCaseOver` повинна використовувати верблюдячийРегістр як в оголошенні, так і в присвоєнні. ```js -assert(code.match(/titleCaseOver/g).length === 2); +assert(__helpers.removeJSComments(code).match(/titleCaseOver/g).length === 2); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md index 37bc887c1de..7602e2c6d2b 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/understanding-uninitialized-variables.md @@ -39,9 +39,9 @@ assert(!/undefined/.test(c) && c === 'I am a String!'); ```js assert( - /a = a \+ 1;/.test(code) && - /b = b \+ 5;/.test(code) && - /c = c \+ " String!";/.test(code) + /a = a \+ 1;/.test(__helpers.removeJSComments(code)) && + /b = b \+ 5;/.test(__helpers.removeJSComments(code)) && + /c = c \+ " String!";/.test(__helpers.removeJSComments(code)) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md index c636cd6b01f..400950f188c 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/updating-object-properties.md @@ -39,7 +39,7 @@ assert(/happy coder/gi.test(myDog.name)); Ви не повинні редагувати визначення `myDog`. ```js -assert(/"name": "Coder"/.test(code)); +assert(/"name": "Coder"/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md index 997e60c6b65..b01cd40a4d0 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-first-character-in-a-string.md @@ -41,7 +41,7 @@ assert(firstLetterOfLastName === 'L'); Ви повинні використати дужкову нотацію. ```js -assert(code.match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/firstLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md index 0abfd5d6737..f0caa97a84f 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(lastLetterOfLastName === 'e'); Ви повинні використати `.length`, щоб отримати останню літеру. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md index 4443cc2eae7..e5393534c0f 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-character-in-a-string.md @@ -39,7 +39,7 @@ assert(thirdLetterOfLastName === 'v'); Ви повинні використати дужкову нотацію. ```js -assert(code.match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); +assert(__helpers.removeJSComments(code).match(/thirdLetterOfLastName\s*=\s*lastName\s*\[\s*\d\s*\]/)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md index 3de96208d5d..34899d7a117 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-nth-to-last-character-in-a-string.md @@ -39,7 +39,7 @@ assert(secondToLastLetterOfLastName === 'c'); Ви повинні використати `.length`, щоб отримати передостанню літеру. ```js -assert(code.match(/\.length/g).length > 0); +assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md index 6784e1837e0..8731ceb7337 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-multiple-conditional-ternary-operators.md @@ -54,7 +54,7 @@ function findGreaterOrEqual(a, b) { `checkSign` має використовувати декілька умовних операторів ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?\s*?\?\s*?.+?\s*?:\s*?.+?/gi.test(__helpers.removeJSComments(code))); ``` `checkSign(10)` має повертати рядок `positive`. Зверніть увагу на те, що важливе написання з великої/малої літери diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md index d87ed8ace3f..bbf44676c17 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-countdown.md @@ -59,7 +59,7 @@ assert.deepStrictEqual(countdown(5), [5, 4, 3, 2, 1]); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md index 715ff7c72cc..b1c5641446c 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-recursion-to-create-a-range-of-numbers.md @@ -26,7 +26,7 @@ assert(Array.isArray(rangeOfNumbers(5, 10))); ```js assert( - !code.match(/for|while|forEach|map|filter|reduce/g) + !__helpers.removeJSComments(code).match(/for|while|forEach|map|filter|reduce/g) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md index fee28caf02f..cb8ef2fd4a2 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-conditional-ternary-operator.md @@ -42,7 +42,7 @@ function findGreater(a, b) { `checkEqual` має використовувати умовний оператор ```js -assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(code)); +assert(/.+?\s*?\?\s*?.+?\s*?:\s*?.+?/.test(__helpers.removeJSComments(code))); ``` `checkEqual(1, 2)` має повертати рядок `Not Equal` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md index e49820a220f..d7e0a809e57 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function-with-a-radix.md @@ -34,7 +34,7 @@ const a = parseInt("11", 2); `convertToInteger` має використовувати функцію `parseInt()` ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("10011")` має повертати число diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md index 03c161e9737..f8a921dbe9e 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/use-the-parseint-function.md @@ -26,7 +26,7 @@ const a = parseInt("007"); `convertToInteger` має використовувати функцію `parseInt()` ```js -assert(/parseInt/g.test(code)); +assert(/parseInt/g.test(__helpers.removeJSComments(code))); ``` `convertToInteger("56")` має повертати число diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md index ad69bc3ae3c..432b274c550 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/using-objects-for-lookups.md @@ -83,14 +83,14 @@ assert(typeof phoneticLookup('') === 'undefined'); Ви не повинні змінювати інструкцію `return` ```js -assert(code.match(/return\sresult;/)); +assert(__helpers.removeJSComments(code).match(/return\sresult;/)); ``` Ви не повинні використовувати інструкції `case`, `switch` або `if` ```js assert( - !/case|switch|if/g.test(code.replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) + !/case|switch|if/g.test(__helpers.removeJSComments(code).replace(/([/]{2}.*)|([/][*][^/*]*[*][/])/g, '')) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md index 3e7381b40ea..f71e28a0e1b 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/word-blanks.md @@ -53,7 +53,7 @@ assert( Ви не повинні напряму використовувати значення `dog`, `ran`, `big` або `quickly`, щоб створити `wordBlanks`. ```js -const newCode = removeAssignments(code); +const newCode = removeAssignments(__helpers.removeJSComments(code)); assert( !/dog/.test(newCode) && !/ran/.test(newCode) && diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md index e520c32e436..f825fbcd4d5 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions.md @@ -50,7 +50,7 @@ assert(testConsole()); ```js const functionStr = reusableFunction && __helpers.removeWhiteSpace(reusableFunction.toString()); -const codeWithoutFunction = __helpers.removeWhiteSpace(code).replace(/reusableFunction\(\)\{/g, ''); +const codeWithoutFunction = __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).replace(/reusableFunction\(\)\{/g, ''); assert(/reusableFunction\(\)/.test(codeWithoutFunction)); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md index 2024bbbde74..380af618b66 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-arguments-passed-in-the-wrong-order-when-calling-a-function.md @@ -25,7 +25,7 @@ assert(power == 8); Ваш код повинен використовувати правильний порядок аргументів для виклику функції `raiseToPower`. ```js -assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); +assert(__helpers.removeJSComments(code).match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md index df5d2e9e7a1..0679820593a 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-missing-open-and-closing-parenthesis-after-a-function-call.md @@ -37,7 +37,7 @@ assert(result == 9); Ваш код повинен викликати функцію `getNine`. ```js -assert(code.match(/getNine\(\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/getNine\(\)/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md index a3eec14a332..0edd4ae4240 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-misspelled-variable-and-function-names.md @@ -27,25 +27,25 @@ assert(netWorkingCapital === 2); У коді не повинно бути змінних з орфографічними помилками. ```js -assert(!code.match(/recievables/g)); +assert(!__helpers.removeJSComments(code).match(/recievables/g)); ``` Змінна `receivables` повинна бути правильно оголошеною та використаною. ```js -assert(code.match(/receivables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/receivables/g).length == 2); ``` У коді не повинно бути змінних з орфографічними помилками. ```js -assert(!code.match(/payable;/g)); +assert(!__helpers.removeJSComments(code).match(/payable;/g)); ``` Змінна `payables` повинна бути правильно оголошеною та використаною. ```js -assert(code.match(/payables/g).length == 2); +assert(__helpers.removeJSComments(code).match(/payables/g).length == 2); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md index b8b3c555b58..c21244ac218 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-mixed-usage-of-single-and-double-quotes.md @@ -37,13 +37,13 @@ const allSameQuotes = 'I\'ve had a perfectly wonderful evening, but this wasn\'t Ваш код повинен виправити лапки навколо значення `href` `#Home`, змінюючи або уникаючи їх. ```js -assert(code.match(//g)); +assert(__helpers.removeJSComments(code).match(//g)); ``` Ваш код повинен залишити подвійні лапки навколо цілого рядка. ```js -assert(code.match(/"

.*?<\/p>";/g)); +assert(__helpers.removeJSComments(code).match(/"

.*?<\/p>";/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md index 35bae1b6d1e..e270d0a3151 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-off-by-one-errors-when-using-indexing.md @@ -37,25 +37,25 @@ for (let k = 0; k < len; k++) { Ваш код повинен встановити початкову умову циклу так, щоб він починався з першого індексу. ```js -assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?=\s*?0\s*?;/g).length == 1); ``` Ваш код повинен виправити початкову умову циклу таким чином, щоб індекс починався з 0. ```js -assert(!code.match(/i\s?=\s*?1\s*?;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s?=\s*?1\s*?;/g)); ``` Ваш код повинен встановити кінцеву умову циклу так, щоб він закінчувався на останньому індексі. ```js -assert(code.match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*<\s*len\s*;|i\s*<=\s*len\s*-\s*1\s*;/g).length == 1); ``` Ваш код повинен встановити кінцеву умову циклу таким чином, щоб він зупинявся на одиниці від довжини. ```js -assert(!code.match(/i\s*?<=\s*?len;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?<=\s*?len;/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md index 3c324a9da26..c5913cba509 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-unclosed-parentheses-brackets-braces-and-quotes.md @@ -21,7 +21,7 @@ dashedName: catch-unclosed-parentheses-brackets-braces-and-quotes Ваш код повинен виправити відсутній фрагмент масиву. ```js -assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); +assert(__helpers.removeJSComments(code).match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g)); ``` Ваш код повинен виправити відсутній фрагмент методу `.reduce()`. Вихідні дані консолі повинні показати, що `Sum of array values is: 6`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md index 97352a7b634..f8c80eb84ac 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/catch-use-of-assignment-operator-instead-of-equality-operator.md @@ -43,7 +43,7 @@ assert(result == 'Not equal!'); Умова повинна використовувати `==` або `===`, щоб перевірити рівність. ```js -assert(code.match(/x\s*?===?\s*?y/g)); +assert(__helpers.removeJSComments(code).match(/x\s*?===?\s*?y/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md index 231ba8257c6..7b9344a196a 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/prevent-infinite-loops-with-a-valid-terminal-condition.md @@ -31,13 +31,13 @@ function loopy() { Ваш код повинен змінити оператора порівняння у кінцевій умові (середня частина) циклу `for`. ```js -assert(code.match(/i\s*?<=\s*?4;/g).length == 1); +assert(__helpers.removeJSComments(code).match(/i\s*?<=\s*?4;/g).length == 1); ``` Ваш код повинен виправити оператора порівняння у кінцевій умові циклу. ```js -assert(!code.match(/i\s*?!=\s*?4;/g)); +assert(!__helpers.removeJSComments(code).match(/i\s*?!=\s*?4;/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md index b145515deca..e5fc4eab683 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/understanding-the-differences-between-the-freecodecamp-and-browser-console.md @@ -23,7 +23,7 @@ dashedName: understanding-the-differences-between-the-freecodecamp-and-browser-c Ви повинні використати `console.log()`, щоб надрукувати змінну `output`. ```js -assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/console\.log\(output\)/)); ``` Ви повинні використати `console.clear()`, щоб очистити консоль браузера. @@ -31,7 +31,7 @@ assert(__helpers.removeWhiteSpace(code).match(/console\.log\(output\)/)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console.clear\(\)/) ); ``` @@ -41,7 +41,7 @@ assert( ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/console\.log\(output\)[\s\S]*console.clear\(\)/) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md index c49d46b6e36..f99ac3b75bb 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/use-the-javascript-console-to-check-the-value-of-a-variable.md @@ -29,7 +29,7 @@ console.log('Hello world!'); Ваш код повинен використовувати `console.log()` для перевірки значення змінної `a`. ```js -assert(code.match(/console\.log\(a\)/g)); +assert(__helpers.removeJSComments(code).match(/console\.log\(a\)/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md index eb50b2519c1..de44144ece6 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/debugging/use-typeof-to-check-the-type-of-a-variable.md @@ -32,19 +32,19 @@ JavaScript розпізнає сім примітивних (незмінних) Ваш код повинен використати оператор `typeof` у двох інструкціях `console.log()`, щоб перевірити тип змінних. ```js -assert(code.match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); +assert(__helpers.removeJSComments(code).match(/console\.log\s*\(typeof[\( ].*\)?\)/g).length == 2); ``` Ваш код повинен використати оператор `typeof`, щоб перевірити тип змінної `seven`. ```js -assert(code.match(/typeof[\( ]seven\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]seven\)?/g)); ``` Ваш код повинен використати оператор `typeof`, щоб перевірити тип змінної `three`. ```js -assert(code.match(/typeof[\( ]three\)?/g)); +assert(__helpers.removeJSComments(code).match(/typeof[\( ]three\)?/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md index f77dd482469..ff8fb19e04d 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/compare-scopes-of-the-var-and-let-keywords.md @@ -87,13 +87,13 @@ console.log(i); `var` має бути відсутнім у коді. ```js -assert(!code.match(/var/g)); +assert(!__helpers.removeJSComments(code).match(/var/g)); ``` Змінна `i`, оголошена в інструкції `if`, повинна дорівнювати рядку `block scope`. ```js -assert(code.match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); +assert(__helpers.removeJSComments(code).match(/(i\s*=\s*).*\s*.*\s*.*\1('|")block\s*scope\2/g)); ``` `checkScope()` має повертати рядок `function scope` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md index a7da184bf80..3ce93433041 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/complete-a-promise-with-resolve-and-reject.md @@ -32,7 +32,7 @@ const myPromise = new Promise((resolve, reject) => { ```js assert( - code.match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/if\s*\(\s*responseFromServer\s*\)\s*{\s*resolve\s*\(\s*('|"|`)We got the data\1\s*\)(\s*|\s*;\s*)}/g) ); ``` @@ -40,7 +40,7 @@ assert( ```js assert( - code.match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) + __helpers.removeJSComments(code).match(/}\s*else\s*{\s*reject\s*\(\s*('|"|`)Data not received\1\s*\)(\s*|\s*;\s*)}/g) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md index 98969633728..3af9c6a6acf 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-a-javascript-promise.md @@ -32,7 +32,7 @@ assert(makeServerRequest instanceof Promise); ```js assert( - code.match( + __helpers.removeJSComments(code).match( /Promise\s*\(\s*(function\s*\(\s*resolve\s*,\s*reject\s*\)\s*{|\(\s*resolve\s*,\s*reject\s*\)\s*=>\s*{)[^}]*}/g ) ); diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md index ddbd7ecb063..7f03f7bd1db 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-a-module-script.md @@ -25,14 +25,14 @@ dashedName: create-a-module-script Ви повинні створити тег `script`. ```js -assert(code.match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); +assert(__helpers.removeJSComments(code).match(/<\s*script[^>]*>\s*<\/\s*script\s*>/g)); ``` Ваш тег `script` повинен мати атрибут `type` зі значенням `module`. ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^t]*type\s*=\s*('|")module\1[^>]*>\s*<\/\s*script\s*>/g ) ); @@ -42,7 +42,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /<\s*script\s+[^s]*src\s*=\s*('|")index\.js\1[^>]*>\s*<\/\s*script\s*>/g ) ); diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md index c473faf647c..e6fa35e245f 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-an-export-fallback-with-export-default.md @@ -38,7 +38,7 @@ export default function(x, y) { ```js assert( - code.match( + __helpers.removeJSComments(code).match( /export\s+default\s+function(\s+subtract\s*|\s*)\(\s*x,\s*y\s*\)\s*{/g ) ); diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md index cdad38c954a..bf494beb160 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/create-strings-using-template-literals.md @@ -75,7 +75,7 @@ assert.match(code, /(`.*\${.*}.*`)/); Використайте цикл. ```js -assert(code.match(/for|map|reduce|forEach|while/)); +assert(__helpers.removeJSComments(code).match(/for|map|reduce|forEach|while/)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md index e6f6ab6cc57..a7f5bd0cc98 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/handle-a-fulfilled-promise-with-then.md @@ -34,7 +34,7 @@ myPromise.then(result => { ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.then\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.then\(/g) ); ``` @@ -50,7 +50,7 @@ assert(resultIsParameter); assert( resultIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.then\(.*?result.*?console.log\(result\).*?\)/) ); ``` @@ -60,7 +60,7 @@ assert( ## --after-user-code-- ```js -const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(code)); +const resultIsParameter = /\.then\((function\(result\){|result|\(result\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md index 5cb5222207c..547ca9a46e3 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/handle-a-rejected-promise-with-catch.md @@ -28,7 +28,7 @@ myPromise.catch(error => { ```js assert( - __helpers.removeWhiteSpace(code).match(/(makeServerRequest|\))\.catch\(/g) + __helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/(makeServerRequest|\))\.catch\(/g) ); ``` @@ -44,7 +44,7 @@ assert(errorIsParameter); assert( errorIsParameter && __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.catch\(.*?error.*?console.log\(error\).*?\)/) ); ``` @@ -54,7 +54,7 @@ assert( ## --after-user-code-- ```js -const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(code)); +const errorIsParameter = /\.catch\((function\(error\){|error|\(error\)=>)/.test(__helpers.removeWhiteSpace(__helpers.removeJSComments(code))); ``` ## --seed-contents-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md index 438186f1176..75883f69148 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/import-a-default-export.md @@ -25,7 +25,7 @@ import add from "./math_functions.js"; Ви повинні правильно імпортувати `subtract` з `math_functions.js`. ```js -assert(code.match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); +assert(__helpers.removeJSComments(code).match(/import\s+subtract\s+from\s+('|")\.\/math_functions\.js\1/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md index db44d913adb..b17c3f220f0 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/mutate-an-array-declared-with-const.md @@ -36,19 +36,19 @@ console.log(s); Ви не повинні замінювати ключове слово `const`. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `s` повинна бути константною змінною (використовуйте `const`). ```js -assert(code.match(/const\s+s/g)); +assert(__helpers.removeJSComments(code).match(/const\s+s/g)); ``` Ви не повинні змінювати оголошення масиву. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g )); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md index 52b8ad4d25e..04fa06a0b37 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/prevent-object-mutation.md @@ -34,19 +34,19 @@ console.log(obj); Ви не повинні замінювати ключове слово `const`. ```js -assert(code.match(/const/g)); +assert(__helpers.removeJSComments(code).match(/const/g)); ``` `MATH_CONSTANTS` повинна бути константною змінною (використовуйте `const`). ```js -assert(code.match(/const\s+MATH_CONSTANTS/g)); +assert(__helpers.removeJSComments(code).match(/const\s+MATH_CONSTANTS/g)); ``` Ви не повинні змінювати початкове оголошення `MATH_CONSTANTS`. ```js -assert(code.match( +assert(__helpers.removeJSComments(code).match( /const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g )); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md index 9a9d3987e94..71b30023454 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/reuse-javascript-code-using-import.md @@ -32,7 +32,7 @@ import { add, subtract } from './math_functions.js'; ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); @@ -42,7 +42,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)}\s+from\s+('|")\.\/string_functions\.js\2/g ) ); diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md index 5a5efb515e0..53e1aa77a99 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions.md @@ -44,7 +44,7 @@ assert(increment(5) === 6); Для `value` потрібно використати значення параметру за замовчуванням `1`. ```js -assert(code.match(/value\s*=\s*1/g)); +assert(__helpers.removeJSComments(code).match(/value\s*=\s*1/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md index 3a31f937f41..f1e9c946003 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use--to-import-everything-from-a-file.md @@ -31,7 +31,7 @@ myMathModule.subtract(5,3); ```js assert( - code.match( + __helpers.removeJSComments(code).match( /import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g ) ); diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md index 7193bc517d3..70798833e9c 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-class-syntax-to-define-a-constructor-function.md @@ -66,7 +66,7 @@ assert( Використайте ключове слово `class`. ```js -assert(code.match(/class/g)); +assert(__helpers.removeJSComments(code).match(/class/g)); ``` `Vegetable` повинен бути реалізованим. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md index 6ee7492c027..1a181f4d904 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-arrays.md @@ -51,7 +51,7 @@ assert(b === 8); Ви повинні використати деструктуризацію масиву, щоб поміняти значення `a` та `b`. ```js -assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code)); +assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md index 912c19ab135..c947e59751b 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-nested-objects.md @@ -43,8 +43,8 @@ const { johnDoe: { age: userAge, email: userEmail }} = user; ```js assert( - !code.match(/lowToday = LOCAL_FORECAST\.today\.low/g) && - !code.match(/highToday = LOCAL_FORECAST\.today.high/g) + !__helpers.removeJSComments(code).match(/lowToday = LOCAL_FORECAST\.today\.low/g) && + !__helpers.removeJSComments(code).match(/highToday = LOCAL_FORECAST\.today.high/g) ); ``` @@ -52,7 +52,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(low\s*:\s*lowToday[^}]*|[^,]*,\s*low\s*:\s*lowToday\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); @@ -62,7 +62,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*today\s*:\s*{\s*(high\s*:\s*highToday[^}]*|[^,]*,\s*high\s*:\s*highToday,?\s*)},?\s*}\s*=\s*LOCAL_FORECAST(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md index 8d5ec3af90b..d81921c3a22 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-assign-variables-from-objects.md @@ -34,8 +34,8 @@ const { name: userName, age: userAge } = user; ```js assert( - !code.match(/highToday = HIGH_TEMPERATURES\.today/g) && - !code.match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) + !__helpers.removeJSComments(code).match(/highToday = HIGH_TEMPERATURES\.today/g) && + !__helpers.removeJSComments(code).match(/highTomorrow = HIGH_TEMPERATURES\.tomorrow/g) ); ``` @@ -43,7 +43,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(today\s*:\s*highToday[^}]*|[^,]*,\s*today\s*:\s*highToday\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); @@ -53,7 +53,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(var|const|let)\s*{\s*(tomorrow\s*:\s*highTomorrow[^}]*|[^,]*,\s*tomorrow\s*:\s*highTomorrow\s*)}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g ) ); diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md index bc677cde36b..249e25af6db 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-extract-values-from-objects.md @@ -43,7 +43,7 @@ const { name, age } = user; ```js assert( - !code.match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) + !__helpers.removeJSComments(code).match(/today\s*=\s*HIGH_TEMPERATURES\.(today|tomorrow)/g) ); ``` @@ -51,7 +51,7 @@ assert( ```js assert( - code.match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(today[^}]*|[^,]*,\s*today)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` @@ -59,7 +59,7 @@ assert( ```js assert( - code.match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) + __helpers.removeJSComments(code).match(/(var|let|const)\s*{\s*(tomorrow[^}]*|[^,]*,\s*tomorrow)\s*}\s*=\s*HIGH_TEMPERATURES(;|\s+|\/\/)/g) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md index d6e5790d5df..73ffdaa6b8f 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-to-pass-an-object-as-a-functions-parameters.md @@ -50,13 +50,13 @@ assert(half(stats) === 28.015); Використайте деструктуризацію. ```js -assert(__helpers.removeWhiteSpace(code).match(/half=\({\w+,\w+}\)/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/half=\({\w+,\w+}\)/)); ``` Використайте деструктурований параметр. ```js -assert(!code.match(/stats\.max|stats\.min/)); +assert(!__helpers.removeJSComments(code).match(/stats\.max|stats\.min/)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md index 474067ece19..02ff4392914 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements.md @@ -47,7 +47,7 @@ assert.deepEqual(_testArr, [1, 2, 3, 4, 5]) Не використовуйте `Array.slice()`. ```js -assert(!code.match(/\.\s*slice\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*slice\s*\(/)); ``` Використайте залишковий синтаксис. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md index b7de1f5eea3..a3f0b2c733a 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-export-to-share-a-code-block.md @@ -42,7 +42,7 @@ export { add, subtract }; ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+uppercaseString|export\s*{\s*(uppercaseString[^}]*|[^,]*,\s*uppercaseString\s*)})/g ) ); @@ -52,7 +52,7 @@ assert( ```js assert( - code.match( + __helpers.removeJSComments(code).match( /(export\s+const\s+lowercaseString|export\s*{\s*(lowercaseString[^}]*|[^,]*,\s*lowercaseString\s*)})/g ) ); diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md index 9400b1bcbbb..540e5e059cc 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-the-rest-parameter-with-function-parameters.md @@ -57,7 +57,7 @@ assert(sum() === 0); `sum` повинна бути стрілковою функцією, яка використовує синтаксис залишкового параметра (`...`) на параметрі `args`. ```js -assert(__helpers.removeWhiteSpace(code).match(/sum=\(\.\.\.args\)=>/)); +assert(__helpers.removeWhiteSpace(__helpers.removeJSComments(code)).match(/sum=\(\.\.\.args\)=>/)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md index a6996eb14c1..d55ebee4c51 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/use-the-spread-operator-to-evaluate-arrays-in-place.md @@ -55,7 +55,7 @@ assert(arr2.every((v, i) => v === arr1[i]) && arr2.length); Для дублювання `arr1` потрібно використати оператор розширення (`...`). ```js -assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); +assert(__helpers.removeJSComments(code).match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/)); ``` `arr2` повинен залишатись без змін, а `arr1` повинен бути зміненим. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md index 90d6ba0ea79..598381b86dd 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md @@ -54,7 +54,7 @@ assert.match(code, /const\s+myConcat/g); ```js assert( - /myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) && + /myConcat=\(\w+,\w+\)=>/.test(__helpers.removeJSComments(code).replace(/\s/g, '')) && typeof myConcat === 'function' ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md index 91c2de9e38d..f93fc30a94c 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6.md @@ -39,14 +39,14 @@ const person = { Не використовуйте традиційні вирази функцій. ```js -assert(!code.match(/function/)); +assert(!__helpers.removeJSComments(code).match(/function/)); ``` `setGear` повинна бути декларативною функцією. ```js assert( - typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/) + typeof bicycle.setGear === 'function' && __helpers.removeJSComments(code).match(/setGear\s*\(.+\)\s*\{/) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md index f5f2d1e7730..27903ca0a3c 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand.md @@ -43,7 +43,7 @@ assert.deepEqual( Ваш код не повинен використовувати `key:value`. ```js -assert(!code.match(/:/g)) +assert(!__helpers.removeJSComments(code).match(/:/g)) ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md index 85cabe5ad22..839e0e2ee37 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/add-elements-to-the-end-of-an-array-using-concat-instead-of-push.md @@ -30,13 +30,13 @@ arr.push(4, 5, 6); Ваш код повинен використовувати метод `concat`. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` Ваш код не повинен використовувати метод `push`. ```js -assert(!code.match(/\.?[\s\S]*?push/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?push/g)); ``` Масив `first` не повинен змінюватись. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md index e8307d4f092..0ad23de42cb 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/apply-functional-programming-to-convert-strings-to-url-slugs.md @@ -31,7 +31,7 @@ dashedName: apply-functional-programming-to-convert-strings-to-url-slugs Ваш код не повинен використовувати метод `replace` у цьому завданні. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `urlSlug("Winter Is Coming")` має повертати рядок `winter-is-coming`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md index 74cc8ba19cb..e41221b66b1 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/combine-an-array-into-a-string-using-the-join-method.md @@ -27,13 +27,13 @@ const str = arr.join(" "); Ваш код повинен використовувати метод `join`. ```js -assert(code.match(/\.join/g)); +assert(__helpers.removeJSComments(code).match(/\.join/g)); ``` Ваш код не повинен використовувати метод `replace`. ```js -assert(!code.match(/\.?[\s\S]*?replace/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?replace/g)); ``` `sentensify("May-the-force-be-with-you")` має повертати рядок. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md index 2a507e20cb6..b54fc984f31 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/combine-two-arrays-using-the-concat-method.md @@ -25,7 +25,7 @@ dashedName: combine-two-arrays-using-the-concat-method Ваш код повинен використовувати метод `concat`. ```js -assert(code.match(/\.concat/g)); +assert(__helpers.removeJSComments(code).match(/\.concat/g)); ``` Масив `first` не повинен змінюватись. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md index 02edc50bf2b..ae333934412 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/implement-map-on-a-prototype.md @@ -47,7 +47,7 @@ assert(JSON.stringify(_test_s.map(_callback)) === JSON.stringify(_test_s.myMap(_ Ваш код не повинен використовувати метод `map`. ```js -assert(!code.match(/\.?[\s\S]*?map/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?map/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md index 7b9d903d6fc..f2d76c41463 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/implement-the-filter-method-on-a-prototype.md @@ -43,7 +43,7 @@ assert(JSON.stringify(_test_s.filter(_callback)) === JSON.stringify(_test_s.myFi Ваш код не повинен використовувати метод `filter`. ```js -assert(!code.match(/\.?[\s\S]*?filter/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?filter/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md index 72aa9627d61..d5ba5c5a12b 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/introduction-to-currying-and-partial-application.md @@ -77,7 +77,7 @@ assert(add(11)(22)(33) === 66); Ваш код повинен містити кінцеву інструкцію, яка повертає `x + y + z`. ```js -assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); +assert(__helpers.removeJSComments(code).match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md index 29bba954092..72d78828f61 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/remove-elements-from-an-array-using-slice-instead-of-splice.md @@ -30,13 +30,13 @@ cities.splice(3, 1); Ваш код повинен використовувати метод `slice`. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` Ваш код не повинен використовувати метод `splice`. ```js -assert(!code.match(/\.?[\s\S]*?splice/g)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?splice/g)); ``` Не змінюйте початковий масив, переданий до функції. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md index 5734d8356b8..e5214e404aa 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/return-part-of-an-array-using-the-slice-method.md @@ -28,7 +28,7 @@ const newArray = arr.slice(1, 3); Ваш код повинен використовувати метод `slice`. ```js -assert(code.match(/\.slice/g)); +assert(__helpers.removeJSComments(code).match(/\.slice/g)); ``` Змінна `inputAnim` не повинна змінюватися. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md index 4366b823b73..4fdf5efb7d5 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.md @@ -47,7 +47,7 @@ reverseAlpha(['l', 'h', 'z', 'b', 's']); Ваш код повинен використовувати метод `sort`. ```js -assert(code.match(/\.sort/g)); +assert(__helpers.removeJSComments(code).match(/\.sort/g)); ``` `alphabeticalOrder(["a", "d", "c", "a", "z", "g"])` має повертати `["a", "a", "c", "d", "g", "z"]`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md index 5ebe85c1886..a04d52c18c1 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/split-a-string-into-an-array-using-the-split-method.md @@ -33,7 +33,7 @@ const byDigits = otherString.split(/\d/); Ваш код повинен використовувати метод `split`. ```js -assert(code.match(/\.split/g)); +assert(__helpers.removeJSComments(code).match(/\.split/g)); ``` `splitify("Hello World,I-am code")` має повертати `["Hello", "World", "I", "am", "code"]`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md index d4c2c2e0408..b0d9eae21ad 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-higher-order-functions-map-filter-or-reduce-to-solve-a-complex-problem.md @@ -28,7 +28,7 @@ assert.typeOf(squareList, 'function'), Ви не повинні використовувати `for`, `while` або `forEach`. ```js -assert(!code.match(/for|while|forEach/g)); +assert(!__helpers.removeJSComments(code).match(/for|while|forEach/g)); ``` Ви повинні використовувати `map`, `filter` або `reduce`. @@ -36,7 +36,7 @@ assert(!code.match(/for|while|forEach/g)); ```js assert( __helpers - .removeWhiteSpace(code) + .removeWhiteSpace(__helpers.removeJSComments(code)) .match(/\.(map|filter|reduce)\(/g) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md index 30c06cdc3d0..c8e4bdc07a5 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-every-method-to-check-that-every-element-in-an-array-meets-a-criteria.md @@ -31,7 +31,7 @@ numbers.every(function(currentValue) { Ваш код повинен використовувати метод `every`. ```js -assert(code.match(/\.every/g)); +assert(__helpers.removeJSComments(code).match(/\.every/g)); ``` `checkPositive([1, 2, 3, -4, 5])` має повертати `false`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md index 54236d53c1d..8506a640123 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md @@ -46,13 +46,13 @@ assert( Ваш код повинен використовувати метод `filter`. ```js -assert(code.match(/\s*\.\s*filter/g)); +assert(__helpers.removeJSComments(code).match(/\s*\.\s*filter/g)); ``` Ваш код не повинен використовувати цикл `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` `filteredList` має дорівнювати `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"}, {"title": "Batman Begins", "rating": "8.3"}]`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md index 1fe1c5576cc..eba35d5807e 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-map-method-to-extract-data-from-an-array.md @@ -52,13 +52,13 @@ assert( Ваш код не повинен використовувати цикл `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/)); ``` Ваш код повинен використовувати метод `map`. ```js -assert(code.match(/\.map/g)); +assert(__helpers.removeJSComments(code).match(/\.map/g)); ``` `ratings` має дорівнювати `[{"title": "Inception", "rating": "8.8"}, {"title": "Interstellar", "rating": "8.6"}, {"title": "The Dark Knight", "rating": "9.0"},{"title": "Batman Begins", "rating": "8.3"}, {"title": "Avatar", "rating": "7.9"}]`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md index 6f018860406..de5e27b3dfb 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-reduce-method-to-analyze-data.md @@ -66,7 +66,7 @@ assert( Ваш код повинен використовувати метод `reduce`. ```js -assert(code.match(/\.reduce/g)); +assert(__helpers.removeJSComments(code).match(/\.reduce/g)); ``` `getRating(watchList)` має дорівнювати 8.675. @@ -78,7 +78,7 @@ assert(getRating(watchList) === 8.675); Ваш код не повинен використовувати цикл `for`. ```js -assert(!code.match(/for\s*?\([\s\S]*?\)/g)); +assert(!__helpers.removeJSComments(code).match(/for\s*?\([\s\S]*?\)/g)); ``` Ваш код повинен повернути правильні вихідні дані після зміни об’єкта `watchList`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md index f959703cffe..47970468d13 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/functional-programming/use-the-some-method-to-check-that-any-elements-in-an-array-meet-a-criteria.md @@ -31,7 +31,7 @@ numbers.some(function(currentValue) { Ваш код повинен використовувати метод `some`. ```js -assert(code.match(/\.some/g)); +assert(__helpers.removeJSComments(code).match(/\.some/g)); ``` `checkPositive([1, 2, 3, -4, 5])` має повертати `true`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md index c848360cd6b..b63f5d8e393 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller.md @@ -39,7 +39,7 @@ assert.deepEqual(steamrollArray([1, {}, [3, [[4]]]]), [1, {}, 3, 4]); У вашому рішенні не повинні використовуватися методи `Array.prototype.flat()` або `Array.prototype.flatMap()`. ```js -assert(!code.match(/\.\s*flat\s*\(/) && !code.match(/\.\s*flatMap\s*\(/)); +assert(!__helpers.removeJSComments(code).match(/\.\s*flat\s*\(/) && !__helpers.removeJSComments(code).match(/\.\s*flatMap\s*\(/)); ``` Не використовуйте глобальні змінні. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md index 3159c8ecd3b..bcc7cff5c94 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/change-the-prototype-to-a-new-object.md @@ -49,7 +49,7 @@ Bird.prototype = { Налаштуйте `Dog.prototype` на новий об’єкт. ```js -assert(/Dog\.prototype\s*?=\s*?{/.test(code)); +assert(/Dog\.prototype\s*?=\s*?{/.test(__helpers.removeJSComments(code))); ``` `Dog.prototype` повинен мати властивість `numLegs`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md index f4450106b96..b661347fb09 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/inherit-behaviors-from-a-supertype.md @@ -61,7 +61,7 @@ assert(typeof beagle !== 'undefined'); ```js assert( /(let|const|var)\s{1,}duck\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` @@ -71,7 +71,7 @@ assert( ```js assert( /(let|const|var)\s{1,}beagle\s*=\s*Object\.create\s*\(\s*Animal\.prototype\s*\)\s*/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md index e8669203e4d..7a5482b3570 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/iterate-over-all-properties.md @@ -61,7 +61,7 @@ assert.deepEqual(prototypeProps, ['numLegs']); Виконайте це завдання, не використовуючи вбудований метод `Object.keys()`. ```js -assert(!/\Object.keys/.test(code)); +assert(!/\Object.keys/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md index acf98fd6e84..d604308f11b 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/make-code-more-reusable-with-the-this-keyword.md @@ -43,7 +43,7 @@ assert(dog.sayLegs() === 'This dog has 4 legs.'); Код має використати ключове слово `this`, щоб отримати доступ до властивості `numLegs` об’єкта `dog`. ```js -assert(code.match(/this\.numLegs/g)); +assert(__helpers.removeJSComments(code).match(/this\.numLegs/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md index 1791caa82bc..92f1d7f594b 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-own-properties.md @@ -51,7 +51,7 @@ assert(ownProps.indexOf('name') !== -1 && ownProps.indexOf('numLegs') !== -1); Виконайте це завдання, не використовуючи вбудований метод `Object.keys()`. ```js -assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); +assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(__helpers.removeJSComments(code))); ``` Виконайте це завдання, не закодовуючи масив `ownProps` жорстко. @@ -59,7 +59,7 @@ assert(!/Object(\.keys|\[(['"`])keys\2\])/.test(code)); ```js assert( !/\[\s*(?:'|")(?:name|numLegs)|(?:push|concat)\(\s*(?:'|")(?:name|numLegs)/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md index 3c73976e587..9646d26f6f4 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-constructor-property.md @@ -55,7 +55,7 @@ assert(joinDogFraternity(new Dog('')) === true); `joinDogFraternity` має використовувати властивість `constructor`. ```js -assert(/\.constructor/.test(code) && !/instanceof/.test(code)); +assert(/\.constructor/.test(__helpers.removeJSComments(code)) && !/instanceof/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md index 812b8760672..888880f3319 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-immediately-invoked-function-expression-iife.md @@ -29,13 +29,13 @@ dashedName: understand-the-immediately-invoked-function-expression-iife Функція має бути анонімною. ```js -assert(/\((function|\(\))(=>|\(\)){?/.test(code.replace(/\s/g, ''))); +assert(/\((function|\(\))(=>|\(\)){?/.test(__helpers.removeJSComments(code).replace(/\s/g, ''))); ``` Для негайного виклику ваша функція повинна мати дужки наприкінці. ```js -assert(/\(.*(\)\(|\}\(\))\)/.test(code.replace(/[\s;]/g, ''))); +assert(/\(.*(\)\(|\}\(\))\)/.test(__helpers.removeJSComments(code).replace(/[\s;]/g, ''))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md index 8c12acec3af..6b4cea725c0 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-the-prototype-chain.md @@ -42,7 +42,7 @@ duck.hasOwnProperty("name"); Код має показувати, що `Object.prototype` є прототипом `Dog.prototype` ```js -assert(/Object\.prototype\.isPrototypeOf/.test(code)); +assert(/Object\.prototype\.isPrototypeOf/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md index af779edcfd9..6ec45ddcc5b 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/understand-where-an-objects-prototype-comes-from.md @@ -35,7 +35,7 @@ Bird.prototype.isPrototypeOf(duck); Ви повинні показати, що `Dog.prototype` є прототипом `beagle` ```js -assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(code)); +assert(/Dog\.prototype\.isPrototypeOf\(beagle\)/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md index f4417086c15..ec66fd2a6ba 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-a-constructor-to-create-objects.md @@ -52,7 +52,7 @@ assert(hound instanceof Dog); Код має використати оператор `new`, щоб створити екземпляр `Dog`. ```js -assert(code.match(/new/g)); +assert(__helpers.removeJSComments(code).match(/new/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md index 2b2f16cdb82..061a3d8ff4a 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-closure-to-protect-properties-within-an-object-from-being-modified-externally.md @@ -43,7 +43,7 @@ ducky.getHatchedEggCount(); Властивість `weight` має бути приватною змінною і їй має бути присвоєно значення `15`. ```js -assert(code.match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); +assert(__helpers.removeJSComments(code).match(/(var|let|const)\s+weight\s*\=\s*15\;?/g)); ``` Код має створити метод у `Bird` під назвою `getWeight`, який повертає значення приватної змінної `weight`. @@ -55,7 +55,7 @@ assert(new Bird().getWeight() === 15); Функція `getWeight` має повернути приватну змінну `weight`. ```js -assert(code.match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); +assert(__helpers.removeJSComments(code).match(/((return\s+)|(\(\s*\)\s*\=\>\s*))weight\;?/g)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md index 467ba2abe3c..a9d94ca45d6 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/use-dot-notation-to-access-the-properties-of-an-object.md @@ -29,13 +29,13 @@ console.log(duck.name); Код має використати `console.log`, щоб вивести значення властивості `name` об’єкта `dog`. ```js -assert(/console.log\(.*dog\.name.*\)/g.test(code)); +assert(/console.log\(.*dog\.name.*\)/g.test(__helpers.removeJSComments(code))); ``` Код має використати `console.log`, щоб вивести значення властивості `numLegs` об’єкта `dog`. ```js -assert(/console.log\(.*dog\.numLegs.*\)/g.test(code)); +assert(/console.log\(.*dog\.numLegs.*\)/g.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md index 880d20cc11a..83afa282a13 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/object-oriented-programming/verify-an-objects-constructor-with-instanceof.md @@ -53,7 +53,7 @@ assert(typeof myHouse.numBedrooms === 'number'); Ви повинні перевірити, що `myHouse` є екземпляром `House`, використавши оператор `instanceof`. ```js -assert(/myHouse\s*instanceof\s*House/.test(code)); +assert(/myHouse\s*instanceof\s*House/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md index c8b403d9b81..f9438e0eff8 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/check-for-mixed-grouping-of-characters.md @@ -75,7 +75,7 @@ assert(!myRegex.test('EleanorRoosevelt')); Використайте `.test()`, щоб протестувати регулярний вираз. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` Результат має повернути `true`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md index cef95b49316..08183f520d3 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/extract-matches.md @@ -51,7 +51,7 @@ assert(codingRegex.source === 'coding'); Використайте метод `.match()`. ```js -assert(code.match(/\.match\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.match\(.*\)/)); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md index 951d64c132e..5e92965c8f2 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/match-anything-with-wildcard-period.md @@ -31,7 +31,7 @@ huRegex.test(hugStr); Використайте метод `.test()`. ```js -assert(code.match(/\.test\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.test\(.*\)/)); ``` Використайте байдужий символ у регулярному виразі `unRegex` diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md index 6c11fe76c8c..be3e627c009 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/match-literal-strings.md @@ -52,7 +52,7 @@ assert(!waldoRegex.test('Somewhere is hiding in this text.')); Знайдіть точний збіг рядка за допомогою регулярного виразу. ```js -assert(!/\/.*\/i/.test(code)); +assert(!/\/.*\/i/.test(__helpers.removeJSComments(code))); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md index 72f2989f693..3ef9e672418 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/remove-whitespace-from-start-and-end.md @@ -27,13 +27,13 @@ assert(result === 'Hello, World!'); Не використовуйте метод `String.prototype.trim()` у розв’язку. ```js -assert(!code.match(/\.?[\s\S]*?trim/)); +assert(!__helpers.removeJSComments(code).match(/\.?[\s\S]*?trim/)); ``` Не налаштовуйте змінну `result` на рядок напряму ```js -assert(!code.match(/result\s*=\s*["'`].*?["'`]/)); +assert(!__helpers.removeJSComments(code).match(/result\s*=\s*["'`].*?["'`]/)); ``` Не змінюйте значення змінної `hello`. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md index b48c656349c..9401a288832 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/use-capture-groups-to-search-and-replace.md @@ -37,7 +37,7 @@ wrongText.replace(silverRegex, "blue"); Використайте `.replace()` для пошуку та заміни. ```js -assert(code.match(/\.replace\(.*\)/)); +assert(__helpers.removeJSComments(code).match(/\.replace\(.*\)/)); ``` Ваш регулярний вираз має замінити рядок `one two three` на рядок `three two one` @@ -49,7 +49,7 @@ assert(result === 'three two one'); Не змінюйте останній рядок. ```js -assert(code.match(/result\s*=\s*str\.replace\(.*?\)/)); +assert(__helpers.removeJSComments(code).match(/result\s*=\s*str\.replace\(.*?\)/)); ``` `fixRegex` має використати принаймні три групи захоплення. diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md index 3f533aabac6..71b7e52121d 100644 --- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md +++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/regular-expressions/using-the-test-method.md @@ -31,7 +31,7 @@ testRegex.test(testStr); Використайте `.test()`, щоб протестувати регулярний вираз. ```js -assert(code.match(/myRegex.test\(\s*myString\s*\)/)); +assert(__helpers.removeJSComments(code).match(/myRegex.test\(\s*myString\s*\)/)); ``` Результат має повернути `true`. diff --git a/curriculum/challenges/ukrainian/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md b/curriculum/challenges/ukrainian/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md index 196a71435d7..ea9d60d6d4b 100644 --- a/curriculum/challenges/ukrainian/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md +++ b/curriculum/challenges/ukrainian/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687da2e60409c45595bbe1.md @@ -15,12 +15,9 @@ dashedName: step-27 ```js ({ - test: () => { - const transformedCode = code.replace(/\r/g, ""); - const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); - const { function_body } = verify_card_number; - - assert.match(function_body, /if +number +>= +10:/); + test: () => + { + assert(runPython(`_Node(_code).find_function("verify_card_number").find_for_loops()[1].find_ifs()[0].find_conditions()[0].is_equivalent("number >= 10")`)); } }) ``` diff --git a/curriculum/challenges/ukrainian/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md b/curriculum/challenges/ukrainian/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md index a4748cf826a..e1199eae333 100644 --- a/curriculum/challenges/ukrainian/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md +++ b/curriculum/challenges/ukrainian/07-scientific-computing-with-python/scientific-computing-with-python-projects/probability-calculator.md @@ -115,7 +115,10 @@ from importlib import reload reload(probability_calculator) probability_calculator.random.seed(95) -def test_hat_draw(self): + +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw(self): hat = probability_calculator.Hat(red=5,blue=2) actual = hat.draw(2) expected = ['blue', 'red'] @@ -140,6 +143,49 @@ t.result.wasSuccessful() }); ``` +The `draw` method should behave correctly when the number of balls to extract is bigger than the number of balls in the hat. + +```js +({ + test: () => { + pyodide.FS.writeFile("/home/pyodide/probability_calculator.py", code); + pyodide.FS.writeFile( + "/home/pyodide/test_module.py", + ` +import unittest +import probability_calculator +from importlib import reload + +reload(probability_calculator) + +probability_calculator.random.seed(95) +class UnitTests(unittest.TestCase): + maxDiff = None + def test_hat_draw_2(self): + hat = probability_calculator.Hat(yellow=5,red=1,green=3,blue=9,test=1) + actual = hat.draw(20) + expected = ['yellow', 'yellow', 'yellow', 'yellow', 'yellow', 'red', 'green', 'green', 'green', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'blue', 'test'] + self.assertEqual(actual, expected, 'Expected hat draw to return all items from hat contents.') + actual = len(hat.contents) + expected = 0 + self.assertEqual(actual, expected, 'Expected hat draw to leave no items in contents.') + ` + ); + const testCode = ` +from unittest import main +import test_module +from importlib import reload + +reload(test_module) +t = main(module='test_module', exit=False) +t.result.wasSuccessful() +`; + const out = __pyodide.runPython(testCode); + assert(out); + }, +}); +``` + Метод `experiment` має повернути іншу вірогідність. @@ -221,7 +267,8 @@ class Hat: def draw(self, number): drawn = [] if number >= len(self.contents): - return self.contents + drawn.extend(self.contents) + self.contents = [] else: for i in range(number): drawn.append( @@ -229,8 +276,7 @@ class Hat: ) return drawn -def experiment(hat, expected_balls, num_balls_drawn, num_experiments): - +def experiment(hat, expected_balls, num_balls_drawn, num_experiments): expected_balls_list = [] drawn_list = [] success = 0 @@ -248,12 +294,7 @@ def experiment(hat, expected_balls, num_balls_drawn, num_experiments): except: continue if len(exp_ball_list_copy) == 0: - success += 1 - - - - - probability = success/num_experiments - + success += 1 + probability = success/num_experiments return probability ``` diff --git a/curriculum/challenges/ukrainian/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md b/curriculum/challenges/ukrainian/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md index 92d0d801427..1b1d733167d 100644 --- a/curriculum/challenges/ukrainian/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md +++ b/curriculum/challenges/ukrainian/10-coding-interview-prep/data-structures/learn-how-a-stack-works.md @@ -48,9 +48,9 @@ assert(homeworkStack.indexOf('PSY44') === -1); ```js assert( - code.match(/=/g).length === 1 && + __helpers.removeJSComments(code).match(/=/g).length === 1 && /homeworkStack\s*=\s*\["BIO12"\s*,\s*"HIS80"\s*,\s*"MAT122"\s*,\s*"PSY44"\]/.test( - code + __helpers.removeJSComments(code) ) ); ``` diff --git a/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md b/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md index 8ff23e42efd..65fa8842a0d 100644 --- a/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md +++ b/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md @@ -2,7 +2,6 @@ id: 5f356ed60a5decd94ab66986 title: Крок 22 challengeType: 0 -removeComments: false dashedName: step-22 --- diff --git a/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md b/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md index 322e4c79b39..53ae286633a 100644 --- a/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md +++ b/curriculum/challenges/ukrainian/14-responsive-web-design-22/learn-the-css-box-model-by-building-a-rothko-painting/60a3e3396c7b40068ad6998c.md @@ -40,15 +40,15 @@ assert(canvasFilter === 'blur(2px)'); ## --seed-contents-- ```css +--fcc-editable-region-- .canvas { width: 500px; height: 600px; background-color: #4d0f00; overflow: hidden; ---fcc-editable-region-- ---fcc-editable-region-- } +--fcc-editable-region-- .frame { border: 50px solid black; diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md index d59404d5de3..a53408ab41d 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/645763874fd6d901c273db29.md @@ -7,7 +7,7 @@ dashedName: step-55 # --description-- -Inside, the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. +Inside the first `td` element, add an embedded expression `${}`. Inside that expression, call the `forumCategory` function with the argument of `category_id`. Now, you should see a category displayed underneath each post topic. diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md index 05dabde6656..25bf2b3621c 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/641130423e5f512d8972dae1.md @@ -7,9 +7,11 @@ dashedName: step-43 # --description-- -Notice how the `10` value is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. +Notice how the number `10` is placed at the beginning of the array. This is because the default behavior of `.sort()` is to convert the numbers values to strings, and sort them alphabetically. And `10` comes before `2` alphabetically. -To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. Leave the function empty for now. +To fix this, you can pass a callback function to the `.sort()` method. The callback function has two parameters - for yours, use `a` and `b`. The parameters of `a` and `b` represent the number values in the array that will be sorted. + +Leave the function empty for now. # --hints-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md index d253c95b6c6..ee57c994e55 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64113124efd2852edafaf25f.md @@ -26,7 +26,7 @@ assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\( Your callback function should return `a - b`. ```js -assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+a\s*-\s*b\s*;?\s*}\s*\)/); +assert.match(code, /const\s+sortedValues\s*=\s*inputValues\s*\.\s*sort\s*\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*{\s*return\s+(?:parseInt)?(?:Number)?\(?a\)?\s*-\s*(?:parseInt)?(?:Number)?\(?b\)?\s*;?\s*}\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index 0e1e2877669..122acf74060 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -11,6 +11,8 @@ In your `evalFormula`, declare an `idToText` arrow function which takes an `id` Your `idToText` function should return the result of calling `.find()` on the `cells` array with a callback function that takes an `cell` parameter and returns `cell.id === id`. +Both of your functions should use implicit returns. + # --hints-- Оголосіть змінну `idToText` у функції `evalFormula`. diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md index 57110b715a9..37487b1771c 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f374d532dc41189cc9cc2.md @@ -23,13 +23,7 @@ Open up the console to see the result. # --hints-- -You should call `.repeat()` on your two `" "` strings. - -```js -assert.lengthOf(code.match(/" ".repeat/g), 2); -``` - -Your `" "` strings should be repeated `rowCount - rowNumber` times. +You should call `.repeat()` on your `" "` strings to repeat them `rowCount - rowNumber` times. ```js assert.equal(padRow(1, 3), " # "); diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md index 3306b1a478b..4170d3bd12b 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3ce51f70571e1c5227c8.md @@ -3,7 +3,6 @@ id: 660f3ce51f70571e1c5227c8 title: Step 69 challengeType: 1 dashedName: step-69 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md index ea0a831040f..7a939244a7c 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f3dd626be3a1ffe27e5d1.md @@ -3,7 +3,6 @@ id: 660f3dd626be3a1ffe27e5d1 title: Step 70 challengeType: 1 dashedName: step-70 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md index e30d808ccb6..b676558ec74 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f4f79e2a82a4e92290f44.md @@ -3,7 +3,6 @@ id: 660f4f79e2a82a4e92290f44 title: Step 101 challengeType: 1 dashedName: step-101 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md index dc683e61ce5..3f088de2c91 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f53ad3d39175c5d4335ac.md @@ -3,7 +3,6 @@ id: 660f53ad3d39175c5d4335ac title: Step 108 challengeType: 1 dashedName: step-108 -removeComments: false --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md new file mode 100644 index 00000000000..286128cc2cf --- /dev/null +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/662693f82c91a66be46c881b.md @@ -0,0 +1,74 @@ +--- +id: 662693f82c91a66be46c881b +title: Step 1 +challengeType: 1 +dashedName: step-1 +--- + +# --description-- + +A teacher has finished grading their students' tests and needs your help to calculate the average score for the class. + +Complete the `getAverage` function which takes in an array of test scores and returns the average score. + +The average is calculated by adding up all the scores and dividing by the total number of scores. + +```js +average = sum of all scores / total number of scores +``` + +A couple of function calls have been provided for you so you can test out your code. + +**Tips** + +- You can use a loop to iterate over the `scores` array and add up all the scores. +- You can use the `length` property to get the total number of scores. + +# --hints-- + +Your `getAverage` function should return a number. + +```js +assert.strictEqual(typeof getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 'number'); +``` + +`getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])` should return `71.7`. + +```js +assert.strictEqual(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]), 71.7); +``` + +`getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])` should return `85.4`. + +```js +assert.strictEqual(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]), 85.4); +``` + +`getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100])` should return `92.4`. + +```js +assert.strictEqual(getAverage([38, 99, 87, 100, 100, 100, 100, 100, 100, 100]), 92.4); +``` + +Your `getAverage` function should return the average score of the test scores. + +```js +assert.strictEqual(getAverage([52, 56, 60, 65, 70, 75, 80, 85, 90, 95]), 72.8); +assert.strictEqual(getAverage([45, 50, 55, 60, 65, 70, 75, 80, 85, 90]), 67.5); +assert.strictEqual(getAverage([38, 42, 46, 50, 54, 58, 62, 66, 70, 74]), 56); +``` + +# --seed-- + +## --seed-contents-- + +```js +--fcc-editable-region-- +function getAverage(scores) { + +} + +console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89])); +console.log(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95])); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md new file mode 100644 index 00000000000..f7e9253a5a5 --- /dev/null +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626a060c4006f793e10cb33.md @@ -0,0 +1,104 @@ +--- +id: 6626a060c4006f793e10cb33 +title: Step 2 +challengeType: 1 +dashedName: step-2 +--- + +# --description-- + +Now the teacher needs your help converting the student score to a letter grade. + +Complete the `getGrade` function that takes a number `score` as a parameter. Your function should return a string representing a letter grade based on the score. + +Here are the scores and their corresponding letter grades: + +| Score Range | Grade | +| ----------- | ------- | +| `100` | `"A++"` | +| `90 - 99` | `"A"` | +| `80 - 89` | `"B"` | +| `70 - 79` | `"C"` | +| `60 - 69` | `"D"` | +| `0 - 59` | `"F"` | + + +**Tips** + +- Remember that you learned about conditional statements(`if`, `else if`, and `else`). +- Remember that you learned about comparison operators (`>`, `<`, `>=`, `<=`, `===`). + +# --hints-- + +Your `getGrade` function should return `"A++"` if the score is `100`. + +```js +assert.strictEqual(getGrade(100), "A++"); +``` + +Your `getGrade` function should return `"A"` if the score is `94`. + +```js +assert.strictEqual(getGrade(94), "A"); +``` + +Your `getGrade` function should return `"B"` if the score is between `80` and `89`. + +```js +assert.strictEqual(getGrade(80), "B"); +assert.strictEqual(getGrade(83), "B"); +assert.strictEqual(getGrade(88), "B"); +``` + +Your `getGrade` function should return `"C"` if the score is `78`. + +```js +assert.strictEqual(getGrade(75), "C"); +``` + +Your `getGrade` function should return `"D"` if the score is between `60` and `69`. + +```js +assert.strictEqual(getGrade(60), "D"); +assert.strictEqual(getGrade(63), "D"); +assert.strictEqual(getGrade(68), "D"); +``` + +Your `getGrade` function should return `"F"` if the score is `57`. + +```js +assert.strictEqual(getGrade(57), "F"); +``` + +Your `getGrade` function should return `"F"` if the score is between `0` and `59`. + +```js +assert.strictEqual(getGrade(0), "F"); +assert.strictEqual(getGrade(30), "F"); +assert.strictEqual(getGrade(43), "F"); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} +--fcc-editable-region-- +function getGrade(score) { + +} + +console.log(getGrade(96)); +console.log(getGrade(82)); +console.log(getGrade(56)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md new file mode 100644 index 00000000000..b168e1325fc --- /dev/null +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b4c58c027d86478ff5eb.md @@ -0,0 +1,88 @@ +--- +id: 6626b4c58c027d86478ff5eb +title: Step 3 +challengeType: 1 +dashedName: step-3 +--- + +# --description-- + +The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an `"F"`. + +Complete the function `hasPassingGrade` that takes a student score as a parameter. Your function should return `true` if the student has a passing grade and `false` if they do not. + +**Tips** + +- Use the `getGrade` function to get the student's grade. Then check if the grade is passing or not. + +# --hints-- + +Your `hasPassingGrade` function should return a boolean value. + +```js +assert.strictEqual(typeof hasPassingGrade(100), "boolean"); +``` + +Your `hasPassingGrade` function should return `true` if the grade is an `"A"`. + +```js +assert.isTrue(hasPassingGrade(100)); +``` + +Your `hasPassingGrade` function should return `false` if the grade is an `"F"`. + +```js +assert.isFalse(hasPassingGrade(53)); +``` + +Your `hasPassingGrade` function should return `true` for all passing grades. + +```js +assert.isTrue(hasPassingGrade(87)); +assert.isTrue(hasPassingGrade(60)); +assert.isTrue(hasPassingGrade(73)); +assert.isTrue(hasPassingGrade(96)); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +--fcc-editable-region-- +function hasPassingGrade(score) { + +} + + +console.log(hasPassingGrade(100)); +console.log(hasPassingGrade(53)); +console.log(hasPassingGrade(87)); +--fcc-editable-region-- +``` diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md new file mode 100644 index 00000000000..08ee3cea27b --- /dev/null +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/review-js-fundamentals-by-building-a-gradebook-app/6626b8dcf5057f896f948440.md @@ -0,0 +1,143 @@ +--- +id: 6626b8dcf5057f896f948440 +title: Step 4 +challengeType: 1 +dashedName: step-4 +--- + +# --description-- + +Now that the teacher has all of the information they need, they want to be able to message the student with the results. + +Complete the `studentMsg` function with `totalScores` and `studentScore` for parameters. The function should return a string representing a message to the student. + +If the student passed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You passed the course. +``` + +If the student failed the course, the string should follow this format: + +```js +Class average: average-goes-here. Your grade: grade-goes-here. You failed the course. +``` + +Replace `average-goes-here` with the average of the total scores. Replace `grade-goes-here` with the student's grade. + +**Tips** + +- Use the `getAverage` function to get the class average. +- Use the `getGrade` function to get the student's grade. +- Use string concatenation (`+`) to build the message. +- Be careful with the punctuation and spaces in the message. + +# --hints-- + +Your function call of `studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)` should return the following message: `"Class average: 71.7. Your grade: F. You failed the course."`. + +```js +assert.strictEqual(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37), "Class average: 71.7. Your grade: F. You failed the course."); +``` + +Your function call of `studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100)` should return the following message: `"Class average: 50.8. Your grade: A++. You passed the course."`. + +```js +assert.strictEqual(studentMsg([56, 23, 89, 42, 75, 11, 68, 34, 91, 19], 100), "Class average: 50.8. Your grade: A++. You passed the course."); +``` + +Your `studentMsg` function should return a the correct message based on the student's score and the class average. + +```js +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 92), "Class average: 70.25. Your grade: A. You passed the course."); +assert.strictEqual(studentMsg([33, 44, 55, 66, 77, 88, 99, 100], 57), "Class average: 70.25. Your grade: F. You failed the course."); +``` + +# --seed-- + +## --seed-contents-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +--fcc-editable-region-- +function studentMsg(totalScores, studentScore) { + +} +console.log(studentMsg([92, 88, 12, 77, 57, 100, 67, 38, 97, 89], 37)); +--fcc-editable-region-- + +``` + + +# --solutions-- + +```js +function getAverage(scores) { + let sum = 0; + + for (const score of scores) { + sum += score; + } + + return sum / scores.length; +} + +function getGrade(score) { + if (score === 100) { + return "A++"; + } else if (score >= 90) { + return "A"; + } else if (score >= 80) { + return "B"; + } else if (score >= 70) { + return "C"; + } else if (score >= 60) { + return "D"; + } else { + return "F"; + } +} + +function hasPassingGrade(score) { + return getGrade(score) !== "F"; +} + +function studentMsg(totalScores, studentScore) { + let average = getAverage(totalScores); + let grade = getGrade(studentScore); + + return `Class average: ${average}. Your grade: ${grade}. You ${ + hasPassingGrade(studentScore) ? "passed" : "failed" + } the course.`; +} + +```