diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f70a66ccdc42097ca051.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f70a66ccdc42097ca051.md index 0cb89869b70..6eaa3de4c2b 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f70a66ccdc42097ca051.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f70a66ccdc42097ca051.md @@ -17,7 +17,7 @@ You should have `for guess in range(1,10):` within the `else` block. const tCode = code.replace(/\r/g, ''); const {function_body} = __helpers.python.getDef(tCode, "solver"); const {block_body} = __helpers.python.getBlock(function_body, "else"); -assert.match(block_body, /for\s+\w+\s+in\s+range\(\s*1,\s*10\s*\)/); +assert.match(block_body, /for\s+\w+\s+in\s+range\(\s*1\s*,\s*10\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f7c7f6954944d207775f.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f7c7f6954944d207775f.md index d75df894d26..7b8349869ea 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f7c7f6954944d207775f.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f7c7f6954944d207775f.md @@ -19,7 +19,7 @@ You should have `row, col = next_empty` within the innermost `if` statement. const tCode = code.replace(/\r/g, ''); const {function_body} = __helpers.python.getDef(tCode, "solver"); const {block_body} = __helpers.python.getBlock(function_body, "if self.is_valid(next_empty, guess)"); -assert.match(block_body, /row,\s*col\s*=\s*next_empty/); +assert.match(block_body, /row\s*,\s*col\s*=\s*next_empty/); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddd65848a12919d7e1c7d0.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddd65848a12919d7e1c7d0.md index 772a5699559..14425de7f5e 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddd65848a12919d7e1c7d0.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddd65848a12919d7e1c7d0.md @@ -16,7 +16,7 @@ You should move the code nested inside the first `if` statement (except the firs ```js ({ test: () => { - assert.match(code, /def\s+make_allowed_move\(\s*rod1, rod2\s*\):\s+forward\s+=\s+False\s+if\s+not\s+rods\s*\[\s*target\s*\]\s*:\s+forward\s*=\s*True\s+elif\s+rods\s*\[\s*source\s*\]\s+and\s+rods\s*\[\s*source\s*\]\s*\[\s*-1\s*\]\s*<\s*rods\s*\[\s*target\s*\]\s*\[\s*-\s*1\s*\]\s*:\s+forward\s*=\s*True\s+if\s+forward\s*:\s+print\(\s*f'Moving\sdisk\s\{\s*rods\s*\[\s*source\s*\]\s*\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*source\s*\}\sto\s\{\s*target\s*\}'\s*\)\s+rods\s*\[\s*target\s*\]\s*\.append\(\s*rods\s*\[\s*source\s*\]\s*\.pop\(\s*\)\s*\)\s+else\s*:\s+print\(\s*f'Moving\sdisk\s\{\s*rods\s*\[\s*target\s*\]\s*\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*target\s*\}\sto\s\{\s*source\s*\}'\s*\)\s+rods\s*\[\s*source\s*\]\s*\.append\(\s*rods\s*\[\s*target\s*\]\s*\.pop\(\s*\)\s*\)\s+#\s*display\sour\sprogress\s+print\(\s*rods\s*\)/); + assert.match(code, /def\s+make_allowed_move\(\s*rod1\s*,\s*rod2\s*\):\s+forward\s+=\s+False\s+if\s+not\s+rods\s*\[\s*target\s*\]\s*:\s+forward\s*=\s*True\s+elif\s+rods\s*\[\s*source\s*\]\s+and\s+rods\s*\[\s*source\s*\]\s*\[\s*-1\s*\]\s*<\s*rods\s*\[\s*target\s*\]\s*\[\s*-\s*1\s*\]\s*:\s+forward\s*=\s*True\s+if\s+forward\s*:\s+print\(\s*f'Moving\sdisk\s\{\s*rods\s*\[\s*source\s*\]\s*\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*source\s*\}\sto\s\{\s*target\s*\}'\s*\)\s+rods\s*\[\s*target\s*\]\s*\.append\(\s*rods\s*\[\s*source\s*\]\s*\.pop\(\s*\)\s*\)\s+else\s*:\s+print\(\s*f'Moving\sdisk\s\{\s*rods\s*\[\s*target\s*\]\s*\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*target\s*\}\sto\s\{\s*source\s*\}'\s*\)\s+rods\s*\[\s*source\s*\]\s*\.append\(\s*rods\s*\[\s*target\s*\]\s*\.pop\(\s*\)\s*\)\s+#\s*display\sour\sprogress\s+print\(\s*rods\s*\)/); } }) ``` diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64e337e3096b7c1739d934e6.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64e337e3096b7c1739d934e6.md index 74363e55043..cd10c0efd23 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64e337e3096b7c1739d934e6.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64e337e3096b7c1739d934e6.md @@ -14,7 +14,7 @@ Before your recursive call, add a comment saying `move n - 1 disks from source t You should add a comment with the provided text before your recursive call. ```js -({ test: () => assert.match(code, /if\s+n\s*>\s*0\s*:\s+#\s*move\sn\s-\s1\sdisks\sfrom\ssource\sto\sauxiliary,\sso\sthey\sare\sout\sof\sthe\sway\s+(?=move\(\s*n\s*-\s*1\s*,\s*source\s*,\s*auxiliary\s*,\s*target\s*\))/) }) +({ test: () => assert.match(code, /if\s+n\s*>\s*0\s*:\s+#\s*move\sn\s-\s1\sdisks\sfrom\ssource\sto\sauxiliary\s*,\s*so\sthey\sare\sout\sof\sthe\sway\s+(?=move\(\s*n\s*-\s*1\s*,\s*source\s*,\s*auxiliary\s*,\s*target\s*\))/) }) ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/6564f0279e23ce924eedd1b2.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/6564f0279e23ce924eedd1b2.md index f879fb2ac72..5dc93e650c7 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/6564f0279e23ce924eedd1b2.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/6564f0279e23ce924eedd1b2.md @@ -21,7 +21,7 @@ You should delete the last three lines in your code. ({ test: () => { assert.isFalse(/pattern\s*=\s*r("|')\\W\1/.test(code)); assert.isFalse(/quote\s*=\s*("|')_\1/.test(code)); - assert.isFalse(/print\(\s*re\.findall\(\s*pattern, quote\s*\)\s*\)/.test(code)); + assert.isFalse(/print\(\s*re\.findall\(\s*pattern\s*,\s*quote\s*\)\s*\)/.test(code)); }}) ``` diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a153a6b362d103e125028.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a153a6b362d103e125028.md index e885930012e..7ed7f1e31c0 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a153a6b362d103e125028.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a153a6b362d103e125028.md @@ -16,13 +16,13 @@ Delete `pass` and recursively call the `_insert` method on the left child of the You should call the `self._insert` method passing `node.left` and `key` as the arguments. ```js -({ test: () => assert.match(code, /self\._insert\(\s*node\.left,\s*key\s*\)/) }); +({ test: () => assert.match(code, /self\._insert\(\s*node\.left\s*,\s*key\s*\)/) }); ``` You should assign the result of your `self._insert()` call to the `left` attribute of the current node. ```js -({ test: () => assert.match(code, /node\.left\s*=\s*self\._insert\(\s*node\.left,\s*key\s*\)/) }); +({ test: () => assert.match(code, /node\.left\s*=\s*self\._insert\(\s*node\.left\s*,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a158c7e80c810f6eff1e1.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a158c7e80c810f6eff1e1.md index 0191977d8fe..5374e9ac347 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a158c7e80c810f6eff1e1.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a158c7e80c810f6eff1e1.md @@ -14,13 +14,13 @@ Inside your `elif` clause, replace `pass` with a call to the `_insert` method on You should call the `self._insert()` method passing `node.right` and `key` as the arguments. ```js -({ test: () => assert.match(code, /self\._insert\(\s*node\.right,\s*key\s*\)/) }); +({ test: () => assert.match(code, /self\._insert\(\s*node\.right\s*,\s*key\s*\)/) }); ``` You should assign the result of your `self._insert()` call to the right attribute (`node.right`) of the current node. ```js -({ test: () => assert.match(code, /node\.right\s*=\s*self\._insert\(\s*node\.right,\s*key\s*\)/) }); +({ test: () => assert.match(code, /node\.right\s*=\s*self\._insert\(\s*node\.right\s*,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a167ea3e96512bf1343ce.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a167ea3e96512bf1343ce.md index 884f575c312..6eaadd1764c 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a167ea3e96512bf1343ce.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a167ea3e96512bf1343ce.md @@ -25,7 +25,7 @@ You should call the `_search` method within the `search` method. You should call the `_search` method passing `self.root` and `key` as the arguments. ```js -({ test: () => assert.match(code, /self\._search\(\s*self\.root,\s*key\s*\)/) }); +({ test: () => assert.match(code, /self\._search\(\s*self\.root\s*,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a16db1ccc5e132b5bc44d.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a16db1ccc5e132b5bc44d.md index 6c29c7be8c3..87c913f5814 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a16db1ccc5e132b5bc44d.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a16db1ccc5e132b5bc44d.md @@ -14,7 +14,7 @@ Now, make the `search` method return the result of the `_search()` call. You should prepend the `return` statement to your `_search()` call. ```js -({ test: () => assert.match(code, /return\s+self\._search\(\s*self\.root,\s*key\s*\)/) }); +({ test: () => assert.match(code, /return\s+self\._search\(\s*self\.root\s*,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a1a6d8c44db154b00c909.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a1a6d8c44db154b00c909.md index 5ed67b39c1e..a131fcbe30e 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a1a6d8c44db154b00c909.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a1a6d8c44db154b00c909.md @@ -23,7 +23,7 @@ assert.match(after_split, /if\s+key\s+<\s+node\.key/); You should return `self._search(node.left, key)` from your new `if` block. ```js -({ test: () => assert.match(code, /return\s+self\._search\(\s*node\.left,\s*key\s*\)/) }); +({ test: () => assert.match(code, /return\s+self\._search\(\s*node\.left\s*,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a44442b60ee5a28df8ee5.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a44442b60ee5a28df8ee5.md index ec1be7415f5..68267c9b8c3 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a44442b60ee5a28df8ee5.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a44442b60ee5a28df8ee5.md @@ -25,14 +25,14 @@ assert.match(after_split, /self\._search/); You should pass two arguments to the call of the `_search` method: `node.right` and `key`. ```js -({ test: () => assert.match(code, /self\._search\(\s*node\.right,\s*key\s*\)/) }); +({ test: () => assert.match(code, /self\._search\(\s*node\.right\s*,\s*key\s*\)/) }); ``` You should return the result of the `_search` method call. ```js ({ - test: () => assert.match(code, /return\s+self\._search\(\s*node\.right,\s*key\s*\)/) + test: () => assert.match(code, /return\s+self\._search\(\s*node\.right\s*,\s*key\s*\)/) }); ``` diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a452d40556e5c25e4aac8.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a452d40556e5c25e4aac8.md index 37b354f4ff6..5927195e766 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a452d40556e5c25e4aac8.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a452d40556e5c25e4aac8.md @@ -18,7 +18,7 @@ Within the `BinarySearchTree` class, define a `delete` method. It takes two para You should define a `delete` method with two parameters: `self` and `key`. Remember to use `pass`. ```js -({ test: () => assert.match(code, /def\s+delete\(\s*self,\s*key\s*\)/) }); +({ test: () => assert.match(code, /def\s+delete\(\s*self\s*,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a45c52fa3ea5ece3034c7.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a45c52fa3ea5ece3034c7.md index da90582f298..09eaa87bb9b 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a45c52fa3ea5ece3034c7.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a45c52fa3ea5ece3034c7.md @@ -14,7 +14,7 @@ Inside the `delete` method, delete `pass` and call the private helper method `_d Your `delete` method should call the `_delete` method with two arguments: `self.root` and `key`. ```js -({ test: () => assert.match(code, /self\._delete\(\s*self\.root,\s*key\s*\)/) }); +({ test: () => assert.match(code, /self\._delete\(\s*self\.root\s*,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a4614304cd36031cb4e75.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a4614304cd36031cb4e75.md index 96dc0ae6487..fb38080c87f 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a4614304cd36031cb4e75.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a4614304cd36031cb4e75.md @@ -16,7 +16,7 @@ To handle this case, assign the result of the `_delete` call to `self.root`. You should assign the result of the `_delete()` call to `self.root`. ```js -({ test: () => assert.match(code, /self\.root\s*=\s*self\._delete\(\s*self\.root,\s*key\s*\)/) }); +({ test: () => assert.match(code, /self\.root\s*=\s*self\._delete\(\s*self\.root\s*,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a46aa8e10c26218c5034c.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a46aa8e10c26218c5034c.md index eaad945afe5..e545d3132eb 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a46aa8e10c26218c5034c.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a46aa8e10c26218c5034c.md @@ -14,7 +14,7 @@ Inside the `BinarySearchTree` class, define a new helper method called `_delete` You should define the `_delete` method inside the `BinarySearchTree` class with the parameters `self`, `node` and `key`. Remember to use the `pass` keyword. ```js -assert.match(code, /def\s+_delete\(\s*self,\s*node,\s*key\s*\)/); +assert.match(code, /def\s+_delete\(\s*self\s*,\s*node\s*,\s*key\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a47a9404d856743c7f529.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a47a9404d856743c7f529.md index 4ab93b0ed1e..f40522ef6af 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a47a9404d856743c7f529.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a47a9404d856743c7f529.md @@ -14,13 +14,13 @@ Within the `if` block, replace `pass` with a call to the `_delete` method, passi You should call the `_delete` method with `node.left` and the `key` as the arguments. ```js -assert.match(code, /self\._delete\(\s*node\.left,\s*key\s*\)/); +assert.match(code, /self\._delete\(\s*node\.left\s*,\s*key\s*\)/); ``` You should assign the result of the `_delete()` call to the left child (`node.left`) of the current node. ```js -assert.match(code, /node\.left\s*=\s*self\._delete\(\s*node\.left,\s*key\s*\)/); +assert.match(code, /node\.left\s*=\s*self\._delete\(\s*node\.left\s*,\s*key\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a482dfc92896901b9c97e.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a482dfc92896901b9c97e.md index a24eec35d86..b17d328b8ba 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a482dfc92896901b9c97e.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a482dfc92896901b9c97e.md @@ -23,13 +23,13 @@ assert.match(after_split, /elif\s+key\s+>\s+node\.key/); You should call the `_delete` method with `node.right` and `key` as the arguments. ```js -assert.match(code, /self\._delete\(\s*node\.right,\s*key\s*\)/); +assert.match(code, /self\._delete\(\s*node\.right\s*,\s*key\s*\)/); ``` You should assign the result of the `_delete()` call to `node.right`. ```js -assert.match(code, /node\.right\s*=\s*self\._delete\(\s*node\.right,\s*key\s*\)/); +assert.match(code, /node\.right\s*=\s*self\._delete\(\s*node\.right\s*,\s*key\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a50f992ba7177aff2b718.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a50f992ba7177aff2b718.md index df79cef13cd..a461e9b021b 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a50f992ba7177aff2b718.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a50f992ba7177aff2b718.md @@ -22,7 +22,7 @@ assert.match(code, /self\._delete\(\s*node\.right\s*,\s*node\.key\s*/); You should assign the return value of the `_delete()` call to the right child of the current node. ```js -assert.match(code, /node\.right\s*=\s*self\._delete\(\s*node\.right\,\s*node\.key/); +assert.match(code, /node\.right\s*=\s*self\._delete\(\s*node\.right\s*,\s*node\.key/); ``` # --seed-- @@ -78,6 +78,6 @@ class BinarySearchTree: elif node.right is None: return node.left --fcc-editable-region-- - node.key = self._min_value(node.right) + node.key = self._min_value(node.right) --fcc-editable-region-- ``` diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a54cd88e33b8646c67e16.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a54cd88e33b8646c67e16.md index 7ac465af0b6..183d9570a5a 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a54cd88e33b8646c67e16.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a54cd88e33b8646c67e16.md @@ -16,7 +16,7 @@ This will start the traversal from the root of the binary search tree (`self.roo You should call `_inorder_traversal` and pass `self.root` and `result` as the arguments. ```js -({ test: () => assert.match(code, /self\._inorder_traversal\(\s*self\.root,\s*result\s*\)/) }) +({ test: () => assert.match(code, /self\._inorder_traversal\(\s*self\.root\s*,\s*result\s*\)/) }) ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a552337ee62882fdeee79.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a552337ee62882fdeee79.md index de22b90ce88..b3e25204803 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a552337ee62882fdeee79.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a552337ee62882fdeee79.md @@ -14,7 +14,7 @@ Define the `_inorder_traversal` method and give it three parameters: `self`, `no You should define a method `_inorder_traversal` that takes three parameters: `self`, `node`, and `result`. Remember to use `pass`. ```js -assert.match(code, /def\s+_inorder_traversal\(\s*self,\s*node,\s*result\s*\)/); +assert.match(code, /def\s+_inorder_traversal\(\s*self\s*,\s*node\s*,\s*result\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a577302a8a791ed62e8d9.md b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a577302a8a791ed62e8d9.md index 32a145ce809..85aff713768 100644 --- a/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a577302a8a791ed62e8d9.md +++ b/curriculum/challenges/english/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a577302a8a791ed62e8d9.md @@ -16,7 +16,7 @@ This recursive call explores the entire right subtree in an in-order manner. You should call `_inorder_traversal` passing `node.right` and `result` as the arguments. ```js -assert.match(code, /self\._inorder_traversal\(\s*node\.right,\s*result\s*\)/); +assert.match(code, /self\._inorder_traversal\(\s*node\.right\s*,\s*result\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md index e2a338fb02b..cadddf17350 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md @@ -34,7 +34,7 @@ assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDiffere Your `reduce` callback should return the sum of `acc` and `el`. ```js -assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDifferences\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*return\s*acc\s*\+\s*el\s*\;\s*\},\s*0\s*\)/); +assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDifferences\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*return\s*acc\s*\+\s*el\s*\;\s*\}\s*,\s*0\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/64648c3254e52901e36e7703.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/64648c3254e52901e36e7703.md index c827c76b42e..643b6c2c453 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/64648c3254e52901e36e7703.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/64648c3254e52901e36e7703.md @@ -16,14 +16,14 @@ Now you should see the avatars displayed on the page. You should call the function named `avatars`. ```js -const avatarsTest = /\$\{[\s]*avatars[\s]*\([\s]*[^)]*[\s]*\)[\s]*\}/gm; +const avatarsTest = /\$\{\s*avatars\s*\(\s*[^)]*\s*\)\s*\}/gm; assert(code.match(avatarsTest)); ``` Your function call should have the arguments of `posters` and `users`. ```js -const avatarsTest = /\$\{[\s]*avatars[\s]*\([\s]*posters[\s]*,[\s]*users[\s]*\)[\s]*\}/gm; +const avatarsTest = /\$\{\s*avatars\s*\(\s*posters\s*,\s*users\s*\)\s*\}/gm; assert(code.match(avatarsTest)); ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f02a4ef92d711ec1ff618c.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f02a4ef92d711ec1ff618c.md index d8a3baed26e..6da88dc9e62 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f02a4ef92d711ec1ff618c.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f02a4ef92d711ec1ff618c.md @@ -53,7 +53,7 @@ Your `reduce` call should have an initial value of `0`. ```js const afterCalculateTotal = code.split('calculateTotal')[1]; -assert.match(afterCalculateTotal, /this\s*\.\s*items\s*\.\s*reduce\s*\(\s*\(\s*total,\s*item\s*\)\s*=>\s*total\s*\+\s*item\.price\s*,\s*0\s*\)/); +assert.match(afterCalculateTotal, /this\s*\.\s*items\s*\.\s*reduce\s*\(\s*\(\s*total\s*,\s*item\s*\)\s*=>\s*total\s*\+\s*item\.price\s*,\s*0\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65364566e84e378837fbaf2a.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65364566e84e378837fbaf2a.md index 26d9b456ba6..e88f9bcfcf8 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65364566e84e378837fbaf2a.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65364566e84e378837fbaf2a.md @@ -28,7 +28,7 @@ assert.match(code, /playButton\.addEventListener\(\s*('|"|`)click\1/) You should use arrow syntax to pass in an empty callback into your event listener. Don't forget you also need an empty pair of curly braces. ```js -assert.match(code, /playButton\.addEventListener\(\s*('|"|`)click\1,\s*\(\s*\)\s*=>\s*\{\s*\}\s*\);?/) +assert.match(code, /playButton\.addEventListener\(\s*('|"|`)click\1\s*,\s*\(\s*\)\s*=>\s*\{\s*\}\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552303a9a78704f8ff072e9.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552303a9a78704f8ff072e9.md index ba578dc4778..14521c51612 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552303a9a78704f8ff072e9.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552303a9a78704f8ff072e9.md @@ -28,7 +28,7 @@ assert.match(code, /pauseButton\.addEventListener\(\s*('|"|`)click\1/) You should pass in `pauseSong` as the second argument of your `addEventListener` method. ```js -assert.match(code, /pauseButton\.addEventListener\(\s*('|"|`)click\1,\s*pauseSong\s*\)/) +assert.match(code, /pauseButton\.addEventListener\(\s*('|"|`)click\1\s*,\s*pauseSong\s*\)/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65547ee197840478a1b95f4b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65547ee197840478a1b95f4b.md index 2e42f0eb604..f2ab5c735df 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65547ee197840478a1b95f4b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65547ee197840478a1b95f4b.md @@ -28,7 +28,7 @@ assert.match(code, /nextButton\.addEventListener\(\s*('|"|`)click\1/) You should pass in `playNextSong` as the second argument of your `addEventListener` method. ```js -assert.match(code, /nextButton\.addEventListener\(\s*('|"|`)click\1,\s*playNextSong\s*\)/) +assert.match(code, /nextButton\.addEventListener\(\s*('|"|`)click\1\s*,\s*playNextSong\s*\)/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655485321913feabbc5f00f8.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655485321913feabbc5f00f8.md index 692c1ad4fdc..35f65581b8e 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655485321913feabbc5f00f8.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655485321913feabbc5f00f8.md @@ -26,7 +26,7 @@ assert.match(code, /previousButton\.addEventListener\(\s*('|"|`)click\1/) You should pass in `playPreviousSong` as the second argument of your `addEventListener` method. ```js -assert.match(code, /previousButton\.addEventListener\(\s*('|"|`)click\1,\s*playPreviousSong\s*\)/) +assert.match(code, /previousButton\.addEventListener\(\s*('|"|`)click\1\s*,\s*playPreviousSong\s*\)/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555de565387a2efe90a6ccc.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555de565387a2efe90a6ccc.md index 6423d26816d..5dc5815abc6 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555de565387a2efe90a6ccc.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555de565387a2efe90a6ccc.md @@ -34,7 +34,7 @@ assert.match(code, /playButton\.setAttribute\(\s*('|")aria-label\1/) Your `setAttribute` method should have ``song?.title ? `Play ${song.title}` : "Play"`` as the second argument. ```js -assert.match(code, /playButton\.setAttribute\(\s*('|")aria-label\1,\s*song\?\.title\s*\?\s*`Play\s*\$\{song\.title\}`\s*:\s*('|")Play\2\s*\);?\s*/) +assert.match(code, /playButton\.setAttribute\(\s*('|")aria-label\1\s*,\s*song\?\.title\s*\?\s*`Play\s*\$\{song\.title\}`\s*:\s*('|")Play\2\s*\);?\s*/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e7acdbae972d3e8e0f5b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e7acdbae972d3e8e0f5b.md index c8b49fc4578..090a4344864 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e7acdbae972d3e8e0f5b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e7acdbae972d3e8e0f5b.md @@ -28,7 +28,7 @@ assert.match(code, /shuffleButton\.addEventListener\(\s*('|")click\1/) You should pass in `shuffle` as the second value of your `click` event listener. ```js -assert.match(code, /shuffleButton\.addEventListener\(\s*('|")click\1,\s*shuffle\s*\);?/) +assert.match(code, /shuffleButton\.addEventListener\(\s*('|")click\1\s*,\s*shuffle\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572e5aaf022790fb4a81b1.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572e5aaf022790fb4a81b1.md index ccedcd8b98b..fe7a461928c 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572e5aaf022790fb4a81b1.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572e5aaf022790fb4a81b1.md @@ -28,7 +28,7 @@ assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1/) The callback function of your event listener should use arrow syntax and have an empty pair of curly braces. ```js -assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1,\s*\(\s*\)\s*=>\s*\{\s*\}\s*\);?/) +assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1\s*,\s*\(\s*\)\s*=>\s*\{\s*\}\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655737cd004591b0271d6826.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655737cd004591b0271d6826.md index fa0d6dbf302..517da99a953 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655737cd004591b0271d6826.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655737cd004591b0271d6826.md @@ -16,7 +16,7 @@ To reset the playlist to its original state, spread `allSongs` into an array and You should not modify the existing event listener and its content. ```js -assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1,\s*\(\s*\)\s*=>\s*\{\s*.*\s*\}\s*\);?/) +assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1\s*,\s*\(\s*\)\s*=>\s*\{\s*.*\s*\}\s*\);?/) ``` You should assign `[...allSongs]` to `userData.songs`. diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573a97c59ddbbf028ca95e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573a97c59ddbbf028ca95e.md index 3034c4f3b3e..03c2a599d84 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573a97c59ddbbf028ca95e.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573a97c59ddbbf028ca95e.md @@ -22,25 +22,25 @@ Remove the reset button from the playlist by calling the `remove()` method on th You should not modify the existing event listener and its content. ```js -assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1,\s*\(\s*\)\s*=>\s*\{\s*userData\.songs\s*=\s*\[\s*\.\.\.allSongs\s*\]\s*;?\s*.*\s*.*\s*.*\s*\}\s*\);?/) +assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1\s*,\s*\(\s*\)\s*=>\s*\{\s*userData\.songs\s*=\s*\[\s*\.\.\.allSongs\s*\]\s*;?\s*.*\s*.*\s*.*\s*\}\s*\);?/) ``` You should call the `renderSongs` function with `userData?.songs`. ```js -assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1,\s*\(\s*\)\s*=>\s*\{\s*userData\.songs\s*=\s*\[\s*\.\.\.allSongs\s*\]\s*;?\s*renderSongs\(\s*userData\?\.songs\s*\);?\s*.*\s*.*\s*\}\s*\);?/) +assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1\s*,\s*\(\s*\)\s*=>\s*\{\s*userData\.songs\s*=\s*\[\s*\.\.\.allSongs\s*\]\s*;?\s*renderSongs\(\s*userData\?\.songs\s*\);?\s*.*\s*.*\s*\}\s*\);?/) ``` You should call the `setPlayButtonAccessibleText` function. ```js -assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1,\s*\(\s*\)\s*=>\s*\{\s*userData\.songs\s*=\s*\[\s*\.\.\.allSongs\s*\]\s*;?\s*renderSongs\(\s*userData\?\.songs\s*\);?\s*setPlayButtonAccessibleText\(\s*\);?\s*.*\s*\}\s*\);?/) +assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1\s*,\s*\(\s*\)\s*=>\s*\{\s*userData\.songs\s*=\s*\[\s*\.\.\.allSongs\s*\]\s*;?\s*renderSongs\(\s*userData\?\.songs\s*\);?\s*setPlayButtonAccessibleText\(\s*\);?\s*.*\s*\}\s*\);?/) ``` You should use the `remove()` method to remove the `resetButton` from the DOM. ```js -assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1,\s*\(\s*\)\s*=>\s*\{\s*userData\.songs\s*=\s*\[\s*\.\.\.allSongs\s*\]\s*;?\s*renderSongs\(\s*userData\?\.songs\s*\);?\s*setPlayButtonAccessibleText\(\s*\);?\s*resetButton\.remove\(\s*\);?\s*\}\s*\);?/) +assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1\s*,\s*\(\s*\)\s*=>\s*\{\s*userData\.songs\s*=\s*\[\s*\.\.\.allSongs\s*\]\s*;?\s*renderSongs\(\s*userData\?\.songs\s*\);?\s*setPlayButtonAccessibleText\(\s*\);?\s*resetButton\.remove\(\s*\);?\s*\}\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573d0abe4d38cd6fa13f44.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573d0abe4d38cd6fa13f44.md index 4dcd3085f91..892558b7517 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573d0abe4d38cd6fa13f44.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573d0abe4d38cd6fa13f44.md @@ -30,7 +30,7 @@ assert.match(code, /audio\.addEventListener\(\s*('|")ended\1/) You should use arrow syntax to pass in an empty callback to your `ended` event listener. ```js -assert.match(code, /audio\.addEventListener\(\s*('|")ended\1,\s*\(\s*\)\s*=>\s*\{\s*\}\s*\);?/) +assert.match(code, /audio\.addEventListener\(\s*('|")ended\1\s*,\s*\(\s*\)\s*=>\s*\{\s*\}\s*\);?/) ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b49333d9f265bc1512152.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b49333d9f265bc1512152.md index 233cca55f6c..36b60664049 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b49333d9f265bc1512152.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b49333d9f265bc1512152.md @@ -18,13 +18,13 @@ After that, create a `nextSongExists` constant that contains the boolean value ` You should not modify the existing `ended` event listener and its content. ```js -assert.match(code, /audio\.addEventListener\(\s*('|")ended\1,\s*\(\s*\)\s*=>\s*\{\s*.*\s*.*\s*\}\s*\);?/) +assert.match(code, /audio\.addEventListener\(\s*('|")ended\1\s*,\s*\(\s*\)\s*=>\s*\{\s*.*\s*.*\s*\}\s*\);?/) ``` You should create a `currentSongIndex` constant and set it to the calling of the `getCurrentSongIndex` function. ```js -assert.match(code, /audio\.addEventListener\(\s*('|")ended\1,\s*\(\s*\)\s*=>\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\s*\);?\s*.*\s*\}\s*\);?/) +assert.match(code, /audio\.addEventListener\(\s*('|")ended\1\s*,\s*\(\s*\)\s*=>\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\s*\);?\s*.*\s*\}\s*\);?/) ``` You should check if a next song exists comparing `userData.songs.length` and `currentSongIndex` and set it to a `nextSongExists` constant. If the last index of the songs array (`userData.songs.length - 1`) is bigger than the currentSongIndex that means there is a next song. diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da615af82bf454215a992.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da615af82bf454215a992.md index 7ffc7efc825..f8709e918d9 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da615af82bf454215a992.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da615af82bf454215a992.md @@ -22,19 +22,19 @@ assert.match(code, /authors\.forEach\(\s*\(\s*\{\s*(?:author\s*,\s*image\s*,\s*u You should destructure `index` as the second parameter of your callback function. It has to be outside of the curly braces you put the others in. ```js -assert.match(code, /authors\.forEach\(\s*\(\s*\{.*\}\s*\,\s*index\s*\)/) +assert.match(code, /authors\.forEach\(\s*\(\s*\{.*\}\s*,\s*index\s*\)/) ``` Your callback function should use an arrow syntax. ```js -assert.match(code, /authors\.forEach\(\s*\(\s*\{.*\}\s*\,\s*index\s*\)\s*=>\s*/) +assert.match(code, /authors\.forEach\(\s*\(\s*\{.*\}\s*,\s*index\s*\)\s*=>\s*/) ``` Your callback function should be empty. ```js -assert.match(code, /authors\.forEach\(\s*\(\s*\{.*\}\s*\,\s*index\s*\)\s*=>\s*\{\s*\}\s*\);?/) +assert.match(code, /authors\.forEach\(\s*\(\s*\{.*\}\s*,\s*index\s*\)\s*=>\s*\{\s*\}\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da791d0c34a472b8d15b6.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da791d0c34a472b8d15b6.md index 9adda9d1dd3..58c6fb34389 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da791d0c34a472b8d15b6.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da791d0c34a472b8d15b6.md @@ -28,13 +28,13 @@ assert.match(code, /console\.log\(\s*("|'|`)Author\s+Data\s+Array:\s*\1/) You should use comma to separate your `Author Data Array:` text and `authorDataArr`. ```js -assert.match(code, /console\.log\(\s*("|'|`)Author\s+Data\s+Array:\s*\1\,/) +assert.match(code, /console\.log\(\s*("|'|`)Author\s+Data\s+Array:\s*\1\s*,/) ``` `authorDataArr` should be the second argument of your console log statement. ```js -assert.match(code, /console\.log\(\s*("|'|`)Author\s+Data\s+Array:\s*\1\,\s*authorDataArr\s*\);?/) +assert.match(code, /console\.log\(\s*("|'|`)Author\s+Data\s+Array:\s*\1\s*,\s*authorDataArr\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da7bfbc7f0f477438ad8a.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da7bfbc7f0f477438ad8a.md index ea861905529..3cafad4cdbc 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da7bfbc7f0f477438ad8a.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da7bfbc7f0f477438ad8a.md @@ -22,7 +22,7 @@ assert.match(code, /authorDataArr\s*=\s*data;?/) You should remove the console log statement showing `authorDataArr` ```js -assert.notMatch(code, /console\.log\(\s*("|'|`)Author\s+Data\s+Array:\s*\1\,\s*authorDataArr\s*\);?/) +assert.notMatch(code, /console\.log\(\s*("|'|`)Author\s+Data\s+Array:\s*\1\s*,\s*authorDataArr\s*\);?/) ``` You should call your `displayAuthors` function. @@ -46,7 +46,7 @@ assert.match(code, /displayAuthors\(\s*authorDataArr\.slice\(\s*startingIndex/) The second parameter of your `slice()` method should be `endingIndex`. ```js -assert.match(code, /displayAuthors\(\s*authorDataArr\.slice\(\s*startingIndex\,\s*endingIndex\s*\)\s*\);?/) +assert.match(code, /displayAuthors\(\s*authorDataArr\.slice\(\s*startingIndex\s*,\s*endingIndex\s*\)\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da97c987a514959ada414.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da97c987a514959ada414.md index ac2266cb1a4..0368cca3ac4 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da97c987a514959ada414.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da97c987a514959ada414.md @@ -38,7 +38,7 @@ The second argument of your `slice()` method should be `endingIndex`. ```js const afterAdd = code.split("endingIndex += 8;")[1]; -assert.match(afterAdd, /displayAuthors\(\s*authorDataArr\.slice\(\s*startingIndex\,\s*endingIndex\s*\)\s*\)/) +assert.match(afterAdd, /displayAuthors\(\s*authorDataArr\.slice\(\s*startingIndex\s*,\s*endingIndex\s*\)\s*\)/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da9aceb788e49a73ebcc9.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da9aceb788e49a73ebcc9.md index f4069b7fd61..ef544ee4a02 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da9aceb788e49a73ebcc9.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da9aceb788e49a73ebcc9.md @@ -30,7 +30,7 @@ assert.match(code, /loadMoreBtn\.addEventListener\(\s*('|"|`)click\1/) Your event listener should take `fetchMoreAuthors` as the function to run. ```js -assert.match(code, /loadMoreBtn\.addEventListener\(\s*('|"|`)click\1,\s*fetchMoreAuthors\s*\);?/) +assert.match(code, /loadMoreBtn\.addEventListener\(\s*('|"|`)click\1\s*,\s*fetchMoreAuthors\s*\);?/) ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641daabed8d0584b1150c953.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641daabed8d0584b1150c953.md index 4cf1725b8f2..d4c944d31db 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641daabed8d0584b1150c953.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641daabed8d0584b1150c953.md @@ -34,13 +34,13 @@ assert.match(code, /\s*\$\{\s*bio\.length\s*>\s*50/) If the `bio` text is greater than `50` characters, you should extract the first 50 characters with `slice()` and replace the rest with `...`. Don't forget that indexes are zero-based. ```js -assert.match(code, /\s*\$\{\s*bio\.length\s*>\s*50\s*\?\s*(?:bio\.slice\(\s*0\s*\,\s*50\s*\)\s*\+\s*("|')\.\.\.\2|`\$\{\s*bio\.slice\(\s*0\s*,\s*50\s*\)\s*\}\.\.\.`)\s*:/); +assert.match(code, /\s*\$\{\s*bio\.length\s*>\s*50\s*\?\s*(?:bio\.slice\(\s*0\s*,\s*50\s*\)\s*\+\s*("|')\.\.\.\2|`\$\{\s*bio\.slice\(\s*0\s*,\s*50\s*\)\s*\}\.\.\.`)\s*:/); ``` If the `bio` text is less than 50 characters, use the `bio` text directly. ```js -assert.match(code, /\s*\$\{\s*bio\.length\s*>\s*50\s*\?\s*(?:bio\.slice\(\s*0\s*\,\s*50\s*\)\s*\+\s*("|')\.\.\.\2|`\$\{\s*bio\.slice\(\s*0\s*,\s*50\s*\)\s*\}\.\.\.`)\s*:\s*bio\s*\}\s*<\/p>/); +assert.match(code, /\s*\$\{\s*bio\.length\s*>\s*50\s*\?\s*(?:bio\.slice\(\s*0\s*,\s*50\s*\)\s*\+\s*("|')\.\.\.\2|`\$\{\s*bio\.slice\(\s*0\s*,\s*50\s*\)\s*\}\.\.\.`)\s*:\s*bio\s*\}\s*<\/p>/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md index 02383be897f..139cf580330 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md @@ -38,7 +38,7 @@ assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*cons You should pass `infix` as the second argument to `infixEval()`. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md index 1ea064565a1..e84e64dbfe2 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md @@ -16,19 +16,19 @@ This expression will look for function calls like `sum(1, 4)`. You should declare a `functionCall` variable. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*(?:const|let|var)\s+functionCall\s*=/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*(?:const|let|var)\s+functionCall\s*=/); ``` You should use `const` to declare your `functionCall` variable. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=/); ``` You should assign `functionCall` the provided regular expression. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md index b6fe908bbf8..76b05cfc73d 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md @@ -14,55 +14,55 @@ Declare a `toNumberList` function which takes an `args` parameter, and returns t You should declare a `toNumberList` variable. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*(?:const|let|var)\s+toNumberList\s*=/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*(?:const|let|var)\s+toNumberList\s*=/); ``` You should use `const` to declare your `toNumberList` variable. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=/); ``` Your `toNumberList` variable should be an arrow function. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(\(\s*(?:args)?\s*\)|args)\s*=>/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(\(\s*(?:args)?\s*\)|args)\s*=>/); ``` Your `toNumberList` function should have an `args` parameter. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(\(\s*args\s*\)|args)\s*=>/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(\(\s*args\s*\)|args)\s*=>/); ``` Your `toNumberList` function should use an implicit return. ```js -assert.notMatch(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(\(\s*args\s*\)|args)\s*=>\s*\{/); +assert.notMatch(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(\(\s*args\s*\)|args)\s*=>\s*\{/); ``` Your `toNumberList` function should return the result of calling the `.split()` method of `args`. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(\(\s*args\s*\)|args)\s*=>\s*args\.split\(/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(\(\s*args\s*\)|args)\s*=>\s*args\.split\(/); ``` You should split `args` on the `,` character. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(?:\(\s*args\s*\)|args)\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(?:\(\s*args\s*\)|args)\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)/); ``` You should chain the `.map()` method to the `.split()` method. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(?:\(\s*args\s*\)|args)\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(?:\(\s*args\s*\)|args)\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(/); ``` You should pass a reference to `parseFloat` as the callback to `.map()`. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(?:\(\s*args\s*\)|args)\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*(?:\(\s*args\s*\)|args)\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?/); ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md index 3d6821dadd1..c9e0af0169c 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md @@ -14,37 +14,37 @@ Declare an `apply` function that takes a `fn` and `args` parameter. You should declare an `apply` variable. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*(?:var|let|const)\s+apply\s*=/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*(?:var|let|const)\s+apply\s*=/); ``` You should use `const` to declare your `apply` variable. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=/); ``` Your `apply` variable should be assigned an arrow function. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(/); ``` Your `apply` function should have `fn` as its first parameter. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn/); ``` Your `apply` function should have `args` as its second parameter. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)/); ``` Your `apply` function should be empty. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*\{\s*\}/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*\{\s*\}/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md index 18d0465bd29..850121a0317 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md @@ -16,25 +16,25 @@ Remember that `fn` might not be lowercase, so you'll need to convert it to a low Your `apply` function should use an implicit return. ```js -assert.notMatch(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*\{/); +assert.notMatch(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*\{/); ``` Your `apply` function should access the `spreadsheetFunctions` object. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions/); ``` Your `apply` function should access the property of the `spreadsheetFunctions` object that matches the `fn` value. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn/); ``` Your `apply` function should call the `.toLowerCase()` method on `fn` in the property access. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]/); ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md index b14d113cdfd..f5757ba19eb 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md @@ -14,19 +14,19 @@ Your `apply` function is returning the spreadsheet function, but not actually ap Your `apply` function should call the `spreadsheetFunctions[fn.toLowerCase()]` function. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(/); ``` You should pass a `toNumberList()` call to your `spreadsheetFunctions[fn.toLowerCase()]` call. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(/); ``` You should pass `args` to your `toNumberList()` call. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md index 95734fb4ffe..83dcd338a09 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md @@ -14,19 +14,19 @@ Now your `applyFunction` needs to return a result. Return the result of calling Your `applyFunction` function should return the result of calling the `.replace()` method on `str2`. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(/); ``` You should pass `functionCall` as the first argument to your `.replace()` call. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall/); ``` You should pass an empty arrow function as the second argument to your `.replace()` call. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*\)\s*=>\s*\{\s*\}/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*\)\s*=>\s*\{\s*\}/); ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md index 8eb18bbd464..cbfdbf6be78 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md @@ -16,43 +16,43 @@ Remember to make `fn` lower case. Your callback function should have `match` as the first parameter. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match/); ``` Your callback function should have `fn` as the second parameter. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn/); ``` Your callback function should have `args` as the third parameter. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>/); ``` Your callback function should use an implicit return. ```js -assert.notMatch(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*\{/); +assert.notMatch(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*\{/); ``` Your callback function should return the result of calling the `.hasOwnProperty()` method on the `spreadsheetFunctions` object. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(/); ``` You should pass `fn` to the .`hasOwnProperty()` method. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn/); ``` You should call the `.toLowerCase()` method on `fn`. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn\.toLowerCase\(\s*\)\s*\)/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn\.toLowerCase\(\s*\)\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md index 1fd62328533..1049cf16158 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md @@ -14,31 +14,31 @@ Use the ternary operator to turn your `.hasOwnProperty()` call into the conditio Your callback function should use ternary syntax. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn\.toLowerCase\(\s*\)\s*\)\s*\?/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn\.toLowerCase\(\s*\)\s*\)\s*\?/); ``` If the ternary condition is true, your callback function should return the result of calling `apply()`. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\s*\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\s*\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn\.toLowerCase\(\s*\)\s*\)\s*\?\s*apply\(/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\s*\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\s*\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn\.toLowerCase\(\s*\)\s*\)\s*\?\s*apply\(/); ``` You should pass `fn` as the first argument to your `apply()` call. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn\.toLowerCase\(\s*\)\s*\)\s*\?\s*apply\(\s*fn/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn\.toLowerCase\(\s*\)\s*\)\s*\?\s*apply\(\s*fn/); ``` You should pass `args` as the second argument to your `apply()` call. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn\.toLowerCase\(\s*\)\s*\)\s*\?\s*apply\(\s*fn\s*,\s*args\s*\)/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn\.toLowerCase\(\s*\)\s*\)\s*\?\s*apply\(\s*fn\s*,\s*args\s*\)/); ``` If the ternary is false, you should return `match`. ```js -assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*\,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn\.toLowerCase\(\s*\)\s*\)\s*\?\s*apply\(\s*fn\s*,\s*args\s*\)\s*:\s*match/); +assert.match(code, /const\s+applyFunction\s*=\s*\(?\s*str\s*\)?\s*=>\s*\{\s*const\s+noHigh\s*=\s*highPrecedence\(\s*str\s*\);?\s*const\s+infix\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\+-|-\+)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)\/;?\s*const\s+str2\s*=\s*infixEval\(\s*noHigh\s*,\s*infix\s*\);?\s*const\s+functionCall\s*=\s*\/\(\[a-z\]\*\)\\\(\(\[0-9\., \]\*\)\\\)\(\?!\.\*\\\(\)\/i;?\s*const\s+toNumberList\s*=\s*\(?\s*args\s*\)?\s*=>\s*args\.split\(\s*('|"|`),\1\s*\)\.map\(\s*parseFloat\s*\);?\s*const\s+apply\s*=\s*\(\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\s*\[\s*fn\.toLowerCase\(\s*\)\s*\]\s*\(\s*toNumberList\(\s*args\s*\)\s*\);?\s*return\s+str2\.replace\(\s*functionCall\s*,\s*\(\s*match\s*,\s*fn\s*,\s*args\s*\)\s*=>\s*spreadsheetFunctions\.hasOwnProperty\(\s*fn\.toLowerCase\(\s*\)\s*\)\s*\?\s*apply\(\s*fn\s*,\s*args\s*\)\s*:\s*match/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657ca764afcc5221ee01f1a9.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657ca764afcc5221ee01f1a9.md index 578f8de325f..5c9e0b62cb3 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657ca764afcc5221ee01f1a9.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657ca764afcc5221ee01f1a9.md @@ -28,7 +28,7 @@ assert.match(code, /rollDiceBtn\.addEventListener\s*\(\s*('|"|`)\s*click\s*\1\s* You should have an empty arrow function for the second argument for the `addEventListener()` method. ```js -assert.match(code, /rollDiceBtn\.addEventListener\s*\(\s*("|'|`)\s*click\s*\1,\s*\(\s*\)\s*=>\s*{\s*[\s\S]*\s*}\s*\);/); +assert.match(code, /rollDiceBtn\.addEventListener\s*\(\s*("|'|`)\s*click\s*\1\s*,\s*\(\s*\)\s*=>\s*{\s*[\s\S]*\s*}\s*\);/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e253cf2c01685ed84c1ee.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e253cf2c01685ed84c1ee.md index eaab72b76fa..8718031e22b 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e253cf2c01685ed84c1ee.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e253cf2c01685ed84c1ee.md @@ -36,7 +36,7 @@ assert.match(code, /const\s+sortedNumbersArr\s*=\s*arr\.sort\(.*\);?/); Your callback function should use `a` and `b` for the parameters and implicitly return `a - b`. ```js -assert.match(code, /const\s+sortedNumbersArr\s*=\s*(?:arr\.sort\(\s*\(\s*a,\s*b\s*\)\s*=>\s*a\s*-\s*b\s*\));?/); +assert.match(code, /const\s+sortedNumbersArr\s*=\s*(?:arr\.sort\(\s*\(\s*a\s*,\s*b\s*\)\s*=>\s*a\s*-\s*b\s*\));?/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64c9efea385ca536bf467a7c.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64c9efea385ca536bf467a7c.md index 918e63bc77e..9b3f1551643 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64c9efea385ca536bf467a7c.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64c9efea385ca536bf467a7c.md @@ -15,7 +15,7 @@ You should have a boolean expression that checks if the sum of the player's `y` ```js -assert.match(code, /const\s+collisionDetectionRules\s*=\s*\[\s*player\.position\.y\s*\+\s*player\.height\s*<=\s*platform\.position\.y\s*,\s*player\.position\.y\s*\+\s*player\.height\s*\+\s*player\.velocity\.y\s*>=\s*platform\.position\.y,?\s*]\s*;?/); +assert.match(code, /const\s+collisionDetectionRules\s*=\s*\[\s*player\.position\.y\s*\+\s*player\.height\s*<=\s*platform\.position\.y\s*,\s*player\.position\.y\s*\+\s*player\.height\s*\+\s*player\.velocity\.y\s*>=\s*platform\.position\.y\s*,?\s*]\s*;?/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64c9fa51209ab5395d524cce.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64c9fa51209ab5395d524cce.md index 4449aca752e..438d4f48cd5 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64c9fa51209ab5395d524cce.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64c9fa51209ab5395d524cce.md @@ -14,7 +14,7 @@ Below that boolean expression, add another boolean expression that checks if the You should have a boolean expression that checks if the player's `x` position is greater than or equal to the platform's `x` position minus half of the player's width. ```js -assert.match(code, /const\s+collisionDetectionRules\s*=\s*\[\s*player\.position\.y\s*\+\s*player\.height\s*<=\s*platform\.position\.y\s*,\s*player\.position\.y\s*\+\s*player\.height\s*\+\s*player\.velocity\.y\s*>=\s*platform\.position\.y\s*,\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2,?\s*]\s*;?/); +assert.match(code, /const\s+collisionDetectionRules\s*=\s*\[\s*player\.position\.y\s*\+\s*player\.height\s*<=\s*platform\.position\.y\s*,\s*player\.position\.y\s*\+\s*player\.height\s*\+\s*player\.velocity\.y\s*>=\s*platform\.position\.y\s*,\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2\s*,?\s*]\s*;?/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64c9fe7b2ffa3539fbf82d32.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64c9fe7b2ffa3539fbf82d32.md index dadf839de74..49e7257fc6a 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64c9fe7b2ffa3539fbf82d32.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64c9fe7b2ffa3539fbf82d32.md @@ -14,7 +14,7 @@ Add one last boolean expression that checks if the player's `x` position is less You should have a boolean expression that checks if the player's `x` position is lesser than or equal to the platform's `x` position plus the platform's width minus the player's width divided by `3`. ```js -assert.match(code, /player\.position\.x\s*<=\s*platform\.position\.x\s*\+\s*platform\.width\s*-\s*player\.width\s*\/\s*3,?/) +assert.match(code, /player\.position\.x\s*<=\s*platform\.position\.x\s*\+\s*platform\.width\s*-\s*player\.width\s*\/\s*3\s*,?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64caeb134c3cdc5498cd75b9.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64caeb134c3cdc5498cd75b9.md index 58abfdfbe35..f2f7867a32a 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64caeb134c3cdc5498cd75b9.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64caeb134c3cdc5498cd75b9.md @@ -14,7 +14,7 @@ Inside that array, add a boolean expression that checks if the player's `x` posi You should have a boolean expression that checks if the player's `x` position is greater than or equal to the platform's `x` position minus half of the player's width. ```js -assert.match(code, /const\s+platformDetectionRules\s+=\s*\[\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2,?\s*\]\s*;?/) +assert.match(code, /const\s+platformDetectionRules\s+=\s*\[\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2\s*,?\s*\]\s*;?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64caeeae2fa57756035d6012.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64caeeae2fa57756035d6012.md index 6f9308ec65d..0b1d60185cf 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64caeeae2fa57756035d6012.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64caeeae2fa57756035d6012.md @@ -14,7 +14,7 @@ Below that boolean expression, add another boolean expression that checks if the You should have a boolean expression that checks if the player's `x` position is less than or equal to the sum of the platform's `x` position and the platform's width minus one third of the player's width. ```js -assert.match(code, /const\s+platformDetectionRules\s+=\s*\[\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2,?\s*player\.position\.x\s*<=\s*platform\.position\.x\s*\+\s*platform\.width\s*-\s*player\.width\s*\/\s*3,?\s*\]\s*;?/) +assert.match(code, /const\s+platformDetectionRules\s+=\s*\[\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2\s*,\s*player\.position\.x\s*<=\s*platform\.position\.x\s*\+\s*platform\.width\s*-\s*player\.width\s*\/\s*3\s*,?\s*\]\s*;?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64caf1be15606d5814c3387b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64caf1be15606d5814c3387b.md index 2affd7ae4c1..1b4e05a0342 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64caf1be15606d5814c3387b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64caf1be15606d5814c3387b.md @@ -16,21 +16,21 @@ Below that, add another boolean expression that checks if the player's `y` posit You should not alter the existing `platformDetectionRules` array and its content. ```js -assert.match(code, /const\s+platformDetectionRules\s+=\s*\[\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2,?\s*player\.position\.x\s*<=\s*platform\.position\.x\s*\+\s*platform\.width\s*-\s*player\.width\s*\/\s*3,\s*.*\s*.*\s*\]\s*;?/) +assert.match(code, /const\s+platformDetectionRules\s+=\s*\[\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2\s*,\s*player\.position\.x\s*<=\s*platform\.position\.x\s*\+\s*platform\.width\s*-\s*player\.width\s*\/\s*3\s*,\s*.*\s*.*\s*\]\s*;?/) ``` You should have a boolean expression that checks if the player's `y` position plus the player's height is greater than or equal to the platform's `y` position. ```js -assert.match(code, /const\s+platformDetectionRules\s+=\s*\[\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2,?\s*player\.position\.x\s*<=\s*platform\.position\.x\s*\+\s*platform\.width\s*-\s*player\.width\s*\/\s*3,\s*player\.position\.y\s*\+\s*player\.height\s*>=\s*platform\.position\.y,\s*.*\s*\]\s*;?/) +assert.match(code, /const\s+platformDetectionRules\s+=\s*\[\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2\s*,\s*player\.position\.x\s*<=\s*platform\.position\.x\s*\+\s*platform\.width\s*-\s*player\.width\s*\/\s*3\s*,\s*player\.position\.y\s*\+\s*player\.height\s*>=\s*platform\.position\.y\s*,\s*.*\s*\]\s*;?/) ``` You should have a boolean expression that checks if the player's `y` position is less than or equal to the sum of the platform's `y` position plus the platform's height. ```js -assert.match(code, /const\s+platformDetectionRules\s+=\s*\[\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2,?\s*player\.position\.x\s*<=\s*platform\.position\.x\s*\+\s*platform\.width\s*-\s*player\.width\s*\/\s*3,\s*player\.position\.y\s*\+\s*player\.height\s*>=\s*platform\.position\.y,\s*player\.position\.y\s*<=\s*platform\.position\.y\s*\+\s*platform\.height,?\s*\]\s*;?/) +assert.match(code, /const\s+platformDetectionRules\s+=\s*\[\s*player\.position\.x\s*>=\s*platform\.position\.x\s*-\s*player\.width\s*\/\s*2\s*,\s*player\.position\.x\s*<=\s*platform\.position\.x\s*\+\s*platform\.width\s*-\s*player\.width\s*\/\s*3\s*,\s*player\.position\.y\s*\+\s*player\.height\s*>=\s*platform\.position\.y\s*,\s*player\.position\.y\s*<=\s*platform\.position\.y\s*\+\s*platform\.height\s*,?\s*\]\s*;?/) ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb2a87057eb5655c66d1c2.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb2a87057eb5655c66d1c2.md index 7ce9ce8f4de..0d0609a27e6 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb2a87057eb5655c66d1c2.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb2a87057eb5655c66d1c2.md @@ -25,7 +25,7 @@ The `this.position` property should be an object with the `x` and `y` coordinate ```js const splitter = code.split("ctx.fillRect(this.position.x, this.position.y, this.width, this.height);") -assert.match(splitter[2], /this\.position\s*=\s*\{\s*x,\s*y,?\s*\};?/); +assert.match(splitter[2], /this\.position\s*=\s*\{\s*x\s*,\s*y\s*,?\s*\};?/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb2e5bdfb23a67272a07c7.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb2e5bdfb23a67272a07c7.md index 60210964063..b6b580c318f 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb2e5bdfb23a67272a07c7.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb2e5bdfb23a67272a07c7.md @@ -33,7 +33,7 @@ Your `draw` method should have a `fillRect` method. ```js const splitter = code.split('#f1be32') -assert.match(splitter[1], /ctx\.fillRect\(\s*this\.position\.x,\s*this\.position\.y\s*,\s*this\.width,\s*this\.height\s*\);?/); +assert.match(splitter[1], /ctx\.fillRect\(\s*this\.position\.x\s*,\s*this\.position\.y\s*,\s*this\.width\s*,\s*this\.height\s*\);?/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb50fd95831a745ea60d13.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb50fd95831a745ea60d13.md index e45c635bd43..f61c3d82ae7 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb50fd95831a745ea60d13.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb50fd95831a745ea60d13.md @@ -24,7 +24,7 @@ Your callback function should have a `checkpoint` parameter and `index`. ```js const splitter = code.split("player.velocity.y = gravity;") -assert.match(splitter[1], /checkpoints\.forEach\(\s*\(\s*checkpoint,\s*index\s*\)\s*=>\s*\{/); +assert.match(splitter[1], /checkpoints\.forEach\(\s*\(\s*checkpoint\s*,\s*index\s*\)\s*=>\s*\{/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb522509ffb274daf9fd9e.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb522509ffb274daf9fd9e.md index c80429825c9..86b63166f92 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb522509ffb274daf9fd9e.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb522509ffb274daf9fd9e.md @@ -22,7 +22,7 @@ assert.match(code, /const\s+checkpointDetectionRules\s*=\s*\[\s*/) You should have a boolean expression that checks if the player's `position.x` is greater than or equal to the checkpoint's `position.x` inside the `checkpointDetectionRules` array. ```js -assert.match(code, /const\s+checkpointDetectionRules\s*=\s*\[\s*player\.position\.x\s*>=\s*checkpoint\.position\.x,?\s*\]/) +assert.match(code, /const\s+checkpointDetectionRules\s*=\s*\[\s*player\.position\.x\s*>=\s*checkpoint\.position\.x\s*,?\s*\]/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb583dadb33a77595797bd.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb583dadb33a77595797bd.md index 3b033468fc3..35062810596 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb583dadb33a77595797bd.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-oop-by-building-a-platformer-game/64cb583dadb33a77595797bd.md @@ -18,21 +18,21 @@ For the last array item, add the `isCheckpointCollisionDetectionActive` variable You should have a boolean expression that checks if the player's `position.y` is greater than or equal to the checkpoint's `position.y` ```js -assert.match(code, /player\.position\.y\s*>=\s*checkpoint\.position\.y,/) +assert.match(code, /player\.position\.y\s*>=\s*checkpoint\.position\.y\s*,/) ``` You should have a boolean expression that checks if the player's `position.y` plus the player's height is less than or equal to the checkpoint's `position.y` plus the checkpoint's height. ```js -assert.match(code, /player\.position\.y\s*>=\s*checkpoint\.position\.y,\s*player\.position\.y\s*\+\s*player\.height\s*<=\s*checkpoint\.position\.y\s*\+\s*checkpoint\.height,/) +assert.match(code, /player\.position\.y\s*>=\s*checkpoint\.position\.y\s*,\s*player\.position\.y\s*\+\s*player\.height\s*<=\s*checkpoint\.position\.y\s*\+\s*checkpoint\.height\s*,/) ``` You should add `isCheckpointCollisionDetectionActive` as the last item of the `checkpointDetectionRules` array. ```js -assert.match(code, /player\.position\.y\s*>=\s*checkpoint\.position\.y,\s*player\.position\.y\s*\+\s*player\.height\s*<=\s*checkpoint\.position\.y\s*\+\s*checkpoint\.height,\s*isCheckpointCollisionDetectionActive\s*/) +assert.match(code, /player\.position\.y\s*>=\s*checkpoint\.position\.y\s*,\s*player\.position\.y\s*\+\s*player\.height\s*<=\s*checkpoint\.position\.y\s*\+\s*checkpoint\.height\s*,\s*isCheckpointCollisionDetectionActive\s*/) ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4e7bbedb22d6939001ad3.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4e7bbedb22d6939001ad3.md index 3e9c22c7574..e43be08d949 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4e7bbedb22d6939001ad3.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4e7bbedb22d6939001ad3.md @@ -34,7 +34,7 @@ assert.match(code, /closeTaskFormBtn\.addEventListener\(\s*('|"|`)click\1/) Your event listener's callback function should call the `showModal()` method on the `confirmCloseDialog` element. ```js -assert.match(code, /closeTaskFormBtn\.addEventListener\(\s*('|"|`)click\1,\s*\(.*\)\s*=>\s*(\{\s*confirmCloseDialog\.showModal\(\s*\)\s*;?\s*\}|confirmCloseDialog\.showModal\(\s*\))\s*\)\s*;?/) +assert.match(code, /closeTaskFormBtn\.addEventListener\(\s*('|"|`)click\1\s*,\s*\(.*\)\s*=>\s*(\{\s*confirmCloseDialog\.showModal\(\s*\)\s*;?\s*\}|confirmCloseDialog\.showModal\(\s*\))\s*\)\s*;?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4eaaa9070a66aecbfe603.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4eaaa9070a66aecbfe603.md index a6aad2ff0d2..54aceb43760 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4eaaa9070a66aecbfe603.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4eaaa9070a66aecbfe603.md @@ -34,7 +34,7 @@ assert.match(code, /cancelBtn\.addEventListener\(\s*('|"|`)click\1/) Your event listener's callback function should call the `close()` method on `confirmCloseDialog` element. ```js -assert.match(code, /cancelBtn\.addEventListener\(\s*('|"|`)click\1\s*\,\s*\(\s*\)\s*=>\s*(\{\s*confirmCloseDialog\.close\(\s*\)\s*;?\s*\}|confirmCloseDialog\.close\(\s*\))\s*\)\s*;?/) +assert.match(code, /cancelBtn\.addEventListener\(\s*('|"|`)click\1\s*,\s*\(\s*\)\s*=>\s*(\{\s*confirmCloseDialog\.close\(\s*\)\s*;?\s*\}|confirmCloseDialog\.close\(\s*\))\s*\)\s*;?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4ecd7735a566c9266a338.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4ecd7735a566c9266a338.md index 1ffca402e0e..cd6767754da 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4ecd7735a566c9266a338.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4ecd7735a566c9266a338.md @@ -28,13 +28,13 @@ assert.match(code, /taskForm\.addEventListener\(\s*('|"|`)submit\1/) You should use arrow syntax to set your event listener to an empty pair of curly braces with `e` as the parameter. ```js -assert.match(code, /taskForm\.addEventListener\(\s*('|"|`)submit\1,\s*(\(\s*e\s*\)|e)\s*=>\s*\{/) +assert.match(code, /taskForm\.addEventListener\(\s*('|"|`)submit\1\s*,\s*(\(\s*e\s*\)|e)\s*=>\s*\{/) ``` You should use the `e.preventDefault()` method to stop the browser from reloading the page. ```js -assert.match(code, /taskForm\.addEventListener\(\s*('|"|`)submit\1,\s*(\(\s*e\s*\)|e)\s*=>\s*\{\s*e\.preventDefault\(\s*\)\s*;?\s*\}\s*\);?/) +assert.match(code, /taskForm\.addEventListener\(\s*('|"|`)submit\1\s*,\s*(\(\s*e\s*\)|e)\s*=>\s*\{\s*e\.preventDefault\(\s*\)\s*;?\s*\}\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4f01d6c72086e016a8626.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4f01d6c72086e016a8626.md index 076cc769e2f..49d2448bf48 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4f01d6c72086e016a8626.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64e4f01d6c72086e016a8626.md @@ -42,7 +42,7 @@ assert.match(code, /const\s+taskObj\s*=\s*\{\s*id:\s*`\$\{titleInput\.value\.toL You should use `.join('-')` on `titleInput.value.toLowerCase().split(' ')`. ```js -assert.match(code, /const\s+taskObj\s*=\s*\{\s*id:\s*`\$\{titleInput\.value\.toLowerCase\(\s*\)\.split\(\s*('|")\s{1}\1\s*\)\.join\(\s*('|")-\2\s*\)\}`,?\s*\}/) +assert.match(code, /const\s+taskObj\s*=\s*\{\s*id:\s*`\$\{titleInput\.value\.toLowerCase\(\s*\)\.split\(\s*('|")\s{1}\1\s*\)\.join\(\s*('|")-\2\s*\)\}`\s*,?\s*\}/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec89ee549ecf802de2b3e2.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec89ee549ecf802de2b3e2.md index 060fb00a7da..09122f47402 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec89ee549ecf802de2b3e2.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec89ee549ecf802de2b3e2.md @@ -14,19 +14,19 @@ Retrieve the values from the `titleInput`, `dateInput`, and `descriptionInput` f You should get the value of `titleInput` and save it in a `title` key. ```js -assert.match(code, /title:\s*titleInput\.value,/) +assert.match(code, /title:\s*titleInput\.value\s*,/) ``` You should get the value of `dateInput` and save it in a `date` key. ```js -assert.match(code, /date:\s*dateInput\.value,/) +assert.match(code, /date:\s*dateInput\.value\s*,/) ``` You should get the value of `descriptionInput` and save it in a `description` key. ```js -assert.match(code, /description:\s*descriptionInput\.value,?/) +assert.match(code, /description:\s*descriptionInput\.value\s*,?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fad07f43a101779cb8692a.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fad07f43a101779cb8692a.md index 78bfb95196b..3e073a8ecd2 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fad07f43a101779cb8692a.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fad07f43a101779cb8692a.md @@ -28,13 +28,13 @@ assert.match(code, /const\s+addOrUpdateTask\s*=\s*\(\s*\)\s*=>\s*\{\s*const\s+da You should move the `taskObj` object into the `addOrUpdateTask` function. ```js -assert.match(code, /const\s+addOrUpdateTask\s*=\s*\(\s*\)\s*=>\s*\{\s*const\s+dataArrIndex\s*=\s*taskData\.findIndex\(\s*(?:\(\s*item\s*\)|item)\s*=>\s*(?:item\.id\s===\s*currentTask\.id|currentTask\.id\s*===\s*item\.id)\s*\)\s*;?\s*const\s+taskObj\s*=\s*\{\s*id\s*:\s*`\$\{\s*titleInput\.value\.toLowerCase\(\s*\)\.split\(\s*('|")\s{1}\1\s*\)\.join\(\s*('|")-\2\s*\)\s*\}-\$\{\s*Date\.now\(\s*\)\s*\}`\s*,\s*title\s*:\s*titleInput\.value,\s*date\s*:\s*dateInput\.value\s*,\s*description\s*:\s*descriptionInput\.value\s*,?\s*\}\s*;?/) +assert.match(code, /const\s+addOrUpdateTask\s*=\s*\(\s*\)\s*=>\s*\{\s*const\s+dataArrIndex\s*=\s*taskData\.findIndex\(\s*(?:\(\s*item\s*\)|item)\s*=>\s*(?:item\.id\s===\s*currentTask\.id|currentTask\.id\s*===\s*item\.id)\s*\)\s*;?\s*const\s+taskObj\s*=\s*\{\s*id\s*:\s*`\$\{\s*titleInput\.value\.toLowerCase\(\s*\)\.split\(\s*('|")\s{1}\1\s*\)\.join\(\s*('|")-\2\s*\)\s*\}-\$\{\s*Date\.now\(\s*\)\s*\}`\s*,\s*title\s*:\s*titleInput\.value\s*,\s*date\s*:\s*dateInput\.value\s*,\s*description\s*:\s*descriptionInput\.value\s*,?\s*\}\s*;?/) ``` You should move the `if` statement with the condition `dataArrIndex === -1` into your `addOrUpdateTask` function. ```js -assert.match(code, /const\s+addOrUpdateTask\s*=\s*\(\s*\)\s*=>\s*\{\s*const\s+dataArrIndex\s*=\s*taskData\.findIndex\(\s*(?:\(\s*item\s*\)|item)\s*=>\s*(?:item\.id\s*===\s*currentTask\.id|currentTask\.id\s*===\s*item\.id)\s*\)\s*;?\s*const\s+taskObj\s*=\s*\{\s*id\s*:\s*`\$\{\s*titleInput\.value\.toLowerCase\(\s*\)\.split\(\s*('|")\s{1}\1\s*\)\.join\(\s*('|")-\2\s*\)\s*\}-\$\{\s*Date\.now\(\s*\)\s*\}`\s*,\s*title\s*:\s*titleInput\.value,\s*date\s*:\s*dateInput\.value\s*,\s*description\s*:\s*descriptionInput\.value\s*,?\s*\}\s*;?\s*if\s*\(\s*dataArrIndex\s*===\s*-1\s*\)\s*\{\s*taskData\.unshift\(\s*taskObj\s*\)\s*;?\s*\}\s*\}\s*;?/) +assert.match(code, /const\s+addOrUpdateTask\s*=\s*\(\s*\)\s*=>\s*\{\s*const\s+dataArrIndex\s*=\s*taskData\.findIndex\(\s*(?:\(\s*item\s*\)|item)\s*=>\s*(?:item\.id\s*===\s*currentTask\.id|currentTask\.id\s*===\s*item\.id)\s*\)\s*;?\s*const\s+taskObj\s*=\s*\{\s*id\s*:\s*`\$\{\s*titleInput\.value\.toLowerCase\(\s*\)\.split\(\s*('|")\s{1}\1\s*\)\.join\(\s*('|")-\2\s*\)\s*\}-\$\{\s*Date\.now\(\s*\)\s*\}`\s*,\s*title\s*:\s*titleInput\.value\s*,\s*date\s*:\s*dateInput\.value\s*,\s*description\s*:\s*descriptionInput\.value\s*,?\s*\}\s*;?\s*if\s*\(\s*dataArrIndex\s*===\s*-1\s*\)\s*\{\s*taskData\.unshift\(\s*taskObj\s*\)\s*;?\s*\}\s*\}\s*;?/) ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fad9cd2eeb1e7ca2ca8c8b.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fad9cd2eeb1e7ca2ca8c8b.md index ea76d720013..d3e81848f27 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fad9cd2eeb1e7ca2ca8c8b.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fad9cd2eeb1e7ca2ca8c8b.md @@ -20,7 +20,7 @@ assert.match(code, /const\s+updateTaskContainer\s*=\s*\(\s*\)\s*=>\s*\{/) You should move `taskData.forEach()` and its content into the `updateTaskContainer()` function. ```js -assert.match(code, /const\s+updateTaskContainer\s*=\s*\(\s*\)\s*=>\s*\{\s*taskData\.forEach\(\s*\(\s*\{\s*id,\s*title,\s*date,\s*description\s*\}\s*\)\s*=>\s*{\s*\(\s*tasksContainer\.innerHTML\s*\+=\s*`\s*\s*

Title:<\/strong>\s*\$\{title\}<\/p>\s*

Date:<\/strong>\s*\$\{date\}<\/p>\s*

Description:<\/strong>\s*\$\{description\}<\/p>\s*Edit<\/button>\s*Delete<\/button>\s*<\/div>\s*`\s*\)\s*}\s*\);?\s*\};?/) +assert.match(code, /const\s+updateTaskContainer\s*=\s*\(\s*\)\s*=>\s*\{\s*taskData\.forEach\(\s*\(\s*\{\s*id\s*,\s*title\s*,\s*date\s*,\s*description\s*\}\s*\)\s*=>\s*{\s*\(\s*tasksContainer\.innerHTML\s*\+=\s*`\s*\s*

Title:<\/strong>\s*\$\{title\}<\/p>\s*

Date:<\/strong>\s*\$\{date\}<\/p>\s*

Description:<\/strong>\s*\$\{description\}<\/p>\s*Edit<\/button>\s*Delete<\/button>\s*<\/div>\s*`\s*\)\s*}\s*\);?\s*\};?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64faf874364ec308f875f636.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64faf874364ec308f875f636.md index 7e4e107e94b..64752a79799 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64faf874364ec308f875f636.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64faf874364ec308f875f636.md @@ -48,7 +48,7 @@ assert.match(deleteTask.toString(), /taskData\.splice\(\s*dataArrIndex/) The second argument of your `splice()` method should be `1`. ```js -assert.match(deleteTask.toString(), /taskData\.splice\(\s*dataArrIndex,\s*1\s*\);?/) +assert.match(deleteTask.toString(), /taskData\.splice\(\s*dataArrIndex\s*,\s*1\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md index 5f649f9be8f..1b0f70d54fa 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md @@ -32,7 +32,7 @@ assert.match(code, /localStorage\.setItem\(\s*("|')data\1/) Your `localStorage.setItem()` should have a value of `myTaskArr`. ```js -assert.match(code, /localStorage\.setItem\(\s*("|')data\1,\s*myTaskArr\s*\);?/) +assert.match(code, /localStorage\.setItem\(\s*("|')data\1\s*,\s*myTaskArr\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md index 6f380e8f190..2b3e27954b5 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md @@ -22,7 +22,7 @@ assert.match(code, /localStorage\.setItem\(\s*("|')data\1/) You should wrap `JSON.stringify()` around `myTaskArr`. ```js -assert.match(code, /localStorage\.setItem\(\s*("|')data\1,\s*JSON\.stringify\(\s*myTaskArr\s*\)\s*\);?/) +assert.match(code, /localStorage\.setItem\(\s*("|')data\1\s*,\s*JSON\.stringify\(\s*myTaskArr\s*\)\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md index 2bbc447f1af..63afcc88ad3 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md @@ -14,7 +14,7 @@ Remove the `myTaskArr` array and all of the code for `localStorage` because you You should remove `myTaskArr` and all the code related to `localStorage` that you've just learned. ```js -assert.notMatch(code, /const\s+myTaskArr\s*=\s*\[\s*\{\s*task:\s('|")Walk\s*the\s*Dog\1,\s*date:\s*('|")22-04-2022\2\s*\},\s*\{\s*task:\s('|")Read\s*some\s*books\3,\s*date:\s*('|")02-11-2023\4\s*\},\s*\{\s*task:\s('|")Watch\s*football\5,\s*date:\s*('|")10-08-2021\6\s*\},\s*\]\s*;?\s*localStorage\.setItem\(('|")data\7, JSON\.stringify\(\s*myTaskArr\s*\)\s*\);\s*localStorage\.clear\(\s*\);?\s*const\s+getTaskArr\s*=\s*localStorage\.getItem\(\s*('|")data\8\s*\)\s*console\.log\(\s*getTaskArr\s*\)\s*const\s+getTaskArrObj\s*=\s*JSON\.parse\(\s*localStorage\.getItem\(\s*('|")data\9\s*\)\s*\);?\s*console\.log\(\s*getTaskArrObj\s*\);?/) +assert.notMatch(code, /const\s+myTaskArr\s*=\s*\[\s*\{\s*task:\s('|")Walk\s*the\s*Dog\1\s*,\s*date:\s*('|")22-04-2022\2\s*\}\s*,\s*\{\s*task:\s('|")Read\s*some\s*books\3\s*,\s*date:\s*('|")02-11-2023\4\s*\}\s*,\s*\{\s*task:\s('|")Watch\s*football\5\s*,\s*date:\s*('|")10-08-2021\6\s*\}\s*,\s*\]\s*;?\s*localStorage\.setItem\(('|")data\7\s*,\s*JSON\.stringify\(\s*myTaskArr\s*\)\s*\);\s*localStorage\.clear\(\s*\);?\s*const\s+getTaskArr\s*=\s*localStorage\.getItem\(\s*('|")data\8\s*\)\s*console\.log\(\s*getTaskArr\s*\)\s*const\s+getTaskArrObj\s*=\s*JSON\.parse\(\s*localStorage\.getItem\(\s*('|")data\9\s*\)\s*\);?\s*console\.log\(\s*getTaskArrObj\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md index de53e1a9f44..a0d563ea007 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md @@ -30,7 +30,7 @@ assert.match(code, /localStorage\.setItem\(\s*('|")data\1/) You should pass in `JSON.stringify(taskData)` as the second argument of your `localStorage.setItem()`. ```js -assert.match(code, /localStorage\.setItem\(\s*('|")data\1,\s*JSON\.stringify\(\s*taskData\s*\)\s*\);?/) +assert.match(code, /localStorage\.setItem\(\s*('|")data\1\s*,\s*JSON\.stringify\(\s*taskData\s*\)\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md index 85948e5fdce..d43ca422ab1 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md @@ -31,7 +31,7 @@ You should pass in `JSON.stringify(taskData)` as the second argument of your `lo ```js const splitter = code.split("taskData.splice(dataArrIndex, 1);") -assert.match(splitter[1], /localStorage\.setItem\(\s*('|")data\1,\s*JSON\.stringify\(\s*taskData\s*\)\s*\);?/) +assert.match(splitter[1], /localStorage\.setItem\(\s*('|")data\1\s*,\s*JSON\.stringify\(\s*taskData\s*\)\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650300a25b6f72964ab8aca6.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650300a25b6f72964ab8aca6.md index a109fd566fd..fc7854f4808 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650300a25b6f72964ab8aca6.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650300a25b6f72964ab8aca6.md @@ -20,7 +20,7 @@ console.log(Date.now()); // 1628586800000 You should attach `-${Date.now()}` to the existing value of the `id` key. Don't forget it needs to be inside the template string. ```js -assert.match(code, /const\s+taskObj\s*=\s*\{\s*id:\s*`\$\{titleInput\.value\.toLowerCase\(\s*\)\.split\(\s*('|")\s{1}\1\s*\)\.join\(\s*('|")-\2\s*\)\}-\$\{Date\.now\(\s*\)\}`,?\s*\}/) +assert.match(code, /const\s+taskObj\s*=\s*\{\s*id:\s*`\$\{titleInput\.value\.toLowerCase\(\s*\)\.split\(\s*('|")\s{1}\1\s*\)\.join\(\s*('|")-\2\s*\)\}-\$\{Date\.now\(\s*\)\}`\s*,?\s*\}/) ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-modern-javascript-methods-by-building-football-team-cards/63e036373fc9173d284e165a.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-modern-javascript-methods-by-building-football-team-cards/63e036373fc9173d284e165a.md index 4da096e1742..09ae1df7c85 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-modern-javascript-methods-by-building-football-team-cards/63e036373fc9173d284e165a.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-modern-javascript-methods-by-building-football-team-cards/63e036373fc9173d284e165a.md @@ -29,7 +29,7 @@ Use object destructuring to access the `sport` and `team` values. ```js -assert.match(code, /const\s*{\s*(sport\s*\,\s*team)|(team\s*\,\s*sport)\s*}\s*=\s*myFavoriteFootballTeam\s*/) +assert.match(code, /const\s*{\s*(sport\s*,\s*team)|(team\s*,\s*sport)\s*}\s*=\s*myFavoriteFootballTeam\s*/) ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-modern-javascript-methods-by-building-football-team-cards/63e94dae6dcedbad73f2f6ee.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-modern-javascript-methods-by-building-football-team-cards/63e94dae6dcedbad73f2f6ee.md index b13000896fc..1a5ad7a22ed 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-modern-javascript-methods-by-building-football-team-cards/63e94dae6dcedbad73f2f6ee.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-modern-javascript-methods-by-building-football-team-cards/63e94dae6dcedbad73f2f6ee.md @@ -25,7 +25,7 @@ You should unpack all 5 object properties from objects in `arr` using object des ```js -assert.match(code, /{\s*((name|position|number|isCaptain|nickname)\s*\,\s*(name|position|number|isCaptain|nickname)\s*\,\s*(name|position|number|isCaptain|nickname)\s*\,\s*(name|position|number|isCaptain|nickname)\s*\,\s*(name|position|number|isCaptain|nickname))\s*}\s*/) +assert.match(code, /{\s*((name|position|number|isCaptain|nickname)\s*,\s*(name|position|number|isCaptain|nickname)\s*,\s*(name|position|number|isCaptain|nickname)\s*,\s*(name|position|number|isCaptain|nickname)\s*,\s*(name|position|number|isCaptain|nickname))\s*}\s*/) ``` diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-recursion-by-building-a-decimal-to-binary-converter/64646bc0e5a60ea131e03f91.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-recursion-by-building-a-decimal-to-binary-converter/64646bc0e5a60ea131e03f91.md index fed222bb5d6..710440a0588 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-recursion-by-building-a-decimal-to-binary-converter/64646bc0e5a60ea131e03f91.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-recursion-by-building-a-decimal-to-binary-converter/64646bc0e5a60ea131e03f91.md @@ -44,7 +44,7 @@ assert.match(code, /setTimeout\(\s*\(\s*\)\s*=>\s*\{?\s*console\.log\(\s*('|"|`) You should pass `1000` as the second argument to the `setTimeout` function. ```js -assert.match(code, /console\.log\(\s*('|"|`)\s*Code\s*\1\s*\);?\s*\}?,\s*1000\s*\)/); +assert.match(code, /console\.log\(\s*('|"|`)\s*Code\s*\1\s*\);?\s*\}?\s*,\s*1000\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-recursion-by-building-a-decimal-to-binary-converter/64646db2c684b7a3a174a1d0.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-recursion-by-building-a-decimal-to-binary-converter/64646db2c684b7a3a174a1d0.md index 8d8ae0b1b89..3f7887371ff 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-recursion-by-building-a-decimal-to-binary-converter/64646db2c684b7a3a174a1d0.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-recursion-by-building-a-decimal-to-binary-converter/64646db2c684b7a3a174a1d0.md @@ -48,7 +48,7 @@ assert.match(code, /setTimeout\(\s*\(\s*\)\s*=>\s*\{?\s*console\.log\(\s*('|"|`) You should pass `500` as the second argument to the new `setTimeout()` function. ```js -assert.match(code, /console\.log\(\s*('|"|`)\s*free\s*\1\s*\);?\s*\}?,\s*500\s*\)/); +assert.match(code, /console\.log\(\s*('|"|`)\s*free\s*\1\s*\);?\s*\}?\s*,\s*500\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-recursion-by-building-a-decimal-to-binary-converter/646477c82475ffaf0c3c0771.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-recursion-by-building-a-decimal-to-binary-converter/646477c82475ffaf0c3c0771.md index ac8d0fbdcfd..cd6abfb5ff8 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-recursion-by-building-a-decimal-to-binary-converter/646477c82475ffaf0c3c0771.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-recursion-by-building-a-decimal-to-binary-converter/646477c82475ffaf0c3c0771.md @@ -46,7 +46,7 @@ assert.match(code, /setTimeout\(\s*\(\s*\)\s*=>\s*\{?\s*console\.log\(\s*('|"|`) You should pass `1500` as the second argument to the new `setTimeout()` function. ```js -assert.match(code, /console\.log\(\s*('|"|`)\s*Camp\s*\1\s*\);?\s*\}?,\s*1500\s*\)/); +assert.match(code, /console\.log\(\s*('|"|`)\s*Camp\s*\1\s*\);?\s*\}?\s*,\s*1500\s*\)/); ``` # --seed--