diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md index 17768155a3f..8f03b3f09db 100644 --- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md +++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/record-collection.md @@ -22,7 +22,8 @@ Complete the function using the rules below to modify the object passed to the f - Your function must always return the entire `records` object. - If `value` is an empty string, delete the given `prop` property from the album. - If `prop` isn't `tracks` and `value` isn't an empty string, assign the `value` to that album's `prop`. -- If `prop` is `tracks` and `value` isn't an empty string, you need to update the album's `tracks` array. First, if the album does not have a `tracks` property, assign it an empty array. Then add the `value` as the last item in the album's `tracks` array. +- If `prop` is `tracks` and `value` isn't an empty string, but the album doesn't have a `tracks` property, create an empty array and add `value` to it. +- If prop is `tracks` and `value` isn't an empty string, add `value` to the end of the album's existing `tracks` array. **Note:** A copy of the `recordCollection` object is used for the tests. You should not directly modify the `recordCollection` object. diff --git a/curriculum/challenges/arabic/06-quality-assurance/advanced-node-and-express/serialization-of-a-user-object.md b/curriculum/challenges/arabic/06-quality-assurance/advanced-node-and-express/serialization-of-a-user-object.md index da9040a8c85..f5d76f3bbc1 100644 --- a/curriculum/challenges/arabic/06-quality-assurance/advanced-node-and-express/serialization-of-a-user-object.md +++ b/curriculum/challenges/arabic/06-quality-assurance/advanced-node-and-express/serialization-of-a-user-object.md @@ -8,7 +8,7 @@ dashedName: serialization-of-a-user-object # --description-- -Serialization and deserialization are important concepts in regards to authentication. To serialize an object means to convert its contents into a small *key* that can then be deserialized into the original object. This is what allows us to know who has communicated with the server without having to send the authentication data, like the username and password, at each request for a new page. +Serialization and deserialization are important concepts in regard to authentication. To serialize an object means to convert its contents into a small *key* that can then be deserialized into the original object. This is what allows us to know who has communicated with the server without having to send the authentication data, like the username and password, at each request for a new page. To set this up properly, you need to have a serialize function and a deserialize function. In Passport, these can be created with: diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/65578c17d54dfab65cd54b95.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/65578c17d54dfab65cd54b95.md index fa124be9f4e..2eb8b43ec70 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/65578c17d54dfab65cd54b95.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/65578c17d54dfab65cd54b95.md @@ -19,8 +19,8 @@ You should use the `append()` method to append `start` to `paths[start]`. ```js ({ test: () => { const shortest = __helpers.python.getDef(code, "shortest_path"); - const {function_body} = shortest; - assert(function_body.match(/^\s{4}paths\s*\[\s*start\s*\]\.append\s*\(\s*start\s*\)/m)); + const {function_body} = shortest; + assert(function_body.match(/^\s{4}paths\s*\[\s*start\s*\]\s*\.append\s*\(\s*start\s*\)/m)); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6557913b8fe5c0bc834c9f4f.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6557913b8fe5c0bc834c9f4f.md index f36ff76e347..731d8da7492 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6557913b8fe5c0bc834c9f4f.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6557913b8fe5c0bc834c9f4f.md @@ -27,8 +27,8 @@ You should call `extend()` on the neighbour node path passing the current node p ```js ({ test: () => { const shortest = __helpers.python.getDef(code, "shortest_path"); - const {function_body} = shortest; - assert(function_body.match(/^(\s*)if\s+paths\s*\[\s*node\s*\]\s*\[\s*-\s*1\s*\]\s*==\s*node\s*:\s*^\1(\s{4})paths\s*\[\s*node\s*\]\s*=\s*paths\s*\[\s*current\s*\]\s*^\1else\s*:\s*^\1\2paths\s*\[\s*node\s*\]\.extend\s*\(\s*paths\s*\[\s*current\s*\]\s*\)/ms)); + const {function_body} = shortest; + assert(function_body.match(/^(\s*)if\s+paths\s*\[\s*node\s*\]\s*\[\s*-\s*1\s*\]\s*==\s*node\s*:\s*^\1(\s{4})paths\s*\[\s*node\s*\]\s*=\s*paths\s*\[\s*current\s*\]\s*^\1else\s*:\s*^\1\2paths\s*\[\s*node\s*\]\s*\.extend\s*\(\s*paths\s*\[\s*current\s*\]\s*\)/ms)); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/655791847db8a9bd0b685f40.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/655791847db8a9bd0b685f40.md index c269b8e3c86..3c262f8c1b0 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/655791847db8a9bd0b685f40.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/655791847db8a9bd0b685f40.md @@ -16,8 +16,8 @@ You should append `node` to `paths[node]` just after your `else` statement. ```js ({ test: () => { const shortest = __helpers.python.getDef(code, "shortest_path"); - const {function_body} = shortest; - assert(function_body.match(/^(\s*)else\s*:\s*^\1\s{4}paths\s*\[\s*node\s*\]\.extend\s*\(\s*paths\s*\[\s*current\s*\]\s*\)\s*^\1paths\s*\[\s*node\s*\]\.append\s*\(\s*node\s*\)/ms)); + const {function_body} = shortest; + assert(function_body.match(/^(\s*)else\s*:\s*^\1\s{4}paths\s*\[\s*node\s*\]\s*\.extend\s*\(\s*paths\s*\[\s*current\s*\]\s*\)\s*^\1paths\s*\[\s*node\s*\]\s*\.append\s*\(\s*node\s*\)/ms)); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6557927ad11e58bf8c794b25.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6557927ad11e58bf8c794b25.md index e9a7367bb22..6985e5dfd70 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6557927ad11e58bf8c794b25.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6557927ad11e58bf8c794b25.md @@ -28,7 +28,7 @@ You should print the provided string inside your new `for` loop. ({ test: () => { const shortest = __helpers.python.getDef(code, "shortest_path"); const {function_body} = shortest; - assert(function_body.match(/^(\s{4})for\s+node\s+in\s+targets_to_print\s*:\s*^\1\1print\s*\(f("|')\\n\{\s*start\s*\}-\{\s*node\s*\}\sdistance:\s\{\s*distances\s*\[\s*node\s*\]\s*\}\\nPath:\s\{\s*(?=[^\1])("|')\s->\s\3\.join\s*\(\s*paths\s*\[\s*node\s*\]\s*\)\s*\}\2\s*\)/ms)); + assert(function_body.match(/^(\s{4})for\s+node\s+in\s+targets_to_print\s*:\s*^\1\1print\s*\(\s*f("|')\\n\{\s*start\s*\}-\{\s*node\s*\}\sdistance:\s\{\s*distances\s*\[\s*node\s*\]\s*\}\\nPath:\s\{\s*(?=[^\1])("|')\s->\s\3\.join\s*\(\s*paths\s*\[\s*node\s*\]\s*\)\s*\}\2\s*\)/ms)); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6559d70c5161b16ff1d6530d.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6559d70c5161b16ff1d6530d.md index cfdfbf231f1..49bdf2cb1f7 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6559d70c5161b16ff1d6530d.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6559d70c5161b16ff1d6530d.md @@ -32,7 +32,7 @@ You should create a variable called `targets_to_print` after your `while` loop. ({ test: () => { const shortest = __helpers.python.getDef(code, "shortest_path"); const {function_body} = shortest; - assert(function_body.match(/unvisited\.remove\(current\).*^\s{4}targets_to_print\s*=/ms)); + assert(function_body.match(/unvisited\.remove\(\s*current\s*\).*^\s{4}targets_to_print\s*=/ms)); } }) ``` @@ -43,7 +43,7 @@ You should the ternary syntax to assign `[target]` when `target` is truthy, and ({ test: () => { const shortest = __helpers.python.getDef(code, "shortest_path"); const {function_body} = shortest; - assert(function_body.match(/unvisited\.remove\(current\).*^\s{4}targets_to_print\s*=\s*\[\s*target\s*\]\s+if\s+target\s+else\s+graph/ms)); + assert(function_body.match(/unvisited\.remove\(\s*current\s*\).*^\s{4}targets_to_print\s*=\s*\[\s*target\s*\]\s+if\s+target\s+else\s+graph/ms)); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6579cbab9825b8170974c69a.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6579cbab9825b8170974c69a.md index 15338d90709..93a81b046d9 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6579cbab9825b8170974c69a.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-algorithm-design-by-building-a-shortest-path-algorithm/6579cbab9825b8170974c69a.md @@ -25,7 +25,7 @@ Just before your `print()` call, use the `del` keyword to delete the `age` key a You should use the `del` keyword to delete `copper['age']` before the `print()` call. ```js -({ test: () => assert.match(code, /^del\s+copper\[\s*("|')age\1\s*\].*^print\s*\(\s*copper\s*\)/ms) }) +({ test: () => assert.match(code, /^del\s+copper\s*\[\s*("|')age\1\s*\].*^print\s*\(\s*copper\s*\)/ms) }) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/656874efd5102b81815c8ef7.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/656874efd5102b81815c8ef7.md index cede04598d9..e2a3b2527d9 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/656874efd5102b81815c8ef7.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/656874efd5102b81815c8ef7.md @@ -24,7 +24,7 @@ Create an `__init__` method inside your `Board` class. Your method should be named `__init__`. Don't add any parameters. ```js -assert.match(code, / +def\s+__init__\s*\(\)\:/); +assert.match(code, / +def\s+__init__\s*\(\s*\)\:/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568991b4d4874a4d5271337.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568991b4d4874a4d5271337.md index 31d9ffd6fd6..45f4dc93ff6 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568991b4d4874a4d5271337.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568991b4d4874a4d5271337.md @@ -43,6 +43,6 @@ class Board: --fcc-editable-region-- for index, line in enumerate(self.board): row_list = [] - + --fcc-editable-region-- ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568994faf481da5d37bfa40.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568994faf481da5d37bfa40.md index d6b0c39c865..6ca1945c89c 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568994faf481da5d37bfa40.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568994faf481da5d37bfa40.md @@ -16,7 +16,7 @@ Use list slicing to create the three lists of equal length representing the `lin You should have `enumerate([line[:3], line[3:6], line[6:]], start=1)` within the inner `for` loop. ```js -assert.match(code, /\[line\[:3\],\s*line\[3:6\],\s*line\[6:\]\]\s*,\s*start\s*=\s*1/); +assert.match(code, /\[\s*line\s*\[\s*:3\s*\]\s*,\s*line\s*\[\s*3\s*:\s*6\s*\]\s*,\s*line\s*\[\s*6\s*:\s*\]\s*\]\s*,\s*start\s*=\s*1/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568beebba98a3d1f26f6bf8.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568beebba98a3d1f26f6bf8.md index 35e95dc4627..86f6ee034bb 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568beebba98a3d1f26f6bf8.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568beebba98a3d1f26f6bf8.md @@ -14,13 +14,13 @@ In the `try` block, attempt to find the index of the first occurrence of `0` in Use the index of the first occurrence of `0` in the current row using `contents.index(0)`. ```js -assert.match(code, /contents\.index\(0\)/) +assert.match(code, /contents\.index\(\s*0\s*\)/) ``` You should have `col = contents.index(0)` within the `try` block. ```js -assert.match(code, /col\s*=\s*contents\.index\(0\)/) +assert.match(code, /col\s*=\s*contents\.index\(\s*0\s*\)/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568c0013b3b62d7617518c7.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568c0013b3b62d7617518c7.md index 54a25603769..7d603a4b32f 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568c0013b3b62d7617518c7.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568c0013b3b62d7617518c7.md @@ -16,7 +16,7 @@ You should check if the number(`num`) is not present in `self.board[row]`. You should have `num not in self.board[row]` within `valid_in_row`. ```js -assert.match(code, /num\s+not\s+in\s+self\.board\[row\]/) +assert.match(code, /num\s+not\s+in\s+self\.board\s*\[\s*row\s*\]/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568c024933423d85d5ed93c.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568c024933423d85d5ed93c.md index 9a9137a00c5..902004b8c04 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568c024933423d85d5ed93c.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6568c024933423d85d5ed93c.md @@ -21,7 +21,7 @@ You should have `return num not in self.board[row]` within `valid_in_row`. const tCode = code.replace(/\r/g, ''); const valid = __helpers.python.getDef(tCode, "valid_in_row"); const {function_body} = valid; -assert.match(function_body, /return\s+num\s+not\s+in\s+self\.board\[row\]/); +assert.match(function_body, /return\s+num\s+not\s+in\s+self\.board\s*\[\s*row\s*\]/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569d83fe4dcc614c2ff971d.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569d83fe4dcc614c2ff971d.md index 397a6f431a7..b5a91b523e7 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569d83fe4dcc614c2ff971d.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569d83fe4dcc614c2ff971d.md @@ -17,7 +17,7 @@ You should have `self.board[row][col] != num` within `valid_in_col`. const tCode = code.replace(/\r/g, ''); const valid = __helpers.python.getDef(tCode, "valid_in_col"); const {function_body} = valid; -assert.match(function_body, /self\.board\[row\]\[col\]\s*!=\s*num/); +assert.match(function_body, /self\.board\s*\[\s*row\s*\]\s*\[\s*col\s*\]\s*!=\s*num/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569d8a4b8d85515cbb1ce72.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569d8a4b8d85515cbb1ce72.md index 79bd839e5de..3911b5f36da 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569d8a4b8d85515cbb1ce72.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569d8a4b8d85515cbb1ce72.md @@ -28,7 +28,7 @@ You should have `all(self.board[row][col] != num for row in range(9))` within `v const tCode = code.replace(/\r/g, ''); const valid = __helpers.python.getDef(tCode, "valid_in_col"); const {function_body} = valid; -assert.match(function_body, /all\s*\(\s*self\.board\[row\]\[col\]\s*!=\s*num\s+for\s+row\s+in\s+range\s*\(\s*9\s*\)\s*\)/); +assert.match(function_body, /all\s*\(\s*self\.board\s*\[\s*row\s*\]\s*\[\s*col\s*\]\s*!=\s*num\s+for\s+row\s+in\s+range\s*\(\s*9\s*\)\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569d9dfd53db11b176d2963.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569d9dfd53db11b176d2963.md index 80d57e06e82..b30a2b63bb4 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569d9dfd53db11b176d2963.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569d9dfd53db11b176d2963.md @@ -21,7 +21,7 @@ You should assign the result of `(row // 3) * 3` to `row_start`. const tCode = code.replace(/\r/g, ''); const valid = __helpers.python.getDef(tCode, "valid_in_square"); const {function_body} = valid; -assert.match(function_body, /row_start\s*=\s*\(row\s*\/\/\s*3\)\s*\*\s*3/); +assert.match(function_body, /row_start\s*=\s*\(\s*row\s*\/\/\s*3\s*\)\s*\*\s*3/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569da02e7e2641be14ff922.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569da02e7e2641be14ff922.md index c069324c97c..cd782ea0d1c 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569da02e7e2641be14ff922.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569da02e7e2641be14ff922.md @@ -21,7 +21,7 @@ You should assign the result of `(col // 3) * 3` to `col_start`. const tCode = code.replace(/\r/g, ''); const valid = __helpers.python.getDef(tCode, "valid_in_square"); const {function_body} = valid; -assert.match(function_body, /col_start\s*=\s*\(col\s*\/\/\s*3\)\s*\*\s*3/); +assert.match(function_body, /col_start\s*=\s*\(\s*col\s*\/\/\s*3\s*\)\s*\*\s*3/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569e41657a9923953aa7d3c.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569e41657a9923953aa7d3c.md index 87d04dbe9bb..ccec106f37e 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569e41657a9923953aa7d3c.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569e41657a9923953aa7d3c.md @@ -22,7 +22,7 @@ You should have `next_empty := self.find_empty_cell()` within the `solver` metho ```js const tCode = code.replace(/\r/g, ''); const {function_body} = __helpers.python.getDef(tCode, "solver"); -assert.match(function_body, /next_empty\s*:=\s*self\.find_empty_cell\(\)/); +assert.match(function_body, /next_empty\s*:=\s*self\.find_empty_cell\(\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569e481e67f123ad25c5d20.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569e481e67f123ad25c5d20.md index 0bcaf803135..119631e5930 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569e481e67f123ad25c5d20.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569e481e67f123ad25c5d20.md @@ -16,7 +16,7 @@ You should have `if (next_empty := self.find_empty_cell()) is None:` withing `so ```js const tCode = code.replace(/\r/g, ''); const {function_body} = __helpers.python.getDef(tCode, "solver"); -assert.match(function_body, /if\s*\(next_empty\s*:=\s*self\.find_empty_cell\(\)\)\s*is\s*None:/) +assert.match(function_body, /if\s*\(\s*next_empty\s*:=\s*self\.find_empty_cell\(\s*\)\s*\)\s*is\s*None:/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f70a66ccdc42097ca051.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f70a66ccdc42097ca051.md index 00a40c74f0e..777d8e828e5 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f70a66ccdc42097ca051.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f70a66ccdc42097ca051.md @@ -7,7 +7,7 @@ dashedName: step-64 # --description-- -If still there are empty cells, create a loop in the `else` block that iterates over numbers from `1` to `9` (inclusive). +If there are still empty cells, create a loop in the `else` block that iterates over numbers from `1` to `9` (inclusive). Your loop should use the variable named `guess`. # --hints-- @@ -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\(1,\s*10\)/); +assert.match(block_body, /for\s+\w+\s+in\s+range\(\s*1,\s*10\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f7f2fa74c045e95676ac.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f7f2fa74c045e95676ac.md index c6998388073..6e84768b9e3 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f7f2fa74c045e95676ac.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569f7f2fa74c045e95676ac.md @@ -17,7 +17,7 @@ You should have `self.board[row][col] = guess` within the innermost `if` block. 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, /self\.board\[\s*row\s*\]\[\s*col\s*\]\s*=\s*guess/); +assert.match(block_body, /self\.board\s*\[\s*row\s*\]\s*\[\s*col\s*\]\s*=\s*guess/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fa5b9d507748bf4ec722.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fa5b9d507748bf4ec722.md index 1820b157384..d98033431b9 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fa5b9d507748bf4ec722.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fa5b9d507748bf4ec722.md @@ -17,7 +17,7 @@ You should have `self.solver()` within the innermost `if` block. 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, /self\.solver\(\)/); +assert.match(block_body, /self\.solver\(\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fa85d8f9ed49c8dfb37d.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fa85d8f9ed49c8dfb37d.md index c5a58ac4920..3928aec1803 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fa85d8f9ed49c8dfb37d.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fa85d8f9ed49c8dfb37d.md @@ -19,7 +19,7 @@ You should have `if self.solver():` within the innermost `if` block. 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, /if\s+self\.solver\(\):/); +assert.match(block_body, /if\s+self\.solver\(\s*\):/); ``` You should have `return True` within `if self.solver():`. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fabbfe1c094ad838ec4c.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fabbfe1c094ad838ec4c.md index 67dc94c5876..9f05bd68e30 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fabbfe1c094ad838ec4c.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fabbfe1c094ad838ec4c.md @@ -19,7 +19,7 @@ You should have `self.board[row][col] = 0` outside the innermost `if` block. 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, /self\.board\[\s*row\s*\]\[\s*col\s*\]\s*=\s*0/); +assert.match(block_body, /self\.board\s*\[\s*row\s*\]\s*\[\s*col\s*\]\s*=\s*0/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fc63a404c8519d918095.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fc63a404c8519d918095.md index 79eb771384e..80d05b52712 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fc63a404c8519d918095.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fc63a404c8519d918095.md @@ -18,7 +18,7 @@ You should have `gameboard = Board(board)` within the `solve_sudoku` function. ```js const tCode = code.replace(/\r/g, ''); const {function_body} = __helpers.python.getDef(tCode, "solve_sudoku"); -assert.match(function_body, /gameboard\s*=\s*Board\(board\)/); +assert.match(function_body, /gameboard\s*=\s*Board\(\s*board\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fe0fe5b5425a1bb1f534.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fe0fe5b5425a1bb1f534.md index 18b921ff631..4547fbb10f0 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fe0fe5b5425a1bb1f534.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-classes-and-objects-by-building-a-sudoku-solver/6569fe0fe5b5425a1bb1f534.md @@ -22,7 +22,7 @@ With this, you are finished with building the sudoku solver! Call the `solve_sudoku` method with `puzzle` as input. ```js -assert.match(code, /solve_sudoku\(puzzle\)/); +assert.match(code, /solve_sudoku\(\s*puzzle\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656627b47bd2d2a4afbc945d.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656627b47bd2d2a4afbc945d.md index 478dbd9941c..0fb0d63daf0 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656627b47bd2d2a4afbc945d.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656627b47bd2d2a4afbc945d.md @@ -37,7 +37,7 @@ You should assign `array[:middle_point]` to the `left_part` variable. const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /left_part\s*=\s*array\[:middle_point\]/); + assert.match(function_body, /left_part\s*=\s*array\s*\[\s*:\s*middle_point\s*\]/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656706afd65547d22bee0b68.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656706afd65547d22bee0b68.md index a3115ff5b3d..7ff0f3c6c63 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656706afd65547d22bee0b68.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656706afd65547d22bee0b68.md @@ -22,7 +22,7 @@ You should replace `pass` keyword with an `if` statement with this condition: `l const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\)\s+and\s+right_array_index\s*<\s*len\(right_part\):\s*[^}]*if\s+left_part\[left_array_index\]\s*<\s*right_part\[right_array_index\]:\s*pass/); + assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\)\s+and\s+right_array_index\s*<\s*len\(\s*right_part\s*\):\s*[^}]*if\s+left_part\s*\[\s*left_array_index\s*\]\s*<\s*right_part\s*\[\s*right_array_index\s*\]\s*:\s*pass/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656707e11e671ed54c96f7ec.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656707e11e671ed54c96f7ec.md index 88d10cab519..829f332dada 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656707e11e671ed54c96f7ec.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656707e11e671ed54c96f7ec.md @@ -24,7 +24,7 @@ You should replace `pass` with `array[sorted_index] = left_part[left_array_index const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\)\s+and\s+right_array_index\s*<\s*len\(right_part\):\s*[^}]*if\s+left_part\[left_array_index\]\s*<\s*right_part\[right_array_index\]:\s*[^}]*array\[sorted_index\]\s*=\s*left_part\[left_array_index\]\s*(?!.*\bpass\b)/); + assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\)\s+and\s+right_array_index\s*<\s*len\(\s*right_part\s*\):\s*[^}]*if\s+left_part\s*\[\s*left_array_index\s*\]\s*<\s*right_part\s*\[\s*right_array_index\s*\]\s*:\s*[^}]*array\s*\[\s*sorted_index\s*\]\s*=\s*left_part\s*\[\s*left_array_index\s*\]\s*(?!.*\bpass\b)/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656709e50ed928da35260276.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656709e50ed928da35260276.md index 4b3f08d05dd..05069da468b 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656709e50ed928da35260276.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656709e50ed928da35260276.md @@ -24,7 +24,7 @@ You should have `array[sorted_index] = right_part[right_array_index]` in the bod const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /else:\s*[^}]*array\[sorted_index\]\s*=\s*right_part\[right_array_index\]/); + assert.match(function_body, /else:\s*[^}]*array\s*\[\s*sorted_index\s*\]\s*=\s*right_part\s*\[\s*right_array_index\s*\]/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656710d1e0ec62253426db24.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656710d1e0ec62253426db24.md index c2dc69a70a1..b7a9ff260b3 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656710d1e0ec62253426db24.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/656710d1e0ec62253426db24.md @@ -24,7 +24,7 @@ Your `while` loop should have this condition: `left_array_index < len(left_part) const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /^\s{4}while\s+left_array_index\s*<\s*len\(left_part\):/m); + assert.match(function_body, /^\s{4}while\s+left_array_index\s*<\s*len\(\s*left_part\s*\):/m); } }) ``` @@ -38,7 +38,7 @@ You should have the `pass` keyword in the body of your `while` loop const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\):[^}]*\bpass\b/); + assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\):[^}]*\bpass\b/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b0a63423f65dd30888df.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b0a63423f65dd30888df.md index b2635874f1f..95801ce621f 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b0a63423f65dd30888df.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b0a63423f65dd30888df.md @@ -20,7 +20,7 @@ You should have `array[sorted_index] = left_part[left_array_index]` in the body const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\):[^}]*\barray\[sorted_index\]\s*=\s*left_part\[left_array_index\]/); + assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\):[^}]*\barray\s*\[\s*sorted_index\s*\]\s*=\s*left_part\s*\[\s*left_array_index\s*\]/); } }) ``` @@ -34,7 +34,7 @@ You should not have `pass` in the `while` loop. const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\):(?:(?!\bpass\b)[^}])*\barray\[sorted_index\]\s*=\s*left_part\[left_array_index\]/); + assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\):(?:(?!\bpass\b)[^}])*\barray\s*\[\s*sorted_index\s*\]\s*=\s*left_part\s*\[\s*left_array_index\s*\]/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b19d31a09b65b4bc390a.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b19d31a09b65b4bc390a.md index 151f550145c..7f37a255776 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b19d31a09b65b4bc390a.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b19d31a09b65b4bc390a.md @@ -20,7 +20,7 @@ You should use the `+=` operator to increment the current value of `left_array_i const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\):[^}]*\bleft_array_index\s*\+=\s*1\b/); + assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\):[^}]*\bleft_array_index\s*\+=\s*1\b/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b20f829b7e69d43c232a.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b20f829b7e69d43c232a.md index d50325ede29..602b7a1bf44 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b20f829b7e69d43c232a.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b20f829b7e69d43c232a.md @@ -22,7 +22,7 @@ You should use the `+=` operator to increment the current value of `sorted_index const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /while\s+left_array_index\s*<\s*len\(left_part\):[^}]*\bsorted_index\s*\+=\s*1\b/); + assert.match(function_body, /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\):[^}]*\bsorted_index\s*\+=\s*1\b/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b4e0bd29d17d4b53b16c.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b4e0bd29d17d4b53b16c.md index 43438c94203..1f4cf34616e 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b4e0bd29d17d4b53b16c.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b4e0bd29d17d4b53b16c.md @@ -22,7 +22,7 @@ Your `while` loop should have this condition: `right_array_index < len(right_par const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /^\s{4}while\s+right_array_index\s*<\s*len\(right_part\):/m); + assert.match(function_body, /^\s{4}while\s+right_array_index\s*<\s*len\(\s*right_part\s*\):/m); } }) ``` @@ -36,7 +36,7 @@ You should have the `pass` keyword in the body of your `while` loop const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /while\s+right_array_index\s*<\s*len\(right_part\):[^}]*\bpass\b/); + assert.match(function_body, /while\s+right_array_index\s*<\s*len\(\s*right_part\s*\):[^}]*\bpass\b/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b5c820a6a1859786e774.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b5c820a6a1859786e774.md index 41811e156d7..057c990b641 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b5c820a6a1859786e774.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b5c820a6a1859786e774.md @@ -20,7 +20,7 @@ You should have `array[sorted_index] = right_part[right_array_index]` in the bod const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /while\s+right_array_index\s*<\s*len\(right_part\):[^}]*\barray\[sorted_index\]\s*=\s*right_part\[right_array_index\]/); + assert.match(function_body, /while\s+right_array_index\s*<\s*len\(\s*right_part\s*\):[^}]*\barray\s*\[\s*sorted_index\s*\]\s*=\s*right_part\s*\[\s*right_array_index\s*\]/); } }) ``` @@ -34,7 +34,7 @@ There should be no `pass` keyword in the `while` loop const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /while\s+right_array_index\s*<\s*len\(right_part\):(?:(?!\bpass\b)[^}])*\barray\[sorted_index\]\s*=\s*right_part\[right_array_index\]/); + assert.match(function_body, /while\s+right_array_index\s*<\s*len\(\s*right_part\s*\):(?:(?!\bpass\b)[^}])*\barray\s*\[\s*sorted_index\s*\]\s*=\s*right_part\s*\[\s*right_array_index\s*\]/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b68fac723e8c20223ed3.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b68fac723e8c20223ed3.md index 80ce6270252..263c161db40 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b68fac723e8c20223ed3.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b68fac723e8c20223ed3.md @@ -20,7 +20,7 @@ You should have `right_array_index += 1` within the `while` loop. const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /while\s+right_array_index\s*<\s*len\(right_part\):[^}]*\bright_array_index\s*\+=\s*1\b/); + assert.match(function_body, /while\s+right_array_index\s*<\s*len\(\s*right_part\s*\):[^}]*\bright_array_index\s*\+=\s*1\b/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b6be44940a8e2a469c31.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b6be44940a8e2a469c31.md index 9bbacf039e3..02f8ece59cd 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b6be44940a8e2a469c31.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b6be44940a8e2a469c31.md @@ -20,7 +20,7 @@ You should use the `+=` operator to increment the current value of `sorted_index const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /while\s+right_array_index\s*<\s*len\(right_part\):[^}]*\bsorted_index\s*\+=\s*1\b/); + assert.match(function_body, /while\s+right_array_index\s*<\s*len\(\s*right_part\s*\):[^}]*\bsorted_index\s*\+=\s*1\b/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b743630ee592a65a7e2f.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b743630ee592a65a7e2f.md index 4db084d042d..e8531fed130 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b743630ee592a65a7e2f.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569b743630ee592a65a7e2f.md @@ -24,7 +24,7 @@ You should create an `if` statement to check if `len(array) <= 1`. Don't forget const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /if\s+len\(array\)\s*<=\s*1:\s*pass/); + assert.match(function_body, /if\s+len\(\s*array\s*\)\s*<=\s*1:\s*pass/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569bca4dd9feab7b295a5e1.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569bca4dd9feab7b295a5e1.md index d632afe9281..b1cc49ce5e2 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569bca4dd9feab7b295a5e1.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6569bca4dd9feab7b295a5e1.md @@ -20,7 +20,7 @@ You should replace `pass` with a `return` statement in the body of the `if` stat const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /if\s+len\(array\)\s*<=\s*1:\s*return/); + assert.match(function_body, /if\s+len\(\s*array\s*\)\s*<=\s*1:\s*return/); } }) ``` @@ -34,7 +34,7 @@ There should be no `pass` keyword in the body of the `if` statement const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /if\s+len\(array\)\s*<=\s*1:\s*(?!.*\bpass\b).*return/); + assert.match(function_body, /if\s+len\(\s*array\s*\)\s*<=\s*1:\s*(?!.*\bpass\b).*return/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6577562501feabdf0984a184.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6577562501feabdf0984a184.md index 7e4dc47acfe..0cd12520d6c 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6577562501feabdf0984a184.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/6577562501feabdf0984a184.md @@ -21,8 +21,8 @@ You should add `1` to the current value of `left_array_index`. const { function_body } = merge_sort; const allowedMatches = [ - /while\s+left_array_index\s*<\s*len\(left_part\)\s+and\s+right_array_index\s*<\s*len\(right_part\):\s*[^}]*if\s+left_part\[left_array_index\]\s*<\s*right_part\[right_array_index\]:\s*[^}]*left_array_index\s*\+=\s*1\s*(?!.*\bpass\b)/, - /while\s+left_array_index\s*<\s*len\(left_part\)\s+and\s+right_array_index\s*<\s*len\(right_part\):\s*[^}]*if\s+left_part\[left_array_index\]\s*<\s*right_part\[right_array_index\]:\s*[^}]*left_array_index\s*=\s*left_array_index\s*\+\s*1\s*(?!.*\bpass\b)/ + /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\)\s+and\s+right_array_index\s*<\s*len\(\s*right_part\s*\):\s*[^}]*if\s+left_part\s*\[\s*left_array_index\s*\]\s*<\s*right_part\s*\[\s*right_array_index\s*\]\s*:\s*[^}]*left_array_index\s*\+=\s*1\s*(?!.*\bpass\b)/, + /while\s+left_array_index\s*<\s*len\(\s*left_part\s*\)\s+and\s+right_array_index\s*<\s*len\(\s*right_part\s*\):\s*[^}]*if\s+left_part\s*\[\s*left_array_index\s*\]\s*<\s*right_part\s*\[\s*right_array_index\s*\]\s*:\s*[^}]*left_array_index\s*=\s*left_array_index\s*\+\s*1\s*(?!.*\bpass\b)/ ] const anyMatch = allowedMatches.some((match) => match.test(function_body)); diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/657f3a661730891aa64f3568.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/657f3a661730891aa64f3568.md index 033b132b10b..85ea983f951 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/657f3a661730891aa64f3568.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-data-structures-by-building-the-merge-sort-algorithm/657f3a661730891aa64f3568.md @@ -34,7 +34,7 @@ You should assign `array[middle_point:]` to the `right_part` variable const merge_sort = __helpers.python.getDef("\n" + transformedCode, "merge_sort"); const { function_body } = merge_sort; - assert.match(function_body, /right_part\s*=\s*array\[middle_point:\]/); + assert.match(function_body, /right_part\s*=\s*array\s*\[\s*middle_point\s*:\s*\]/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656877c202f44995ed952608.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656877c202f44995ed952608.md index fc8086c4022..0247cd7f8df 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656877c202f44995ed952608.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656877c202f44995ed952608.md @@ -7,11 +7,11 @@ dashedName: step-2 # --description-- -Replace the `pass` statement with a variable named `card_number` and a value of `4111-1111-4555-1142`. +Replace the `pass` statement with a variable named `card_number` and a value of `'4111-1111-4555-1142'`. # --hints-- -You should have `card_number = "4111-1111-4555-1142"` within the `main` function. +You should have `card_number = '4111-1111-4555-1142'` within the `main` function. ```js ({ diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656879a66338b2a461d5d307.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656879a66338b2a461d5d307.md index bfcc9dda13c..c0498ffe1a2 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656879a66338b2a461d5d307.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656879a66338b2a461d5d307.md @@ -13,7 +13,7 @@ The Luhn algorithm is as follows: 1. From the right to left, double the value of every second digit; if the product is greater than 9, sum the digits of the products. 2. Take the sum of all the digits. -3. If the sum of all the digits is a multiple of `10`, then the number is valid; else it is not valid. +3. If the sum of all the digits is a multiple of 10, then the number is valid; else it is not valid. Assume an example of an account number "7992739871" that will have a check digit added, making it of the form 7992739871x: diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656879c6f35a85a59c06b3a7.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656879c6f35a85a59c06b3a7.md index bbf0e0b3803..f3095c1670b 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656879c6f35a85a59c06b3a7.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656879c6f35a85a59c06b3a7.md @@ -30,7 +30,7 @@ You should have `card_number_reversed = card_number[0:4]` within the `verify_car const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); const { function_body } = verify_card_number; - assert.match(function_body, /card_number_reversed\s*=\s*card_number\[0:4\]/); + assert.match(function_body, /card_number_reversed\s*=\s*card_number\s*\[\s*0\s*:\s*4\s*\]/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687a8253766cac4c99c57f.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687a8253766cac4c99c57f.md index 0a22da3ebcd..7ac18aa3dfb 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687a8253766cac4c99c57f.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687a8253766cac4c99c57f.md @@ -20,7 +20,7 @@ You should have `odd_digits = card_number_reversed[::2]` within the `verify_card const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); const { function_body } = verify_card_number; - assert.match(function_body, /odd_digits\s*=\s*card_number_reversed\[::2\]/); + assert.match(function_body, /odd_digits\s*=\s*card_number_reversed\s*\[\s*:\s*:\s*2\s*\]/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687b48f2201ab32e06c37c.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687b48f2201ab32e06c37c.md index d4944fe528f..ea87c48c682 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687b48f2201ab32e06c37c.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687b48f2201ab32e06c37c.md @@ -27,7 +27,7 @@ You should have `sum_of_odd_digits += int(digit)` within the `for` loop. const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); const { function_body } = verify_card_number; - assert.match(function_body, /sum_of_odd_digits\s*\+=\s*int\(digit\)/); + assert.match(function_body, /sum_of_odd_digits\s*\+=\s*int\(\s*digit\s*\)/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687b8eb0bbf7b5d41b610b.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687b8eb0bbf7b5d41b610b.md index 99106f4e540..f768be57a2d 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687b8eb0bbf7b5d41b610b.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687b8eb0bbf7b5d41b610b.md @@ -20,7 +20,7 @@ You should have `even_digits = card_number_reversed[1::2]` within the `verify_ca const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); const { function_body } = verify_card_number; - assert.match(function_body, /even_digits\s*=\s*card_number_reversed\[1::2\]/); + assert.match(function_body, /even_digits\s*=\s*card_number_reversed\s*\[\s*1\s*:\s*:\s*2\s*\]/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687c8d86e18cbd775a53c9.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687c8d86e18cbd775a53c9.md index ac03d76cec7..e68412552e7 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687c8d86e18cbd775a53c9.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687c8d86e18cbd775a53c9.md @@ -22,7 +22,7 @@ You should have `number = int(digit) * 2` within the `for` loop. const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); const { function_body } = verify_card_number; - assert.match(function_body, /number\s*=\s*int\(digit\)\s*\*\s*2/); + assert.match(function_body, /number\s*=\s*int\(\s*digit\s*\)\s*\*\s*2/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687db6a9fcf3c548a6c1b7.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687db6a9fcf3c548a6c1b7.md index 14d051c1336..a57e23f8eec 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687db6a9fcf3c548a6c1b7.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687db6a9fcf3c548a6c1b7.md @@ -30,8 +30,8 @@ You should have `number = number // 10 + number % 10` within the `if` statement. const verify_card_number = __helpers.python.getBlock("\n" + transformedCode, "if number >= 10"); const { block_body } = verify_card_number; const allowedMatches = [ - /number *= *\(?number *\/\/ *10\)? *\+ *\(?number *% *10/, - /number *= *\(?number *% *10\)? *\+ *\(?number *\/\/ *10/ + /number *= *\(?\s*number *\/\/ *10\s*\)? *\+ *\(?\s*number *% *10/, + /number *= *\(?\s*number *% *10\s*\)? *\+ *\(?\s*number *\/\/ *10/ ]; const someMatch = allowedMatches.some(allowedMatch => allowedMatch.test(block_body)); diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687e457ab1c4cb8c3fe7c8.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687e457ab1c4cb8c3fe7c8.md index e17792dd3bc..06d4c49c3a7 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687e457ab1c4cb8c3fe7c8.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687e457ab1c4cb8c3fe7c8.md @@ -7,7 +7,7 @@ dashedName: step-33 # --description-- -Adjust the `verify_card_number` call such that if it returns `True`, print `VALID!` to the console. Otherwise, print `INVALID!`. +Adjust the `verify_card_number` call such that if it returns `True`, print `'VALID!'` to the console. Otherwise, print `'INVALID!'`. # --hints-- @@ -26,7 +26,7 @@ You should have `if verify_card_number(translated_card_number):` within the `mai }) ``` -You should have `print("VALID!")` within the `if` statement. +You should have `print('VALID!')` within the `if` statement. ```js ({ @@ -40,7 +40,7 @@ You should have `print("VALID!")` within the `if` statement. }) ``` -You should have `print("INVALID!")` within the `else` clause. +You should have `print('INVALID!')` within the `else` clause. ```js ({ diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687f47f9001dd35bdcd5ab.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687f47f9001dd35bdcd5ab.md index 945e719bff8..04c76315508 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687f47f9001dd35bdcd5ab.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/65687f47f9001dd35bdcd5ab.md @@ -7,7 +7,7 @@ dashedName: step-34 # --description-- -Change the value of `card_number` such that `INVALID!` is printed to the console. +Change the value of `card_number` such that `'INVALID!'` is printed to the console. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656b475b394390334828eb12.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656b475b394390334828eb12.md index 4efc683ac39..62247b056f7 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656b475b394390334828eb12.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656b475b394390334828eb12.md @@ -20,7 +20,7 @@ You should have `card_number_reversed = card_number[0:4:2]` within the `verify_c const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); const { function_body } = verify_card_number; - assert.match(function_body, /card_number_reversed\s*=\s*card_number\[0:4:2\]/); + assert.match(function_body, /card_number_reversed\s*=\s*card_number\s*\[\s*0\s*:\s*4\s*:\s*2\s*\]/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656b481ec4976439565a78b2.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656b481ec4976439565a78b2.md index 603ec274675..870a14c91b5 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656b481ec4976439565a78b2.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-how-to-work-with-numbers-and-strings-by-implementing-the-luhn-algorithm/656b481ec4976439565a78b2.md @@ -27,7 +27,7 @@ You should have `card_number_reversed = card_number[::-1]` within the `verify_ca const verify_card_number = __helpers.python.getDef("\n" + transformedCode, "verify_card_number"); const { function_body } = verify_card_number; - assert.match(function_body, /card_number_reversed\s*=\s*card_number\[::-1\]/); + assert.match(function_body, /card_number_reversed\s*=\s*card_number\s*\[\s*:\s*:\s*-1\s*\]/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65822308ded1ba4632f66aa3.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65822308ded1ba4632f66aa3.md index 800d8b1f84b..d50879db3a5 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65822308ded1ba4632f66aa3.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65822308ded1ba4632f66aa3.md @@ -10,10 +10,10 @@ dashedName: step-4 A dictionary is another built-in data type in Python. A dictionary is a collection of data in the form of *key*-*value* pairs. Dictionaries are defined with curly braces `{}` and they contain key-value pairs separated by commas. Each key is followed by a colon `:` and the value: ```py -{"amount": 50.0, "category": "Food"} +{'amount': 50.0, 'category': 'Food'} ``` -In the example above, `amount` and `category` are keys, and `50.0` and `Food` are their the corresponding values. +In the example above, `amount` and `category` are keys, and `50.0` and `'Food'` are their the corresponding values. Create a dictionary with a key `amount` and value of the `amount` parameter and pass your new dictionary to the `.append()` call. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658225d560369446ece5518b.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658225d560369446ece5518b.md index f3a900f13ea..9c927745b89 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658225d560369446ece5518b.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658225d560369446ece5518b.md @@ -7,7 +7,7 @@ dashedName: step-5 # --description-- -Add another key-value pair to the dictionary you are appending to the `expense` list. Use the string `category` as the key, and the `category` parameter as the value. +Add another key-value pair to the dictionary you are appending to the `expense` list. Use the string `'category'` as the key, and the `category` parameter as the value. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65822bd82d708c4895080c35.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65822bd82d708c4895080c35.md index d7ade5dcd59..d8d50f45262 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65822bd82d708c4895080c35.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65822bd82d708c4895080c35.md @@ -10,11 +10,11 @@ dashedName: step-9 You can access values in a dictionary through its keys. You need to use the bracket notation and include the key between the square brackets: ```py -my_dict = {"amount": 50.0, "category": "Food"} -my_dict["amount"] # 50.0 +my_dict = {'amount': 50.0, 'category': 'Food'} +my_dict['amount'] # 50.0 ``` -You are currently interpolating the `expense` dictionary in your f-string. Modify the f-string expression to access the value of the `amount` key and the `category` key in the `expense` dictionary. +You are currently interpolating the `expense` dictionary in your f-string. Modify the f-string expression to access the value of the `'amount'` key and the `'category'` key in the `expense` dictionary. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/6582324b5d37fe4b622bc3c0.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/6582324b5d37fe4b622bc3c0.md index d926a3ee6eb..1dda12ed7e7 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/6582324b5d37fe4b622bc3c0.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/6582324b5d37fe4b622bc3c0.md @@ -13,7 +13,7 @@ Lambda functions are brief, anonymous functions in Python, ideal for simple, one lambda x: expr ``` -In the example above, `x` is a parameter to be use in the expression `expr`. Create a `test` variable and assign it a lambda function that takes an `x` parameter and returns `x * 2`. +In the example above, `x` is a parameter to be used in the expression `expr`. Create a `test` variable and assign it a lambda function that takes an `x` parameter and returns `x * 2`. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65823bbbdb4eaa4f9d20a0fb.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65823bbbdb4eaa4f9d20a0fb.md index 5b0bc45e859..c9de5f0fb91 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65823bbbdb4eaa4f9d20a0fb.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65823bbbdb4eaa4f9d20a0fb.md @@ -7,7 +7,7 @@ dashedName: step-16 # --description-- -Within your `total_expenses` function, replace `pass` with a `lambda` function. Use `expense` as the parameter and return the value of the `amount` key in the `expense` dictionary. +Within your `total_expenses` function, replace `pass` with a `lambda` function. Use `expense` as the parameter and return the value of the `'amount'` key in the `expense` dictionary. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65823ff0d4b991510fade1a8.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65823ff0d4b991510fade1a8.md index 72916bfda0b..b1dc2eadedb 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65823ff0d4b991510fade1a8.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65823ff0d4b991510fade1a8.md @@ -7,7 +7,7 @@ dashedName: step-20 # --description-- -Within the `filter_expenses_by_category` function, replace `pass` with a `lambda` function. Use `expense` as the parameter and return the comparison between the value of the `category` key of the `expense` dictionary and `category`. +Within the `filter_expenses_by_category` function, replace `pass` with a `lambda` function. Use `expense` as the parameter and return the comparison between the value of the `'category'` key of the `expense` dictionary and `category`. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824561f3478e5371a33ae5.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824561f3478e5371a33ae5.md index a70b6f63c6f..af59c1df946 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824561f3478e5371a33ae5.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824561f3478e5371a33ae5.md @@ -23,7 +23,7 @@ You should define a function named `main()` without parameters. }) ``` -You should move the `expense` list inside the `main()` function body. +You should move the `expenses` list inside the `main()` function body. ```js ({ test: () => assert(__pyodide.runPython(` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658246c28575d653d1f89b59.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658246c28575d653d1f89b59.md index 9debd53a795..fd4eb09a765 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658246c28575d653d1f89b59.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658246c28575d653d1f89b59.md @@ -14,7 +14,7 @@ while condition: ``` -Below the `expense` list, create a `while` loop. Use `True` for the condition, and print the string `\nExpense Tracker` inside the loop body to show the title of the program. +Below the `expenses` list, create a `while` loop. Use `True` for the condition, and print the string `'\nExpense Tracker'` inside the loop body to show the title of the program. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824872894f59546e3084e2.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824872894f59546e3084e2.md index 3bf6343d3e3..3063be12946 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824872894f59546e3084e2.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824872894f59546e3084e2.md @@ -9,7 +9,7 @@ dashedName: step-25 The `while` loop you created in the previous step is an infinite loop that will allow the program to continuously present menu options until the user decides to exit. -After the `print()` call, add another one to print the string `1. Add an expense`. +After the `print()` call, add another one to print the string `'1. Add an expense'`. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824a1b16631c54fa524154.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824a1b16631c54fa524154.md index 5643a99858f..f5755ec145f 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824a1b16631c54fa524154.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824a1b16631c54fa524154.md @@ -7,7 +7,7 @@ dashedName: step-26 # --description-- -Next, add another `print()` call and pass the string `2. List all expenses`. +Next, add another `print()` call and pass the string `'2. List all expenses'`. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824c7b4e2da85597693dcf.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824c7b4e2da85597693dcf.md index 423bb01d257..a3b2b63db30 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824c7b4e2da85597693dcf.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824c7b4e2da85597693dcf.md @@ -7,7 +7,7 @@ dashedName: step-27 # --description-- -Provide the other menu options by printing the following three strings in your `while` loop: `3. Show total expenses`, `4. Filter expenses by category`, and `5. Exit`. +Provide the other menu options by printing the following three strings in your `while` loop: `'3. Show total expenses'`, `'4. Filter expenses by category'`, and `'5. Exit'`. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824dfdb6815d563b2d3256.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824dfdb6815d563b2d3256.md index 2160e868f84..5c4d86143c6 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824dfdb6815d563b2d3256.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65824dfdb6815d563b2d3256.md @@ -9,7 +9,7 @@ dashedName: step-28 The `input()` function takes a user input and it returns the user input in the form of a string. -Inside your `while` loop, call the `input()` function passing the string `Enter your choice:` as the argument, and assign the result to a variable named `choice`. +Inside your `while` loop, call the `input()` function passing the string `'Enter your choice: '` as the argument, and assign the result to a variable named `choice`. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/6582507654b3ed5712341382.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/6582507654b3ed5712341382.md index 7399b06040a..2d01bb17ff3 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/6582507654b3ed5712341382.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/6582507654b3ed5712341382.md @@ -7,9 +7,9 @@ dashedName: step-29 # --description-- -You are going to use conditional statements to check the user's choice. If the choice is `1`, it means the user wants to add an expense. +You are going to use conditional statements to check the user's choice. If the choice is `'1'`, it means the user wants to add an expense. -Still in the `while` loop, under the `choice` variable, write an `if` statement to check if `choice` equals the string `1`. If it's true, it will be the starting point for adding a new expense. +Still in the `while` loop, under the `choice` variable, write an `if` statement to check if `choice` equals the string `'1'`. If it's true, it will be the starting point for adding a new expense. Inside the `if` statement body, declare a variable `amount` and assign it an empty `input()` call. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658252f6b1526d57b103d48a.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658252f6b1526d57b103d48a.md index 3f467fc9249..feab4cdb500 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658252f6b1526d57b103d48a.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658252f6b1526d57b103d48a.md @@ -9,7 +9,7 @@ dashedName: step-30 Inside the `if` statement, you should ask the user to enter the amount for the expense and store it in a variable. -Pass the string `Enter amount:` to your empty `input()` call, so you can store the expense. +Pass the string `'Enter amount: '` to your empty `input()` call, so you can store the expense. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658258c0e5fbe85c14c060cf.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658258c0e5fbe85c14c060cf.md index 4c0c1333551..f64885b8a82 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658258c0e5fbe85c14c060cf.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/658258c0e5fbe85c14c060cf.md @@ -9,7 +9,7 @@ dashedName: step-34 To list all expenses, you can use an `elif` statement after an `if` statement. The `elif` checks additional conditions and only works following an `if` statement. -Create an `elif` statement to check if the user's choice equals the string `2`. Inside the `elif` statement, print the string `\nAll Expenses:`. +Create an `elif` statement to check if the user's choice equals the string `2`. Inside the `elif` statement, print the string `'\nAll Expenses:'`. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65825b758fe85a5cebabc8c5.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65825b758fe85a5cebabc8c5.md index 9064e28619f..49fa901315f 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65825b758fe85a5cebabc8c5.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/65825b758fe85a5cebabc8c5.md @@ -9,7 +9,7 @@ dashedName: step-36 To show the total expenses, create an `elif` statement that checks if `choice == '3'`. -If it's true, it means the user wants to see the total expenses. So call `print()` and pass the string `\nTotal Expenses:` as the first argument and `total_expenses(expenses)` as the second argument. +If it's true, it means the user wants to see the total expenses. So call `print()` and pass the string `'\nTotal Expenses: '` as the first argument and `total_expenses(expenses)` as the second argument. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/6582687859366a618424d84b.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/6582687859366a618424d84b.md index e2d2845b70d..dd8e1bdd00d 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/6582687859366a618424d84b.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-lambda-functions-by-building-an-expense-tracker/6582687859366a618424d84b.md @@ -7,9 +7,9 @@ dashedName: step-41 # --description-- -To provide a way to exit the program, use another `elif` statement to check if `choice` equals the string `5`. +To provide a way to exit the program, use another `elif` statement to check if `choice` equals the string `'5'`. -Inside the new `elif` statement, print the string `Exiting the program.` to show that the program is terminating its execution. +Inside the new `elif` statement, print the string `'Exiting the program.'` to show that the program is terminating its execution. # --hints-- @@ -26,7 +26,7 @@ You should have `elif choice == '5':` in your code. }) ``` -You should print `Exiting the program.` in your new `elif` statement. +You should print `'Exiting the program.'` in your new `elif` statement. ```js ({ test: () => diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657ed53c19461d4b95c4757a.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657ed53c19461d4b95c4757a.md index 42c507cd04d..de008a960b3 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657ed53c19461d4b95c4757a.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657ed53c19461d4b95c4757a.md @@ -22,7 +22,7 @@ You should replace `pass` with an empty list named `snake_cased_char_list` withi const convert_to_snake_case = __helpers.python.getDef("\n" + transformedCode, "convert_to_snake_case"); const { function_body } = convert_to_snake_case; - assert.match(function_body, / +snake_cased_char_list\s*=\s*\[\]/); + assert.match(function_body, / +snake_cased_char_list\s*=\s*\[\s*\]\s*/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657efdcf7fe23b76c0cff9ec.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657efdcf7fe23b76c0cff9ec.md index a475768fa3b..486eee76f6e 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657efdcf7fe23b76c0cff9ec.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657efdcf7fe23b76c0cff9ec.md @@ -34,7 +34,7 @@ You should use the `.append()` method to add `char` to the `snake_cased_char_lis const convert_to_snake_case = __helpers.python.getDef("\n" + transformedCode, "convert_to_snake_case"); const { function_body } = convert_to_snake_case; - assert.match(function_body, / +snake_cased_char_list.append\(char\)/); + assert.match(function_body, / +snake_cased_char_list.append\(\s*char\s*\)/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657f0353c9523d7d896873ea.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657f0353c9523d7d896873ea.md index 6feb1bfb4e3..63d15eda8f4 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657f0353c9523d7d896873ea.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657f0353c9523d7d896873ea.md @@ -7,11 +7,11 @@ dashedName: step-12 # --description-- -Inside the `main()` function, replace `pass` with a `convert_to_snake_case()` call. Pass the string `aLongAndComplexString` as input to the function and print out the output using the `print()` function. +Inside the `main()` function, replace `pass` with a `convert_to_snake_case()` call. Pass the string `'aLongAndComplexString'` as input to the function and print out the output using the `print()` function. # --hints-- -You should call `convert_to_snake_case()` inside the `main()` function and pass `aLongAndComplexString` as input to the function. +You should call `convert_to_snake_case()` inside the `main()` function and pass `'aLongAndComplexString'` as input to the function. ```js ({ diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657f4add33ea4b1f61ba3dc8.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657f4add33ea4b1f61ba3dc8.md index 7a14f22c4d2..9619247c586 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657f4add33ea4b1f61ba3dc8.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/657f4add33ea4b1f61ba3dc8.md @@ -7,7 +7,7 @@ dashedName: step-22 # --description-- -Finally try out this new implementation by executing the program. Change the input string to `IAmAPascalCasedString` and see if it comes out as `i_am_a_pascal_cased_string`, even though that's a lie. +Finally try out this new implementation by executing the program. Change the input string to `'IAmAPascalCasedString'` and see if it comes out as `'i_am_a_pascal_cased_string'`, even though that's a lie. If you've done everything correctly, you should see the input string converted into snake case, like before. @@ -15,7 +15,7 @@ Congratulations! Now your `convert_to_snake_case()` function is ready. # --hints-- -You should change the input string from `aLongAndComplexString` to `IAmAPascalCasedString` inside the `main()` function. +You should change the input string from `'aLongAndComplexString'` to `'IAmAPascalCasedString'` inside the `main()` function. ```js ({ @@ -24,7 +24,7 @@ You should change the input string from `aLongAndComplexString` to `IAmAPascalCa const main = __helpers.python.getDef("\n" + transformedCode, "main"); const { function_body } = main; - assert.match(function_body, / +print\(convert_to_snake_case\('IAmAPascalCasedString'\)\)/); + assert.match(function_body, / +print\(\s*convert_to_snake_case\(\s*'IAmAPascalCasedString'\s*\)\s*\)/); } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc8ea01436383a88256d7f.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc8ea01436383a88256d7f.md index cace50fe3d3..bccd26c6936 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc8ea01436383a88256d7f.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc8ea01436383a88256d7f.md @@ -7,9 +7,9 @@ dashedName: step-3 # --description-- -The puzzle starts with the disks piled up on the first rod, in decreasing size. You need to populate your first list with numbers representing the various disk sizes. +The puzzle starts with the disks piled up on the first rod, in decreasing size, with the smallest disk on top and the largest disk on the bottom. You need to populate your first list with numbers representing the various disk sizes. -Instead of adding the items manually to the first list, generate a sequence of numbers from `3` to `1` by using the `range()` function and assign it to `rods['A']`. +Instead of adding the items manually to the first list, generate a sequence of numbers counting down from `3` to `1` by using the `range()` function and assign it to `rods['A']`. Here, `3` represents the largest disk at the bottom of the pile and `1` represents the smallest disk at the top of the pile. The syntax is `range(x, y, h)`, where `x` is the starting integer (inclusive), `y` is the last integer (not inclusive), and `h` is the difference between a number and the next one in the sequence. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc9004f658183afa85f4f1.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc9004f658183afa85f4f1.md index bc389858a42..cef0d428114 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc9004f658183afa85f4f1.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc9004f658183afa85f4f1.md @@ -14,13 +14,13 @@ Now check the data type of your `'A'` key by passing it to the `type()` function You should pass your `'A'` key to the `type()` function. ```js -({ test: () => assert.match(code, /type\s*\(\s*rods\s*\[\s*('|")\s*A\s*\1\s*\]\)/) }) +({ test: () => assert.match(code, /type\s*\(\s*rods\s*\[\s*('|")\s*A\s*\1\s*\]\s*\)/) }) ``` You should print the type of `rods['A']` using the `print()` function. ```js -({ test: () => assert.match(code, /print\s*\(\s*type\s*\(\s*rods\s*\[\s*('|")\s*A\s*\1\s*\]\)\s*\)/) }) +({ test: () => assert.match(code, /print\s*\(\s*type\s*\(\s*rods\s*\[\s*('|")\s*A\s*\1\s*\]\s*\)\s*\)/) }) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc90e837670a3ba26a1e61.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc90e837670a3ba26a1e61.md index f05fdf44bb0..edcf8ed1041 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc90e837670a3ba26a1e61.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc90e837670a3ba26a1e61.md @@ -14,7 +14,7 @@ Now that the type is `list` as required, you can remove the `print()` call. You should remove `print(type(rods['A']))` from your code. ```js -({ test: () => assert.match(code, /\}(?!\s+print\s*\(\s*type\s*\(\s*rods\[\s*('|")A\1\s*\]\s*\)\s*\))/) }) +({ test: () => assert.match(code, /\}(?!\s+print\s*\(\s*type\s*\(\s*rods\s*\[\s*('|")A\1\s*\]\s*\)\s*\))/) }) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc97ab25730b3e9de86ea5.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc97ab25730b3e9de86ea5.md index 7db01abecf6..a1e0800c199 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc97ab25730b3e9de86ea5.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc97ab25730b3e9de86ea5.md @@ -9,7 +9,7 @@ dashedName: step-16 At the end of this project, you will create a recursive solution to the Tower of Hanoi puzzle, but now you are going to explore an iterative approach to this problem. -Start by adding a `for` loop to your function that iterates through the number of moves and prints the current iteration number. +Start by adding a `for` loop to your function that iterates through the `number_of_moves` and prints the current iteration number. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dcd3d61c448e2676501f43.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dcd3d61c448e2676501f43.md index ca7a4565898..7c58832e32b 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dcd3d61c448e2676501f43.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dcd3d61c448e2676501f43.md @@ -7,7 +7,7 @@ dashedName: step-20 # --description-- -When the remainder of the move number divided by 3 is equal to 2, the movement is allowed between `A` and `B` (the source and the auxiliary rods). +When the remainder of the move number divided by 3 is equal to 2, the movement is allowed between `'A'` and `'B'` (the source and the auxiliary rods). Add an `elif` statement for that. Then, print the appropriate string if the condition is met. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dcd9bbc2268127e7898d77.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dcd9bbc2268127e7898d77.md index 3f60ba9c14c..5e51e76b75e 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dcd9bbc2268127e7898d77.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dcd9bbc2268127e7898d77.md @@ -7,7 +7,7 @@ dashedName: step-21 # --description-- -Finally, when the move number divided by 3 has no remainder, the movement is allowed between `B` and `C`. +Finally, when the move number divided by 3 has no remainder, the movement is allowed between `'B'` and `'C'`. Add an `elif` statement for that. Then, print the appropriate string if the condition is met. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dce7ee2494e82bf4205a3f.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dce7ee2494e82bf4205a3f.md index c43eccad7ba..3dc116210bf 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dce7ee2494e82bf4205a3f.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dce7ee2494e82bf4205a3f.md @@ -18,10 +18,10 @@ You should have an `elif` statement to check if `rods[source]` is not empty and ```js const allowedRes = [ "rods\\s*\\[\\s*source\\s*\\]", - "len\\(rods\\s*\\[\\s*source\\s*\\]\\)\\s*>\\s*0", - "len\\(rods\\s*\\[\\s*source\\s*\\]\\)\\s*>=\\s*1", + "len\\(rods\\s*\\[\\s*source\\s*\\]\\s*\\)\\s*>\\s*0", + "len\\(rods\\s*\\[\\s*source\\s*\\]\\s*\\)\\s*>=\\s*1", ]; -const re = new RegExp(`elif\\s+((${allowedRes.join(")|(")}))\\s+and\\s+(rods\\s*\\[\\s*source\\s*\\]\\[\\s*-\\s*1\\s*\\]\\s*<\\s*rods\\s*\\[\\s*target\\s*\\]\\[\\s*-\\s*1\\s*\\]|rods\\s*\\[\\s*target\\s*\\]\\[\\s*-\\s*1\\s*\\]\\s*>\\s*rods\\s*\\[\\s*source\\s*\\]\\[\\s*-\\s*1\\s*\\])\\s*:`); +const re = new RegExp(`elif\\s+((${allowedRes.join(")|(")}))\\s+and\\s+(rods\\s*\\[\\s*source\\s*\\]\\s*\\[\\s*-\\s*1\\s*\\]\\s*<\\s*rods\\s*\\[\\s*target\\s*\\]\\s*\\[\\s*-\\s*1\\s*\\]|rods\\s*\\[\\s*target\\s*\\]\\s*\\[\\s*-\\s*1\\s*\\]\\s*>\\s*rods\\s*\\[\\s*source\\s*\\]\\s*\\[\\s*-\\s*1\\s*\\])\\s*:`); assert.match(code, re); ``` @@ -30,10 +30,10 @@ You should set `forward` to `True` inside your new `elif` statement. You should ```js const allowedRes = [ "rods\\s*\\[\\s*source\\s*\\]", - "len\\(rods\\s*\\[\\s*source\\s*\\]\\)\\s*>\\s*0", - "len\\(rods\\s*\\[\\s*source\\s*\\]\\)\\s*>=\\s*1", + "len\\(rods\\s*\\[\\s*source\\s*\\]\\s*\\)\\s*>\\s*0", + "len\\(rods\\s*\\[\\s*source\\s*\\]\\s*\\)\\s*>=\\s*1", ]; -const re = new RegExp(`elif\\s+((${allowedRes.join(")|(")}))\\s+and\\s+(rods\\s*\\[\\s*source\\s*\\]\\[\\s*-\\s*1\\s*\\]\\s*<\\s*rods\\s*\\[\\s*target\\s*\\]\\[\\s*-\\s*1\\s*\\]|rods\\s*\\[\\s*target\\s*\\]\\[\\s*-\\s*1\\s*\\]\\s*>\\s*rods\\s*\\[\\s*source\\s*\\]\\[\\s*-\\s*1\\s*\\])\\s*:\\s+forward\\s*=\\s*True`); +const re = new RegExp(`elif\\s+((${allowedRes.join(")|(")}))\\s+and\\s+(rods\\s*\\[\\s*source\\s*\\]\\s*\\[\\s*-\\s*1\\s*\\]\\s*<\\s*rods\\s*\\[\\s*target\\s*\\]\\s*\\[\\s*-\\s*1\\s*\\]|rods\\s*\\[\\s*target\\s*\\]\\s*\\[\\s*-\\s*1\\s*\\]\\s*>\\s*rods\\s*\\[\\s*source\\s*\\]\\s*\\[\\s*-\\s*1\\s*\\])\\s*:\\s+forward\\s*=\\s*True`); assert.match(code, re); ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dceadec3c9cf2ca7b56de6.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dceadec3c9cf2ca7b56de6.md index 738edf908da..c06ea4f037c 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dceadec3c9cf2ca7b56de6.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dceadec3c9cf2ca7b56de6.md @@ -20,7 +20,7 @@ You should add an `if` statement to execute when `forward` is `True` after the ` You should print the provide string inside your new `if` statement. ```js -({ test: () => assert.match(code, /if\s+forward(\s*==\s*True)?\s*:\s+print\s*\(\s*f('|")Moving\sdisk\s\{\s*rods\[\s*source\s*\]\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*source\s*\}\sto\s\{\s*target\s*\}\2\s*\)/) }) +({ test: () => assert.match(code, /if\s+forward(\s*==\s*True)?\s*:\s+print\s*\(\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*\}\2\s*\)/) }) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddcc2ee182e0164c3539f8.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddcc2ee182e0164c3539f8.md index 4d92e5c27c1..c1c5273e34a 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddcc2ee182e0164c3539f8.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddcc2ee182e0164c3539f8.md @@ -14,13 +14,13 @@ After printing the move, you need to remove the last element from the source rod You should remove the last element from `rods[source]`. ```js -({ test: () => assert.match(code, /rods\[\s*source\s*\]\.pop\s*\(\s*\)/) }) +({ test: () => assert.match(code, /rods\s*\[\s*source\s*\]\s*\.pop\s*\(\s*\)/) }) ``` You should have `rods[target].append(rods[source].pop())` in your code. ```js -({ test: () => assert.match(code, /rods\[\s*target\s*\]\.append\s*\(\s*rods\[\s*source\s*\]\.pop\s*\(\s*\)\s*\)/) }) +({ test: () => assert.match(code, /rods\s*\[\s*target\s*\]\s*\.append\s*\(\s*rods\s*\[\s*source\s*\]\s*\.pop\s*\(\s*\)\s*\)/) }) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddce6f6e8066173208235b.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddce6f6e8066173208235b.md index 71b0a51a80e..b503c73ee44 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddce6f6e8066173208235b.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddce6f6e8066173208235b.md @@ -14,25 +14,25 @@ When `forward` is `False`, the disk has to be moved in the opposite direction. W You should have an `else` clause to move the disks in the opposite direction. ```js -({ test: () => assert.match(code, /rods\[\s*target\s*\]\.append\s*\(\s*rods\[\s*source\s*\]\.pop\s*\(\s*\)\s*\)\s+else\s*:/) }) +({ test: () => assert.match(code, /rods\s*\[\s*target\s*\]\s*\.append\s*\(\s*rods\s*\[\s*source\s*\]\s*\.pop\s*\(\s*\)\s*\)\s+else\s*:/) }) ``` You should have `print(f'Moving disk {rods[target][-1]} from {target} to {source}')` inside your `else` clause. ```js -({ test: () => assert.match(code, /else\s*:\s+print\s*\(\s*f('|")Moving\sdisk\s\{\s*rods\[\s*target\s*\]\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*target\s*\}\sto\s\{\s*source\s*\}\1\s*\)/) }) +({ test: () => assert.match(code, /else\s*:\s+print\s*\(\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*\}\1\s*\)/) }) ``` You should remove the last element from `rods[target]`. ```js -({ test: () => assert.match(code, /rods\[\s*target\s*\]\.pop\s*\(\s*\)/) }) +({ test: () => assert.match(code, /rods\s*\[\s*target\s*\]\s*\.pop\s*\(\s*\)/) }) ``` You should have `rods[source].append(rods[target].pop())` in your code. ```js -({ test: () => assert.match(code, /rods\[\s*source\s*\]\.append\s*\(\s*rods\[\s*target\s*\]\.pop\s*\(\s*\)\s*\)/) }) +({ test: () => assert.match(code, /rods\s*\[\s*source\s*\]\s*\.append\s*\(\s*rods\s*\[\s*target\s*\]\s*\.pop\s*\(\s*\)\s*\)/) }) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddd02838f36117cd9738eb.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddd02838f36117cd9738eb.md index ca3b3d1769a..9a70c4951a3 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddd02838f36117cd9738eb.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddd02838f36117cd9738eb.md @@ -14,13 +14,13 @@ Outside the `else` block, add a comment saying `display our progress` and print You should use the provided text to add a comment outside the `else` block. ```js -({ test: () => assert.match(code, /rods\[\s*source\s*\]\.append\s*\(\s*rods\[\s*target\s*\]\.pop\s*\(\s*\)\s*\)\s+#\s*display\sour\sprogress/) }) +({ test: () => assert.match(code, /rods\s*\[\s*source\s*\]\s*\.append\s*\(\s*rods\s*\[\s*target\s*\]\s*\.pop\s*\(\s*\)\s*\)\s+#\s*display\sour\sprogress/) }) ``` You should print the `rods` object outside the `else` block, after the comment. ```js -({ test: () => assert.match(code, /rods\[\s*source\s*\]\.append\s*\(\s*rods\[\s*target\s*\]\.pop\s*\(\s*\)\s*\)\s+#\s*display\sour\sprogress\s+print\s*\(\s*rods\s*\)/) }) +({ test: () => assert.match(code, /rods\s*\[\s*source\s*\]\s*\.append\s*\(\s*rods\s*\[\s*target\s*\]\s*\.pop\s*\(\s*\)\s*\)\s+#\s*display\sour\sprogress\s+print\s*\(\s*rods\s*\)/) }) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddd65848a12919d7e1c7d0.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddd65848a12919d7e1c7d0.md index 535052128ab..990026a4435 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddd65848a12919d7e1c7d0.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64ddd65848a12919d7e1c7d0.md @@ -15,7 +15,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\(rod1, rod2\):\s+forward\s+=\s+False\s+if\s+not\s+rods\[\s*target\s*\]\s*:\s+forward\s*=\s*True\s+elif\s+rods\[\s*source\s*\]\s+and\s+rods\[\s*source\s*\]\[-1\]\s<\srods\[\s*target\s*\]\[\s*-\s*1\s*\]:\s+forward\s*=\s*True\s+if\s+forward\s*:\s+print\(\s*f'Moving\sdisk\s\{\s*rods\[\s*source\s*\]\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*source\s*\}\sto\s\{\s*target\s*\}'\s*\)\s+rods\[\s*target\s*\]\.append\(\s*rods\[\s*source\s*\]\.pop\(\s*\)\s*\)\s+else\s*:\s+print\(\s*f'Moving\sdisk\s\{\s*rods\[\s*target\s*\]\[\s*-\s*1\s*\]\}\sfrom\s\{\s*target\s*\}\sto\s\{\s*source\s*\}'\s*\)\s+rods\[\s*source\s*\].append\(\s*rods\[\s*target\s*\].pop\(\s*\)\s*\)\s+#\s*display\sour\sprogress\s+\print\(\s*rods\s*\)/); + 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*\)/); } }) ``` @@ -47,7 +47,7 @@ def move(n, source, auxiliary, target): if not rods[target]: forward = True elif rods[source] and rods[source][-1] < rods[target][-1]: - forward = True + forward = True if forward: print(f'Moving disk {rods[source][-1]} from {source} to {target}') rods[target].append(rods[source].pop()) @@ -57,7 +57,7 @@ def move(n, source, auxiliary, target): # display our progress print(rods) ---fcc-editable-region-- +--fcc-editable-region-- elif remainder == 2: print(f'Move {i + 1} allowed between {source} and {auxiliary}') elif remainder == 0: diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64de6c8a5305d8173a3a9e09.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64de6c8a5305d8173a3a9e09.md index 1c68f81babd..c72e5a00eb7 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64de6c8a5305d8173a3a9e09.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64de6c8a5305d8173a3a9e09.md @@ -15,11 +15,11 @@ You should change each occurrence of `source` inside the `make_allowed_move()` f ```js ({ test: () => { - assert.match(code, /elif\s+rods\s*\[\s*rod1\s*\]\s+and\s+rods\s*\[\s*rod1\s*\]\[\s*-\s*1\s*\]\s*<\s*rods\s*\[\s*target\s*\]\[\s*-\s*1\s*\]\s*:/); - assert.match(code, /if\s+forward(\s*==\s*True)?\s*:\s+print\s*\(\s*f('|")Moving\sdisk\s\{\s*rods\[\s*rod1\s*\]\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*rod1\s*\}\sto\s\{\s*target\s*\}\2\s*\)\s+rods\[\s*target\s*\]\.append\s*\(\s*rods\[\s*rod1\s*\]\.pop\s*\(\s*\)\s*\)/); - assert.match(code, /else\s*:\s+print\s*\(\s*f('|")Moving\sdisk\s\{\s*rods\[\s*target\s*\]\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*target\s*\}\sto\s\{\s*rod1\s*\}\1\s*\)/); - assert.match(code, /rods\[\s*rod1\s*\]\.append\s*\(\s*rods\[\s*target\s*\]\.pop\s*\(\s*\)\s*\)/); - } + assert.match(code, /elif\s+rods\s*\[\s*rod1\s*\]\s+and\s+rods\s*\[\s*rod1\s*\]\s*\[\s*-\s*1\s*\]\s*<\s*rods\s*\[\s*target\s*\]\s*\[\s*-\s*1\s*\]\s*:/); + assert.match(code, /if\s+forward(\s*==\s*True)?\s*:\s+print\s*\(\s*f('|")Moving\sdisk\s\{\s*rods\s*\[\s*rod1\s*\]\s*\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*rod1\s*\}\sto\s\{\s*target\s*\}\2\s*\)\s+rods\s*\[\s*target\s*\]\s*\.append\s*\(\s*rods\s*\[\s*rod1\s*\]\s*\.pop\s*\(\s*\)\s*\)/); + assert.match(code, /else\s*:\s+print\s*\(\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*rod1\s*\}\1\s*\)/); + assert.match(code, /rods\s*\[\s*rod1\s*\]\s*\.append\s*\(\s*rods\s*\[\s*target\s*\]\s*\.pop\s*\(\s*\)\s*\)/); + } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64de7357cc75bd18bdced920.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64de7357cc75bd18bdced920.md index 96c8877a173..60ea77c257c 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64de7357cc75bd18bdced920.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64de7357cc75bd18bdced920.md @@ -16,11 +16,11 @@ You should change each occurrence of `target` inside `make_allowed_move` into `r ```js ({ test: () => { assert.match(code, /if\s+not\s+rods\s*\[\s*rod2\s*\]\s*:/); - assert.match(code, /elif\s+rods\s*\[\s*rod1\s*\]\s+and\s+rods\s*\[\s*rod1\s*\]\[\s*-\s*1\s*\]\s*<\s*rods\s*\[\s*rod2\s*\]\[\s*-\s*1\s*\]\s*:/); - assert.match(code, /if\s+forward(\s*==\s*True)?\s*:\s+print\s*\(\s*f('|")Moving\sdisk\s\{\s*rods\[\s*rod1\s*\]\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*rod1\s*\}\sto\s\{\s*rod2\s*\}\2\s*\)\s+rods\[\s*rod2\s*\]\.append\s*\(\s*rods\[\s*rod1\s*\]\.pop\s*\(\s*\)\s*\)/); - assert.match(code, /else\s*:\s+print\s*\(\s*f('|")Moving\sdisk\s\{\s*rods\[\s*rod2\s*\]\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*rod2\s*\}\sto\s\{\s*rod1\s*\}\1\s*\)/); - assert.match(code, /rods\[\s*rod1\s*\]\.append\s*\(\s*rods\[\s*rod2\s*\]\.pop\s*\(\s*\)\s*\)/); - } + assert.match(code, /elif\s+rods\s*\[\s*rod1\s*\]\s+and\s+rods\s*\[\s*rod1\s*\]\s*\[\s*-\s*1\s*\]\s*<\s*rods\s*\[\s*rod2\s*\]\s*\[\s*-\s*1\s*\]\s*:/); + assert.match(code, /if\s+forward(\s*==\s*True)?\s*:\s+print\s*\(\s*f('|")Moving\sdisk\s\{\s*rods\s*\[\s*rod1\s*\]\s*\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*rod1\s*\}\sto\s\{\s*rod2\s*\}\2\s*\)\s+rods\s*\[\s*rod2\s*\]\s*\.append\s*\(\s*rods\s*\[\s*rod1\s*\]\s*\.pop\s*\(\s*\)\s*\)/); + assert.match(code, /else\s*:\s+print\s*\(\s*f('|")Moving\sdisk\s\{\s*rods\s*\[\s*rod2\s*\]\s*\[\s*-\s*1\s*\]\s*\}\sfrom\s\{\s*rod2\s*\}\sto\s\{\s*rod1\s*\}\1\s*\)/); + assert.match(code, /rods\s*\[\s*rod1\s*\]\s*\.append\s*\(\s*rods\s*\[\s*rod2\s*\]\s*\.pop\s*\(\s*\)\s*\)/); + } }) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64de773f81facd14653f49c8.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64de773f81facd14653f49c8.md index 632c83ccfc0..2ad423d2976 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64de773f81facd14653f49c8.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64de773f81facd14653f49c8.md @@ -11,7 +11,7 @@ It looks like it's working! But the output is not very readable. Print a new lin # --hints-- -You should pass a string with a new line character (`\n`) as the second argument for your two `print(rods)` calls. +You should pass a string with a new line character (`'\n'`) as the second argument for your two `print(rods)` calls. ```js ({ test: () => assert.match(code, /print\(\s*rods\s*,\s*('|")\\n\1\s*\)(?=.*print\(\s*rods\s*,\s*('|")\\n\2\s*\))/s) }) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64df45a3ad4f8719e5355244.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64df45a3ad4f8719e5355244.md index 4c17714071d..f7b43c86607 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64df45a3ad4f8719e5355244.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64df45a3ad4f8719e5355244.md @@ -16,7 +16,7 @@ For now, each recursive call prints the `rods` dictionary without performing any You should remove the last element from the `rods[source]` list and append it to the `rods[target]` list before the `print` call. ```js -({ test: () => assert.match(code, /move\(\s*n\s*-\s*1\s*,\s*source\s*,\s*auxiliary\s*,\s*target\s*\)\s+rods\[\s*target\s*\]\.append\(\s*rods\[\s*source\s*\]\.pop\(\s*\)\s*\)/) }) +({ test: () => assert.match(code, /move\(\s*n\s*-\s*1\s*,\s*source\s*,\s*auxiliary\s*,\s*target\s*\)\s+rods\s*\[\s*target\s*\]\s*\.append\(\s*rods\s*\[\s*source\s*\]\s*\.pop\(\s*\)\s*\)/) }) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64e3392996b41d17a1375643.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64e3392996b41d17a1375643.md index b8d215d41b4..f121fb8f397 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64e3392996b41d17a1375643.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64e3392996b41d17a1375643.md @@ -14,7 +14,7 @@ Before appending the last element to the target, add a comment saying `move the You should add a comment with the provided text before `rods[target].append(rods[source].pop())`. ```js -({ test: () => assert.match(code, /move\(\s*n\s*-\s*1\s*,\s*source\s*,\s*auxiliary\s*,\s*target\s*\)\s+#\s*move\sthe\snth\sdisk\sfrom\ssource\sto\starget\s+(?=rods\[\s*target\s*\]\.append\(\s*rods\[\s*source\s*\]\.pop\(\s*\)\s*\))/) }) +({ test: () => assert.match(code, /move\(\s*n\s*-\s*1\s*,\s*source\s*,\s*auxiliary\s*,\s*target\s*\)\s+#\s*move\sthe\snth\sdisk\sfrom\ssource\sto\starget\s+(?=rods\s*\[\s*target\s*\]\s*\.append\(\s*rods\s*\[\s*source\s*\]\s*\.pop\(\s*\)\s*\))/) }) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64e34146860065146733883b.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64e34146860065146733883b.md index 240e7ac577c..59daf5cb065 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64e34146860065146733883b.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64e34146860065146733883b.md @@ -7,7 +7,7 @@ dashedName: step-53 # --description-- -Although recursion could sometimes be less easy to understand, it gives you the power to create more concise code. In this case, you don't even need to differentiate between even and odd numbers of disks. +Although recursion can sometimes be less easy to understand, it gives you the power to create more concise code. In this case, you don't even need to differentiate between even and odd numbers of disks. Set `NUMBER_OF_DISKS` to `5` and check the output. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/6564f0279e23ce924eedd1b2.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/6564f0279e23ce924eedd1b2.md index a25aabcb054..8331f7752cc 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/6564f0279e23ce924eedd1b2.md +++ b/curriculum/challenges/arabic/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\(re\.findall\(pattern, quote\)\)/.test(code)); + assert.isFalse(/print\(\s*re\.findall\(\s*pattern, quote\s*\)\s*\)/.test(code)); }}) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/656f10458134d4c4e283a2f1.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/656f10458134d4c4e283a2f1.md index 911f2a1d783..229527026e7 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/656f10458134d4c4e283a2f1.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/656f10458134d4c4e283a2f1.md @@ -14,7 +14,7 @@ Now, turn the empty string in the constraint tuple into a regex pattern to match You should have the `(nums, '[0123456789]')` tuple in your `constraints` list. ```js -({ test: () => assert.match(code, /constraints\s*=\s*\[\s*\(\s*nums\s*,\s*("|')\[\d{10}\]\1\s*\)\s*\]/) }) +({ test: () => assert.match(code, /constraints\s*=\s*\[\s*\s*\(\s*nums\s*,\s*("|')\[\d{10}\]\1\s*\)\s*\]/) }) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/6577319039f4f7de9251b822.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/6577319039f4f7de9251b822.md index 4915dcf1c47..78875659de9 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/6577319039f4f7de9251b822.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-regular-expressions-by-building-a-password-generator/6577319039f4f7de9251b822.md @@ -27,7 +27,7 @@ You should replace your existing `for` loop and two `if` statements with a singl Your new `if` condition should be a list comprehension that is the result of evaluating the expression `constraint <= len(re.findall(pattern, password))` for each `constraint`-`pattern` tuple in the `constraints` list. ```js -({ test: () => assert.match(code, /^(\s{8})if\s+\[\s*constraint\s*<=\s*len\s*\(\s*re\.findall\s*\(\s*pattern\s*,\s*password\s*\)\s*\)\s+for\s+constraint\s*,\s*pattern\s+in\s+constraints\s*\]\s*:\s*^\1\s{4}break/m) }) +({ test: () => assert.match(code, /^(\s{8})if\s*\[\s*constraint\s*<=\s*len\s*\(\s*re\.findall\s*\(\s*pattern\s*,\s*password\s*\)\s*\)\s+for\s+constraint\s*,\s*pattern\s+in\s+constraints\s*\]\s*:\s*^\1\s{4}break/m) }) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551ecf597038c36637f3759.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551ecf597038c36637f3759.md index 5a7a8e606dd..e9cd64b4668 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551ecf597038c36637f3759.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551ecf597038c36637f3759.md @@ -1,6 +1,6 @@ --- id: 6551ecf597038c36637f3759 -title: Step 1 +title: الخطوة 1 challengeType: 20 dashedName: step-1 --- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551eebe6cbb2e6cadf9b468.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551eebe6cbb2e6cadf9b468.md index 2e6d119b78b..9ac8e63bad6 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551eebe6cbb2e6cadf9b468.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551eebe6cbb2e6cadf9b468.md @@ -1,6 +1,6 @@ --- id: 6551eebe6cbb2e6cadf9b468 -title: Step 2 +title: الخطوة 2 challengeType: 20 dashedName: step-2 --- @@ -15,7 +15,7 @@ string_2 = 'I am also a string' string_3 = 'This is not valid" ``` -Delete your `number` variable and its value. Then, declare another variable called `text` and assign the string `Hello World` to this variable. +Delete your `number` variable and its value. Then, declare another variable called `text` and assign the string `'Hello World'` to this variable. # --hints-- @@ -32,7 +32,7 @@ You should declare a variable called `text`. Pay attention to place the variable assert.match(code, /^text\s*=/m) ``` -You should assign the string `Hello World` to your `text` variable. Remember to use either single or double quotes to enclose the string and pay attention to the letter case. +You should assign the string `'Hello World'` to your `text` variable. Remember to use either single or double quotes to enclose the string and pay attention to the letter case. ```js assert.match(code, /^text\s*=\s*("|')Hello World\1\s*(#.*)?$/m) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551ef504d91936d2d4e54f8.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551ef504d91936d2d4e54f8.md index d40877ed6af..2b65b4b4212 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551ef504d91936d2d4e54f8.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551ef504d91936d2d4e54f8.md @@ -14,7 +14,7 @@ greet = 'Hello!' print(greet) ``` -The code in the example above would print the string `Hello!`, which is the value of the variable `greet` passed to `print()` as the argument. +The code in the example above would print the string `'Hello!'`, which is the value of the variable `greet` passed to `print()` as the argument. Print your `text` variable to the screen by passing the `text` variable as the argument to the `print()` function. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551f3bfed58796ebb1268dc.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551f3bfed58796ebb1268dc.md index 86104aff4f6..7c28d74b6b7 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551f3bfed58796ebb1268dc.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551f3bfed58796ebb1268dc.md @@ -7,7 +7,7 @@ dashedName: step-5 # --description-- -Each string character can be referenced by a numerical index. The index count starts at zero. So the first character of a string has an index of `0`. For example, in the string `Hello World`, `H` is at index `0`, `e` is at index `1`, and so on. +Each string character can be referenced by a numerical index. The index count starts at zero. So the first character of a string has an index of `0`. For example, in the string `'Hello World'`, `'H'` is at index `0`, `'e'` is at index `1`, and so on. Each character of a string can be accessed by using bracket notation. You need to write the variable name followed by square brackets and add the index of the character between the brackets: diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551f6f9ec6db270eb83f3db.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551f6f9ec6db270eb83f3db.md index 5d0ae1dd2fa..3103cb653bf 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551f6f9ec6db270eb83f3db.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551f6f9ec6db270eb83f3db.md @@ -7,7 +7,7 @@ dashedName: step-8 # --description-- -You can see `11` printed on the terminal because `Hello World` contains 11 characters. +You can see `11` printed on the terminal because `'Hello World'` contains 11 characters. Another useful built-in function is `type()`, which returns the data type of a variable. Modify your `print()` call to print the data type of `text`. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551fe3b1df7c9740f13f270.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551fe3b1df7c9740f13f270.md index cedb112a823..074c15b2e19 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551fe3b1df7c9740f13f270.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6551fe3b1df7c9740f13f270.md @@ -14,7 +14,7 @@ Key aspects of variable naming in Python are: - Variable names are case sensitive, i.e. `my_var` is different from `my_Var` and `MY_VAR`. - Finally, it is a common convention to write variable names using `snake_case`, where each space is replaced by an underscore character and the words are written in lowercase letters. -Remove both calls to `print()` and declare another variable called `alphabet`. Assign the string `abcdefghijklmnopqrstuvwxyz` to this variable. +Remove both calls to `print()` and declare another variable called `alphabet`. Assign the string `'abcdefghijklmnopqrstuvwxyz'` to this variable. # --hints-- @@ -38,7 +38,7 @@ You should declare a variable called `alphabet`. Pay attention to place the vari assert.match(code, /^alphabet\s*=/m) ``` -You should assign the string `abcdefghijklmnopqrstuvwxyz` to your `alphabet` variable. Remember to use either single or double quotes to enclose the string. +You should assign the string `'abcdefghijklmnopqrstuvwxyz'` to your `alphabet` variable. Remember to use either single or double quotes to enclose the string. ```js assert.match(code, /^alphabet\s*=\s*("|')abcdefghijklmnopqrstuvwxyz\1\s*(#.*)?$/m) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6552008c0d9d9075cbec9772.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6552008c0d9d9075cbec9772.md index abe8ced263d..5c272b6d6f1 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6552008c0d9d9075cbec9772.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6552008c0d9d9075cbec9772.md @@ -15,7 +15,7 @@ Start by finding the position of the first letter in the string. One way is to c text.find('W') ``` -Above, uppercase `W` is the character you want to locate inside the string stored in the `text` variable. The method will return `6`, which is the index of the `W` character inside the string stored in the `text` variable. +Above, uppercase `'W'` is the character you want to locate inside the string stored in the `text` variable. The method will return `6`, which is the index of the `'W'` character inside the string stored in the `text` variable. At the end of your code, call `.find()` on your `alphabet` string and pass `text[0]` to the method. Note that a method is just a function that belongs to an object (you will learn more about that in another project). @@ -36,7 +36,7 @@ assert.match(code, /alphabet\.find\s*\(.*\)/) You should call the `.find()` method on the `alphabet` variable and pass `text[0]` to the method. Pay attention to place the method call at the beginning of the line. ```js -assert.match(code, /^alphabet\.find\s*\(\s*text\[\s*\s*0\s*\]\s*\)/m) +assert.match(code, /^alphabet\.find\s*\(\s*text\s*\[\s*\s*0\s*\]\s*\)/m) ``` Your code contains invalid syntax and/or invalid indentation. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655208d59b131e7816f18c96.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655208d59b131e7816f18c96.md index 412619ccc4c..3e3af82109c 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655208d59b131e7816f18c96.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655208d59b131e7816f18c96.md @@ -22,7 +22,7 @@ assert.match(code, /^index\s*=/m) You should assign the value returned by `alphabet.find(text[0])` to your `index` variable. ```js -assert.match(code, /^index\s*=\s*alphabet\.find\s*\(\s*text\[\s*\s*0\s*\]\s*\)\s*(#.*)?$/m) +assert.match(code, /^index\s*=\s*alphabet\.find\s*\(\s*text\s*\[\s*\s*0\s*\]\s*\)\s*(#.*)?$/m) ``` Your code contains invalid syntax and/or invalid indentation. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655209a4a27dd37873c4cac3.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655209a4a27dd37873c4cac3.md index 34166fe3da4..83feddb9318 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655209a4a27dd37873c4cac3.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655209a4a27dd37873c4cac3.md @@ -7,7 +7,7 @@ dashedName: step-16 # --description-- -`.find()` returns the index of the matching character inside the string. If the character is not found, it returns `-1`. As you can see, the first character in `text`, uppercase `H`, is not found, since `alphabet` contains only lowercase letters. +`.find()` returns the index of the matching character inside the string. If the character is not found, it returns `-1`. As you can see, the first character in `text`, uppercase `'H'`, is not found, since `alphabet` contains only lowercase letters. You can transform a string into its lowercase equivalent with the `.lower()` method. Add another `print()` call to print `text.lower()` and see the output. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65520e6f2b9678799977f24d.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65520e6f2b9678799977f24d.md index 54d47cf3f49..9a554ddeef1 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65520e6f2b9678799977f24d.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65520e6f2b9678799977f24d.md @@ -27,7 +27,7 @@ assert.match(code, /^print\s*\(\s*index\s*\)/m); You should update your `alphabet.find(text[0])` call to use `text[0].lower()` as the argument. Pay attention to place the method call at the beginning of the line. ```js -assert.match(code, /^index\s*=\s*alphabet\.find\s*\(\s*text\[\s*\s*0\s*\]\.lower\s*\(\s*\)\s*\)\s*(#.*)?$/m); +assert.match(code, /^index\s*=\s*alphabet\.find\s*\(\s*text\s*\[\s*\s*0\s*\]\s*\.lower\s*\(\s*\)\s*\)\s*(#.*)?$/m); ``` Your code contains invalid syntax and/or invalid indentation. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65520f8282faf57a0db4f7fe.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65520f8282faf57a0db4f7fe.md index 95e2567fa84..e4c0036ebff 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65520f8282faf57a0db4f7fe.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65520f8282faf57a0db4f7fe.md @@ -7,7 +7,7 @@ dashedName: step-20 # --description-- -As you can see from the output, `h` is at index `7` in the `alphabet` string. Now you need to find the letter at index `7` plus the value of `shift`. For that, you can use the addition operator, `+`, in the same way you would use it for a mathematical addition. +As you can see from the output, `'h'` is at index `7` in the `alphabet` string. Now you need to find the letter at index `7` plus the value of `shift`. For that, you can use the addition operator, `+`, in the same way you would use it for a mathematical addition. Modify your `shifted` variable so that it stores the value of `alphabet` at index `index + shift`. diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65521203d7165c7b84b22ad4.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65521203d7165c7b84b22ad4.md index 41811515713..a8da79ffd22 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65521203d7165c7b84b22ad4.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65521203d7165c7b84b22ad4.md @@ -35,14 +35,14 @@ const commentless_code = __helpers.python.removeComments(code); assert.match(commentless_code, /^for\s+i/m) ``` -You should write the `in` keyword after `for i `. Make sure to leave a space around the `in` keyword. +You should write the `in` keyword after `for i`. Make sure to leave a space around the `in` keyword. ```js const commentless_code = __helpers.python.removeComments(code); assert.match(commentless_code, /^for\s+i\s+in\s+/m) ``` -You should write `text` after `for i in `. Don't forget to add the final `:`. +You should write `text` after `for i in`. Don't forget to add the final `:`. ```js const commentless_code = __helpers.python.removeComments(code); diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655261b2e1f2c197093f3993.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655261b2e1f2c197093f3993.md index b7051de41c3..bdf47ed7c6f 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655261b2e1f2c197093f3993.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655261b2e1f2c197093f3993.md @@ -7,7 +7,7 @@ dashedName: step-42 # --description-- -Currently, spaces get encrypted as `c`. To maintain the original spacing in the plain message, you'll require a conditional `if` statement. This is composed of the `if` keyword, a condition, and a colon `:`. +Currently, spaces get encrypted as `'c'`. To maintain the original spacing in the plain message, you'll require a conditional `if` statement. This is composed of the `if` keyword, a condition, and a colon `:`. ```py if x != 0: @@ -16,7 +16,7 @@ if x != 0: In the example above, the condition of the `if` statement is `x != 0`. The code `print(x)`, inside the `if` statement body, runs only when the condition evaluates to `True` (in this example, meaning that `x` is different from zero). -At the top of your for loop, replace `print(char == ' ')` with an `if` statement. The condition of this `if` statement should evaluate to `True` if `char` is an empty space and `False` otherwise. Inside the `if` body, print the string `space!`. Remember to indent this line. +At the top of your for loop, replace `print(char == ' ')` with an `if` statement. The condition of this `if` statement should evaluate to `True` if `char` is an empty space and `False` otherwise. Inside the `if` body, print the string `'space!'`. Remember to indent this line. # --hints-- @@ -36,7 +36,7 @@ const {block_body} = __helpers.python.getBlock(commentless_code, /for\s+char\s+i assert(block_body.match(/if\s+char\s*==\s*("|')\s\1\s*:/)); ``` -You should print the string `space!` inside your new `if` statement. +You should print the string `'space!'` inside your new `if` statement. ```js const commentless_code = __helpers.python.removeComments(code); diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6553980e0527fa115c705646.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6553980e0527fa115c705646.md index 69191130521..f3fc108e506 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6553980e0527fa115c705646.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6553980e0527fa115c705646.md @@ -7,7 +7,7 @@ dashedName: step-43 # --description-- -Now, instead of printing `space!`, use the addition assignment operator to add the space (currently stored in `char`) to the current value of `encrypted_text`. +Now, instead of printing `'space!'`, use the addition assignment operator to add the space (currently stored in `char`) to the current value of `encrypted_text`. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6553a755879b131a445e664c.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6553a755879b131a445e664c.md index dfc91239b0e..f6ea23b4325 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6553a755879b131a445e664c.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6553a755879b131a445e664c.md @@ -7,7 +7,7 @@ dashedName: step-45 # --description-- -Try to assign the string `Hello Zaira` to your `text` variable and see what happens in the console. +Try to assign the string `'Hello Zaira'` to your `text` variable and see what happens in the console. # --hints-- @@ -17,7 +17,7 @@ You should have a `text` variable. assert.match(code, /^text\s*=/m) ``` -You should assign the string `Hello Zaira` to your `text` variable. +You should assign the string `'Hello Zaira'` to your `text` variable. ```js assert.match(code, /^text\s*=\s*("|')Hello\sZaira\1/m) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554930320d70414e7b6acc6.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554930320d70414e7b6acc6.md index 5629c8d00fb..b5f4088d3b7 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554930320d70414e7b6acc6.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554930320d70414e7b6acc6.md @@ -7,7 +7,7 @@ dashedName: step-58 # --description-- -Delete your `shift` variable. Then, declare a new variable called `custom_key` and assign the value of the string `python` to this variable. +Delete your `shift` variable. Then, declare a new variable called `custom_key` and assign the value of the string `'python'` to this variable. # --hints-- @@ -23,7 +23,7 @@ You should declare a variable called `custom_key`. ({ test: () => assert(__userGlobals.has("custom_key")) }) ``` -You should assign the string `python` to your `custom_key` variable. +You should assign the string `'python'` to your `custom_key` variable. ```js ({ test: () => assert.equal(__userGlobals.get("custom_key"), "python") }) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65549561463f0016876e852c.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65549561463f0016876e852c.md index 179f7313a5d..47211f5e8bc 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65549561463f0016876e852c.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65549561463f0016876e852c.md @@ -7,8 +7,7 @@ dashedName: step-59 # --description-- -Since your key is shorter than the text that you will have to encrypt, you will need to repeat it to generate the whole encrypted text. -At the beginning of your function body, declare a `key_index` variable and set it to zero. +Since your key is shorter than the text that you will have to encrypt, you will need to repeat it to generate the whole encrypted text. At the beginning of your function body, declare a `key_index` variable and set it to zero. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65549f90cf78131c96ebcf28.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65549f90cf78131c96ebcf28.md index 660fb4ab263..7e452e05438 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65549f90cf78131c96ebcf28.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65549f90cf78131c96ebcf28.md @@ -37,7 +37,7 @@ def vigenere(message, key): for char in message.lower(): --fcc-editable-region-- - + if char == ' ': encrypted_text += char --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554a49a4f782f208abcc87e.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554a49a4f782f208abcc87e.md index 7727f6c57a8..7ca155b0c73 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554a49a4f782f208abcc87e.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554a49a4f782f208abcc87e.md @@ -7,8 +7,7 @@ dashedName: step-62 # --description-- -You will need to increase the `key_index` count for the next iteration. -To do this, after the line you just added and in the same code block, use the addition assignment operator to increment `key_index` by one. +You will need to increase the `key_index` count for the next iteration. To do this, after the line you just added and in the same code block, use the addition assignment operator to increment `key_index` by one. # --hints-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554a57ec0a2c52106e7ee50.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554a57ec0a2c52106e7ee50.md index 67567e88cdf..a6cd4a9a348 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554a57ec0a2c52106e7ee50.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554a57ec0a2c52106e7ee50.md @@ -37,7 +37,7 @@ def vigenere(message, key): if char == ' ': encrypted_text += char else: - + key_char = key[key_index % len(key)] key_index += 1 --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554a88d5af937226f4a9121.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554a88d5af937226f4a9121.md index da202c1490a..7ca3ec197c0 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554a88d5af937226f4a9121.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554a88d5af937226f4a9121.md @@ -50,7 +50,7 @@ def vigenere(message, key): encrypted_text = '' for char in message.lower(): - + # Append space to the message if char == ' ': encrypted_text += char @@ -59,7 +59,7 @@ def vigenere(message, key): # Find the right key character to encode key_char = key[key_index % len(key)] key_index += 1 - + --fcc-editable-region-- index = alphabet.find(char) new_index = (index + offset) % len(alphabet) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554ac937a49be2701af4f2f.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554ac937a49be2701af4f2f.md index 7ca7c2f323a..f783cbf3472 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554ac937a49be2701af4f2f.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554ac937a49be2701af4f2f.md @@ -32,7 +32,7 @@ def vigenere(message, key): encrypted_text = '' for char in message.lower(): - + # Append space to the message if char == ' ': encrypted_text += char @@ -41,7 +41,7 @@ def vigenere(message, key): key_char = key[key_index % len(key)] key_index += 1 --fcc-editable-region-- - + offset = alphabet.index(key_char) index = alphabet.find(char) new_index = (index + offset) % len(alphabet) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554ad2463b8892748f8efdd.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554ad2463b8892748f8efdd.md index a371865b1ef..28c793c06c3 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554ad2463b8892748f8efdd.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554ad2463b8892748f8efdd.md @@ -55,7 +55,7 @@ def vigenere(message, key): encrypted_text = '' for char in message.lower(): - + # Append space to the message if char == ' ': encrypted_text += char diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554d0332949b133a0b35eaa.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554d0332949b133a0b35eaa.md index 60289b5525e..acf5b0f71c8 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554d0332949b133a0b35eaa.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554d0332949b133a0b35eaa.md @@ -43,7 +43,7 @@ def vigenere(message, key): encrypted_text = '' for char in message.lower(): - + # Append space to the message if char == ' ': encrypted_text += char @@ -57,7 +57,7 @@ def vigenere(message, key): index = alphabet.find(char) new_index = (index + offset) % len(alphabet) encrypted_text += alphabet[new_index] - + return encrypted_text --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554d15c8acb5f34499ad789.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554d15c8acb5f34499ad789.md index b1f7c3a5caa..87f8a5aa7f3 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554d15c8acb5f34499ad789.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554d15c8acb5f34499ad789.md @@ -31,7 +31,7 @@ def vigenere(message, key): encrypted_text = '' for char in message.lower(): - + # Append space to the message if char == ' ': encrypted_text += char @@ -45,7 +45,7 @@ def vigenere(message, key): index = alphabet.find(char) new_index = (index + offset) % len(alphabet) encrypted_text += alphabet[new_index] - + return encrypted_text --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554d25dc5ceaa354307a77e.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554d25dc5ceaa354307a77e.md index 534ff69ec91..84f3a8477e1 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554d25dc5ceaa354307a77e.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554d25dc5ceaa354307a77e.md @@ -46,7 +46,7 @@ def vigenere(message, key): encrypted_text = '' for char in message.lower(): - + # Append space to the message if char == ' ': encrypted_text += char @@ -60,9 +60,9 @@ def vigenere(message, key): index = alphabet.find(char) new_index = (index + offset) % len(alphabet) encrypted_text += alphabet[new_index] - + return encrypted_text - + encryption = vigenere(text, custom_key) print(encryption) --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554de295ade563a069936a1.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554de295ade563a069936a1.md index 3dfdd998a92..d29b009f3cf 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554de295ade563a069936a1.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554de295ade563a069936a1.md @@ -31,7 +31,7 @@ def vigenere(message, key, direction): encrypted_text = '' for char in message.lower(): - + # Append space to the message if char == ' ': encrypted_text += char @@ -47,9 +47,9 @@ def vigenere(message, key, direction): new_index = (index + offset) % len(alphabet) --fcc-editable-region-- encrypted_text += alphabet[new_index] - + return encrypted_text - + #encryption = vigenere(text, custom_key) #print(encryption) ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554dfce1683be3c0c9609a6.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554dfce1683be3c0c9609a6.md index 330871bc52a..9f1ea94390c 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554dfce1683be3c0c9609a6.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554dfce1683be3c0c9609a6.md @@ -31,7 +31,7 @@ def vigenere(message, key, direction): encrypted_text = '' for char in message.lower(): - + # Append space to the message if char == ' ': encrypted_text += char @@ -45,9 +45,9 @@ def vigenere(message, key, direction): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) encrypted_text += alphabet[new_index] - + return encrypted_text - + --fcc-editable-region-- #encryption = vigenere(text, custom_key) #print(encryption) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554e0adc7bb193cbfdb36d5.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554e0adc7bb193cbfdb36d5.md index db2c5bdfe33..adf869e6b5f 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554e0adc7bb193cbfdb36d5.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554e0adc7bb193cbfdb36d5.md @@ -45,7 +45,7 @@ def vigenere(message, key, direction): encrypted_text = '' for char in message.lower(): - + # Append space to the message if char == ' ': encrypted_text += char @@ -59,7 +59,7 @@ def vigenere(message, key, direction): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) encrypted_text += alphabet[new_index] - + return encrypted_text --fcc-editable-region-- encryption = vigenere(text, custom_key, 1) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554e2ee23bfd93f2c83640f.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554e2ee23bfd93f2c83640f.md index b4b329858a2..8e744b4c09f 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554e2ee23bfd93f2c83640f.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554e2ee23bfd93f2c83640f.md @@ -31,7 +31,7 @@ def vigenere(message, key, direction): encrypted_text = '' for char in message.lower(): - + # Append space to the message if char == ' ': encrypted_text += char @@ -45,7 +45,7 @@ def vigenere(message, key, direction): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) encrypted_text += alphabet[new_index] - + return encrypted_text --fcc-editable-region-- encryption = vigenere(text, custom_key, 1) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554e343caea913ffba7bec6.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554e343caea913ffba7bec6.md index f49b76f417f..cd7e9ce3a58 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554e343caea913ffba7bec6.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6554e343caea913ffba7bec6.md @@ -39,7 +39,7 @@ def vigenere(message, key, direction): encrypted_text = '' for char in message.lower(): - + # Append space to the message if char == ' ': encrypted_text += char @@ -53,7 +53,7 @@ def vigenere(message, key, direction): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) encrypted_text += alphabet[new_index] - + return encrypted_text --fcc-editable-region-- encryption = vigenere(text, custom_key, 1) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655516e410b8e30fb4fb64e8.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655516e410b8e30fb4fb64e8.md index b295655e5c6..a6ecf2194d0 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655516e410b8e30fb4fb64e8.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655516e410b8e30fb4fb64e8.md @@ -38,7 +38,7 @@ def vigenere(message, key, direction): final_message = '' for char in message.lower(): - + # Append space to the message if char == ' ': final_message += char @@ -52,9 +52,9 @@ def vigenere(message, key, direction): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message - + encryption = vigenere(text, custom_key, 1) print(encryption) decryption = vigenere(encryption, custom_key, -1) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65551a628bcb7e121e32d04b.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65551a628bcb7e121e32d04b.md index 521f1f961d3..d77bcd5d985 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65551a628bcb7e121e32d04b.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65551a628bcb7e121e32d04b.md @@ -19,7 +19,7 @@ You should have a `text` variable. ({ test: () => assert(__userGlobals.has("text")) }) ``` -Your `text` variable should be equal to the string `Hello Zaira!`. +Your `text` variable should be equal to the string `'Hello Zaira!'`. ```js ({ test: () => assert.equal(__userGlobals.get("text"), "Hello Zaira!") }) @@ -40,7 +40,7 @@ def vigenere(message, key, direction=1): final_message = '' for char in message.lower(): - + # Append space to the message if char == ' ': final_message += char @@ -54,9 +54,9 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message - + encryption = vigenere(text, custom_key) print(encryption) decryption = vigenere(encryption, custom_key, -1) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555201d9b7fc917399f9f0b.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555201d9b7fc917399f9f0b.md index f9dfeed2c7d..a60afdc14cc 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555201d9b7fc917399f9f0b.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555201d9b7fc917399f9f0b.md @@ -53,9 +53,9 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message - + encryption = vigenere(text, custom_key) print(encryption) decryption = vigenere(encryption, custom_key, -1) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655520c20cb1e6177b0641d6.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655520c20cb1e6177b0641d6.md index fa8531f3421..40bfdb53982 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655520c20cb1e6177b0641d6.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655520c20cb1e6177b0641d6.md @@ -48,9 +48,9 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message - + encryption = vigenere(text, custom_key) print(encryption) decryption = vigenere(encryption, custom_key, -1) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655522883e66f618e03a9411.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655522883e66f618e03a9411.md index aba2d5665d2..822b22f2743 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655522883e66f618e03a9411.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655522883e66f618e03a9411.md @@ -46,9 +46,9 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message - + encryption = vigenere(text, custom_key) print(encryption) decryption = vigenere(encryption, custom_key, -1) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555231eac4d9f19bd3d44b5.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555231eac4d9f19bd3d44b5.md index a8a4a146373..82df5c7e409 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555231eac4d9f19bd3d44b5.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555231eac4d9f19bd3d44b5.md @@ -70,7 +70,7 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65552a111190e11f0963949e.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65552a111190e11f0963949e.md index 900a42440bf..ceda0450cc8 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65552a111190e11f0963949e.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65552a111190e11f0963949e.md @@ -51,7 +51,7 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message --fcc-editable-region-- def encrypt(message, key): diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65552a9593755e1fb2f5ab50.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65552a9593755e1fb2f5ab50.md index b37f689c14a..c0d946a1d38 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65552a9593755e1fb2f5ab50.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65552a9593755e1fb2f5ab50.md @@ -73,12 +73,12 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message --fcc-editable-region-- def encrypt(message, key): return vigenere(message, key) - + encryption = vigenere(text, custom_key) print(encryption) decryption = vigenere(encryption, custom_key, -1) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65552b14e803731fe3c1e4ca.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65552b14e803731fe3c1e4ca.md index d863b1b5667..e86470c6c34 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65552b14e803731fe3c1e4ca.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65552b14e803731fe3c1e4ca.md @@ -51,15 +51,15 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message --fcc-editable-region-- def encrypt(message, key): return vigenere(message, key) - + def decrypt(message, key): return vigenere(message, key, -1) - + encryption = vigenere(text, custom_key) print(encryption) decryption = vigenere(encryption, custom_key, -1) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65553159615a8123b190ee43.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65553159615a8123b190ee43.md index e7e001fd7b2..cb2c9d5e191 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65553159615a8123b190ee43.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65553159615a8123b190ee43.md @@ -9,7 +9,7 @@ dashedName: step-86 It works! Now, you are going to start with an encrypted message to be decrypted. -Change the value of `text` to the string `mrttaqrhknsw ih puggrur`. +Change the value of `text` to the string `'mrttaqrhknsw ih puggrur'`. # --hints-- @@ -19,7 +19,7 @@ You should still have a `text` variable. ({ test: () => assert(__userGlobals.has("text")) }) ``` -Your `text` variable should have the value of `mrttaqrhknsw ih puggrur`. +Your `text` variable should have the value of `'mrttaqrhknsw ih puggrur'`. ```js ({ test: () => assert.equal(__userGlobals.get("text"), "mrttaqrhknsw ih puggrur") }) @@ -54,15 +54,15 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message def encrypt(message, key): return vigenere(message, key) - + def decrypt(message, key): return vigenere(message, key, -1) - + encryption = encrypt(text, custom_key) print(encryption) decryption = decrypt(encryption, custom_key) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555d6e12c95701172b55709.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555d6e12c95701172b55709.md index 7295239a2e5..a2e43552133 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555d6e12c95701172b55709.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555d6e12c95701172b55709.md @@ -46,7 +46,7 @@ def vigenere(message, key, direction): final_message = '' for char in message.lower(): - + # Append space to the message if char == ' ': final_message += char @@ -60,9 +60,9 @@ def vigenere(message, key, direction): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message - + encryption = vigenere(text, custom_key, 1) print(encryption) decryption = vigenere(encryption, custom_key, -1) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555d8b0b3d20b128bdadd37.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555d8b0b3d20b128bdadd37.md index 582c138e1b3..3cfffa05b63 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555d8b0b3d20b128bdadd37.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555d8b0b3d20b128bdadd37.md @@ -31,7 +31,7 @@ def vigenere(message, key, direction=1): final_message = '' for char in message.lower(): - + # Append space to the message if char == ' ': final_message += char @@ -45,7 +45,7 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message --fcc-editable-region-- encryption = vigenere(text, custom_key, 1) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555db4a7b788e15795674e5.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555db4a7b788e15795674e5.md index 43650a129a7..b809b6cc227 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555db4a7b788e15795674e5.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555db4a7b788e15795674e5.md @@ -9,11 +9,11 @@ dashedName: step-88 Two or more strings can be concatenated by using the `+` operator. For example: `'Hello' + ' there!'` results in `'Hello there!`. -Call the `print()` function and use the `+` operator to concatenate the `text` variable to the string `Encrypted text: `. Pay attention to the spacing. +Call the `print()` function and use the `+` operator to concatenate the `text` variable to the string `'Encrypted text: '`. Pay attention to the spacing. # --hints-- -You should call `print()` and pass `'Encrypted text: ' + text` as the arguments. +You should call `print()` and pass `'Encrypted text: ' + text` as the arguments. ```js const commentless_code = __helpers.python.removeComments(code); @@ -54,12 +54,12 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message def encrypt(message, key): return vigenere(message, key) - + def decrypt(message, key): return vigenere(message, key, -1) --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555df0c81300b175308557d.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555df0c81300b175308557d.md index 68b96128144..bb3bf128cf9 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555df0c81300b175308557d.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555df0c81300b175308557d.md @@ -7,11 +7,11 @@ dashedName: step-89 # --description-- -Below the `print()` call you just added, add another `print()` call to print `Key: python` by concatenating the string `Key: ` and the value of the `custom_key` variable. +Below the `print()` call you just added, add another `print()` call to print `Key: python` by concatenating the string `'Key: '` and the value of the `custom_key` variable. # --hints-- -You should have a `print()` call that prints `Key: python` by concatenating the string `Key: ` and the value of the `custom_key` variable. +You should have a `print()` call that prints `Key: python` by concatenating the string `'Key: '` and the value of the `custom_key` variable. ```js const commentless_code = __helpers.python.removeComments(code); @@ -52,12 +52,12 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message def encrypt(message, key): return vigenere(message, key) - + def decrypt(message, key): return vigenere(message, key, -1) --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e1bfcd374e18c6be8e58.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e1bfcd374e18c6be8e58.md index e52496dd150..6d5c9a3c856 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e1bfcd374e18c6be8e58.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e1bfcd374e18c6be8e58.md @@ -7,7 +7,7 @@ dashedName: step-90 # --description-- -In Python, there's a way to easily format strings. *f-strings* enable you to interpolate values in your strings. +In Python, there's a way to easily format strings. *f-strings* enable you to interpolate values in your strings. Interpolation means writing placeholders that will be replaced by the specified values when the program runs. For example, you can get the same result of `'Encrypted text: ' + text` with `f'Encrypted text: {text}'`. You need to put an `f` before the quotes to create the f-string and write the variables or expressions you want to interpolate between curly braces. @@ -49,12 +49,12 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message def encrypt(message, key): return vigenere(message, key) - + def decrypt(message, key): return vigenere(message, key, -1) --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e3f387381a19d5e00333.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e3f387381a19d5e00333.md index ebdb8b79456..4e28d4737fc 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e3f387381a19d5e00333.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e3f387381a19d5e00333.md @@ -45,12 +45,12 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message def encrypt(message, key): return vigenere(message, key) - + def decrypt(message, key): return vigenere(message, key, -1) --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e43e783ed31a0532b1b2.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e43e783ed31a0532b1b2.md index 8e107b0fff4..d55577ba1cf 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e43e783ed31a0532b1b2.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e43e783ed31a0532b1b2.md @@ -47,12 +47,12 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message def encrypt(message, key): return vigenere(message, key) - + def decrypt(message, key): return vigenere(message, key, -1) --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e547c18a2b1a7b795bd8.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e547c18a2b1a7b795bd8.md index 0f916bf649e..073dfdcd2bb 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e547c18a2b1a7b795bd8.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e547c18a2b1a7b795bd8.md @@ -50,12 +50,12 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message def encrypt(message, key): return vigenere(message, key) - + def decrypt(message, key): return vigenere(message, key, -1) --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e5991af57d1ae0e35f0a.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e5991af57d1ae0e35f0a.md index 23af806c5ce..006a04850ea 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e5991af57d1ae0e35f0a.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6555e5991af57d1ae0e35f0a.md @@ -7,7 +7,7 @@ dashedName: step-95 # --description-- -Wait a minute! You cannot decrypt anything with the wrong key. Try with `happycoding`. +Wait a minute! You cannot decrypt anything with the wrong key. Try with `'happycoding'`. With that, your cipher project is complete. @@ -19,7 +19,7 @@ You should still have a `custom_key` variable. ({ test: () => assert(__userGlobals.has("custom_key")) }) ``` -You should modify the `custom_key` value into `happycoding`. +You should modify the `custom_key` value into `'happycoding'`. ```js ({ test: () => assert.equal(__userGlobals.get("custom_key"), "happycoding") }) @@ -54,12 +54,12 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message def encrypt(message, key): return vigenere(message, key) - + def decrypt(message, key): return vigenere(message, key, -1) @@ -96,12 +96,12 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message def encrypt(message, key): return vigenere(message, key) - + def decrypt(message, key): return vigenere(message, key, -1) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655a2a7210094920069b117c.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655a2a7210094920069b117c.md index 05c44517e6f..9a4c27f1945 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655a2a7210094920069b117c.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/655a2a7210094920069b117c.md @@ -7,8 +7,7 @@ dashedName: step-41 # --description-- -Comparison operators allow you to compare two objects based on their values. You can use a comparison operator by placing it between the objects you want to compare. -They return a *Boolean* value — namely `True` or `False` — depending on the truthfulness of the expression. +Comparison operators allow you to compare two objects based on their values. You can use a comparison operator by placing it between the objects you want to compare. They return a *Boolean* value — namely `True` or `False` — depending on the truthfulness of the expression. Python has the following comparison operators: @@ -47,11 +46,11 @@ Python has the following comparison operators: -At the beginning of your loop body, print the result of comparing `char` with an empty space (`' '`). Use the equality operator `==` for that. +At the beginning of your loop body, print the result of comparing `char` with a space (`' '`). Use the equality operator `==` for that. # --hints-- -You should compare `char` with an empty space using the equality operator inside your `for` loop. +You should compare `char` with a space using the equality operator inside your `for` loop. ```js ({ test: () => { @@ -62,7 +61,7 @@ You should compare `char` with an empty space using the equality operator inside }) ``` -You should print the result of comparing `char` with an empty space inside your `for` loop. +You should print the result of comparing `char` with a space inside your `for` loop. ```js ({ test: () => { @@ -73,7 +72,7 @@ You should print the result of comparing `char` with an empty space inside your }) ``` -You should print the result of comparing `char` with an empty space at the beginning of your loop. +You should print the result of comparing `char` with a space at the beginning of your loop. ```js ({ test: () => { diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65687d2f8c7ee27b0446cef3.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65687d2f8c7ee27b0446cef3.md index 34e53a7cc4f..86a5a8baa9a 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65687d2f8c7ee27b0446cef3.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65687d2f8c7ee27b0446cef3.md @@ -18,7 +18,7 @@ Give your `for` loop a body by adding a call to `print(i)`. Remember to indent t # --hints-- -You should add `print(i)` to your `for` loop body. Pay attention to the indentation. +You should add `print(i)` to your `for` loop body. Pay attention to the indentation. ```js assert.match(code, /^for\s+i\s+in\s+text:\s+print\s*\(\s*i\s*\)/m) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/656884439d4d7d929d58669d.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/656884439d4d7d929d58669d.md index e7886b5f796..042349ee0a4 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/656884439d4d7d929d58669d.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/656884439d4d7d929d58669d.md @@ -15,7 +15,7 @@ Restore the indentation for your `print(i)` call. # --hints-- -You should indent `print(i)` inside your `for` loop body. +You should indent `print(i)` inside your `for` loop body. ```js const commentless_code = __helpers.python.removeComments(code); diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/656886ec4e4d9b96ded3c565.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/656886ec4e4d9b96ded3c565.md index 6215b77a724..f971dfe2276 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/656886ec4e4d9b96ded3c565.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/656886ec4e4d9b96ded3c565.md @@ -13,7 +13,7 @@ Rename your `i` variable to `char`. # --hints-- -You should replace `i` with `char`. +You should replace `i` with `char`. ```js assert.match(code, /^for\s+char\s+in\s+text:\s+print\s*\(\s*char\s*\)/m) diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65688a50e6c998a21d8e41d3.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65688a50e6c998a21d8e41d3.md index b2203350e08..97fee73da43 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65688a50e6c998a21d8e41d3.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65688a50e6c998a21d8e41d3.md @@ -7,7 +7,7 @@ dashedName: step-31 # --description-- -Strings are immutable, which means they cannot be changed once created. For example, you might think that the following code changes the value of `my_string` into the string `train`, but this is not valid: +Strings are immutable, which means they cannot be changed once created. For example, you might think that the following code changes the value of `my_string` into the string `'train'`, but this is not valid: ```py my_string = 'brain' diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65688b5a1655a7a6caede847.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65688b5a1655a7a6caede847.md index 39784236282..e2b04ef618e 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65688b5a1655a7a6caede847.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65688b5a1655a7a6caede847.md @@ -14,7 +14,7 @@ message = 'Hello World' message = 'Hello there!' ``` -Delete the `text[0]` line and reassign `text` the string `Albatross`. +Delete the `text[0]` line and reassign `text` the string `'Albatross'`. # --hints-- @@ -25,7 +25,7 @@ const commentless_code = __helpers.python.removeComments(code); assert.isFalse( /text\s*\[\s*0\s*\]\s*\=\s*("|')\w\1/.test(commentless_code)); ``` -You should reassign `text` the string `Albatross`. Do not modify `text = 'Hello World'`. +You should reassign `text` the string `'Albatross'`. Do not modify `text = 'Hello World'`. ```js ({test: () => { diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6568b7a40c7ba0ccbc4b4425.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6568b7a40c7ba0ccbc4b4425.md index 076a71f8786..6b04513e34d 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6568b7a40c7ba0ccbc4b4425.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/6568b7a40c7ba0ccbc4b4425.md @@ -20,7 +20,7 @@ const commentless_code = __helpers.python.removeComments(code); assert.isFalse( /text\s*=\s*("|')Albatross\1/.test(commentless_code)) ``` -You should still have a `text` variable with the value `Hello World`. +You should still have a `text` variable with the value `'Hello World'`. ```js ({test: () => { diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65a450e8fb2c9d75c7378d28.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65a450e8fb2c9d75c7378d28.md index 442d9c6cb33..a98c25c7099 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65a450e8fb2c9d75c7378d28.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65a450e8fb2c9d75c7378d28.md @@ -73,12 +73,12 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message def encrypt(message, key): return vigenere(message, key) - + def decrypt(message, key): return vigenere(message, key, -1) --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65a51c9e000b660122b8b29e.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65a51c9e000b660122b8b29e.md index 71e999219ba..d239d653b25 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65a51c9e000b660122b8b29e.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-string-manipulation-by-building-a-cipher/65a51c9e000b660122b8b29e.md @@ -45,12 +45,12 @@ def vigenere(message, key, direction=1): index = alphabet.find(char) new_index = (index + offset*direction) % len(alphabet) final_message += alphabet[new_index] - + return final_message def encrypt(message, key): return vigenere(message, key) - + def decrypt(message, key): return vigenere(message, key, -1) --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a153a6b362d103e125028.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a153a6b362d103e125028.md index 1b13cf4c93e..61eb3d1e31f 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a153a6b362d103e125028.md +++ b/curriculum/challenges/arabic/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\(node\.left,\s*key\)/) }); +({ test: () => assert.match(code, /self\._insert\(\s*node\.left,\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\(node\.left,\s*key\)/) }); +({ test: () => assert.match(code, /node\.left\s*=\s*self\._insert\(\s*node\.left,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a158c7e80c810f6eff1e1.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a158c7e80c810f6eff1e1.md index 398e320ad67..6df3804daa9 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a158c7e80c810f6eff1e1.md +++ b/curriculum/challenges/arabic/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\(node\.right,\s*key\)/) }); +({ test: () => assert.match(code, /self\._insert\(\s*node\.right,\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\(node\.right,\s*key\)/) }); +({ test: () => assert.match(code, /node\.right\s*=\s*self\._insert\(\s*node\.right,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a167ea3e96512bf1343ce.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a167ea3e96512bf1343ce.md index 63c57b98650..6275b91f801 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a167ea3e96512bf1343ce.md +++ b/curriculum/challenges/arabic/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\(self\.root,\s*key\)/) }); +({ test: () => assert.match(code, /self\._search\(\s*self\.root,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a16db1ccc5e132b5bc44d.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a16db1ccc5e132b5bc44d.md index 7ce15a8854e..5f81590e356 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a16db1ccc5e132b5bc44d.md +++ b/curriculum/challenges/arabic/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\(self\.root,\s*key\)/) }); +({ test: () => assert.match(code, /return\s+self\._search\(\s*self\.root,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a1a6d8c44db154b00c909.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a1a6d8c44db154b00c909.md index 2762bb720c9..463cb27064f 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a1a6d8c44db154b00c909.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a1a6d8c44db154b00c909.md @@ -22,8 +22,8 @@ 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\(node\.left,\s*key\)/) }); +```js +({ test: () => assert.match(code, /return\s+self\._search\(\s*node\.left,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a44442b60ee5a28df8ee5.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a44442b60ee5a28df8ee5.md index 3729cf5b069..496cf5003e9 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a44442b60ee5a28df8ee5.md +++ b/curriculum/challenges/arabic/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\(node\.right,\s*key\)/) }); +({ test: () => assert.match(code, /self\._search\(\s*node\.right,\s*key\s*\)/) }); ``` You should return the result of the `_search` method call. ```js ({ - test: () => assert.match(code, /return\s+self\._search\(node\.right,\s*key\)/) + test: () => assert.match(code, /return\s+self\._search\(\s*node\.right,\s*key\s*\)/) }); ``` diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a452d40556e5c25e4aac8.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a452d40556e5c25e4aac8.md index 8f103eb0ce7..9bf0e27a0b8 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a452d40556e5c25e4aac8.md +++ b/curriculum/challenges/arabic/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\(self,\s*key\)/) }); +({ test: () => assert.match(code, /def\s+delete\(\s*self,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a45c52fa3ea5ece3034c7.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a45c52fa3ea5ece3034c7.md index 472ae7428a0..2ad46e4a65e 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a45c52fa3ea5ece3034c7.md +++ b/curriculum/challenges/arabic/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\(self\.root,\s*key\)/) }); +({ test: () => assert.match(code, /self\._delete\(\s*self\.root,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a4614304cd36031cb4e75.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a4614304cd36031cb4e75.md index 88d3bdeaa00..89049b841a8 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a4614304cd36031cb4e75.md +++ b/curriculum/challenges/arabic/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\(self\.root,\s*key\)/) }); +({ test: () => assert.match(code, /self\.root\s*=\s*self\._delete\(\s*self\.root,\s*key\s*\)/) }); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a46aa8e10c26218c5034c.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a46aa8e10c26218c5034c.md index f74aa7254a9..6c90bb6aa44 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a46aa8e10c26218c5034c.md +++ b/curriculum/challenges/arabic/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\(self,\s*node,\s*key\)/); +assert.match(code, /def\s+_delete\(\s*self,\s*node,\s*key\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a47a9404d856743c7f529.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a47a9404d856743c7f529.md index 4a10e3e2ac1..574826a4ffa 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a47a9404d856743c7f529.md +++ b/curriculum/challenges/arabic/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\(node\.left,\s*key\)/); +assert.match(code, /self\._delete\(\s*node\.left,\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\(node\.left,\s*key\)/); +assert.match(code, /node\.left\s*=\s*self\._delete\(\s*node\.left,\s*key\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a482dfc92896901b9c97e.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a482dfc92896901b9c97e.md index ac99dff18a1..bc051104c03 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a482dfc92896901b9c97e.md +++ b/curriculum/challenges/arabic/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\(node\.right,\s*key\)/); +assert.match(code, /self\._delete\(\s*node\.right,\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\(node\.right,\s*key\)/); +assert.match(code, /node\.right\s*=\s*self\._delete\(\s*node\.right,\s*key\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a4ffc762d117470b94e3b.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a4ffc762d117470b94e3b.md index 97d7bef8bdd..190c1a4ff2d 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a4ffc762d117470b94e3b.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a4ffc762d117470b94e3b.md @@ -20,7 +20,7 @@ For now, add a `_min_value` call after your `elif` block, passing `node.right` a You should assign `self._min_value(node.right)` to `node.key` after your `elif` block. ```js -assert.match(code, /node\.key\s*=\s*self\._min_value\(node\.right\)/); +assert.match(code, /node\.key\s*=\s*self\._min_value\(\s*node\.right\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a50f992ba7177aff2b718.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a50f992ba7177aff2b718.md index ea24a00e200..3e9f5ec2b26 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a50f992ba7177aff2b718.md +++ b/curriculum/challenges/arabic/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\(node\.right\,\s*node\.key/); +assert.match(code, /node\.right\s*=\s*self\._delete\(\s*node\.right\,\s*node\.key/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a54cd88e33b8646c67e16.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a54cd88e33b8646c67e16.md index 5ec1525f67c..350c767fc6d 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a54cd88e33b8646c67e16.md +++ b/curriculum/challenges/arabic/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\(self\.root,\s*result\)/) }) +({ test: () => assert.match(code, /self\._inorder_traversal\(\s*self\.root,\s*result\s*\)/) }) ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a552337ee62882fdeee79.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a552337ee62882fdeee79.md index 0de3806ae99..73c483541d2 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a552337ee62882fdeee79.md +++ b/curriculum/challenges/arabic/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\(self,\s*node,\s*result\)/); +assert.match(code, /def\s+_inorder_traversal\(\s*self,\s*node,\s*result\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a557104bb878962e2ae95.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a557104bb878962e2ae95.md index e8dc8e7498a..56e81aa9713 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a557104bb878962e2ae95.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a557104bb878962e2ae95.md @@ -20,7 +20,7 @@ assert.match(code, /if\s+node:/); You should call `_inorder_traversal` on the `node.left` inside the `if` block. ```js -assert.match(code, /self\._inorder_traversal\(node\.left\s*,\s*result\s*\)/); +assert.match(code, /self\._inorder_traversal\(\s*node\.left\s*,\s*result\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a5607eec63b8c2b1d7087.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a5607eec63b8c2b1d7087.md index d11e0e4ce9a..a5f65ee7030 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a5607eec63b8c2b1d7087.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a5607eec63b8c2b1d7087.md @@ -14,7 +14,7 @@ Still inside the `if` block, append the `key` of the current node to the `result You should append `node.key` to the `result` list. ```js -assert.match(code, /result\.append\(node\.key\)/); +assert.match(code, /result\.append\(\s*node\.key\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a5637ad283d8d24dd49de.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a5637ad283d8d24dd49de.md index 4b8c1ace9da..17b4f7ef31b 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a5637ad283d8d24dd49de.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a5637ad283d8d24dd49de.md @@ -16,13 +16,13 @@ Create an instance of the `BinarySearchTree` class and assign it to the variable You should create an instance of the `BinarySearchTree` class. ```js -assert.match(code, /BinarySearchTree\(\)/); +assert.match(code, /BinarySearchTree\(\s*\)/); ``` You should assign the new instance of `BinarySearchTree` to the variable `bst`. ```js -assert.match(code, /bst\s*=\s*BinarySearchTree\(\)/); +assert.match(code, /bst\s*=\s*BinarySearchTree\(\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a56a6a1168a8f201ba666.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a56a6a1168a8f201ba666.md index 4196c76f9f0..ee3e86d45e5 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a56a6a1168a8f201ba666.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a56a6a1168a8f201ba666.md @@ -20,7 +20,7 @@ assert.match(code, /nodes/); Your `node` variable should have the value `[50, 30, 20, 40, 70, 60, 80]`. ```js -assert.match(code, /nodes\s*=\s*\[50,\s*30,\s*20,\s*40,\s*70,\s*60,\s*80\]/); +assert.match(code, /nodes\s*=\s*\[\s*50\s*,\s*30\s*,\s*20\s*,\s*40\s*\s*,\s*70\s*,\s*60\s*,\s*80\s*\]/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a577302a8a791ed62e8d9.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a577302a8a791ed62e8d9.md index c5e522d8ef5..3de1e373a30 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a577302a8a791ed62e8d9.md +++ b/curriculum/challenges/arabic/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\(node\.right,\s*result\)/); +assert.match(code, /self\._inorder_traversal\(\s*node\.right,\s*result\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a585b87885d962f715a10.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a585b87885d962f715a10.md index 3982d433e8f..9f345a33a10 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a585b87885d962f715a10.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a585b87885d962f715a10.md @@ -16,7 +16,7 @@ To change that to print a useful value, define another method named `__str__` in You should define a method `__str__` that takes a single argument `self`. Remember to use `pass`. ```js -assert.match(code, /def\s+__str__\(self\)/); +assert.match(code, /def\s+__str__\(\s*self\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a58897968829714d6e359.md b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a58897968829714d6e359.md index d60ac2d09d3..b7f0ee5078b 100644 --- a/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a58897968829714d6e359.md +++ b/curriculum/challenges/arabic/07-scientific-computing-with-python/learn-tree-traversal-by-building-a-binary-search-tree/655a58897968829714d6e359.md @@ -14,7 +14,7 @@ In the body of the `__str__` method, delete `pass` and return the result of call You should return the string value of `self.key` from your `__str__` method. ```js -({ test: () => assert.match(code, /^\s{8}return\s+str\(self\.key\)/m) }) +({ test: () => assert.match(code, /^\s{8}return\s+str\(\s*self\.key\s*\)/m) }) ``` # --seed-- diff --git a/curriculum/challenges/arabic/14-responsive-web-design-22/learn-html-forms-by-building-a-registration-form/6537e0be715fcb57d31ba8c3.md b/curriculum/challenges/arabic/14-responsive-web-design-22/learn-html-forms-by-building-a-registration-form/6537e0be715fcb57d31ba8c3.md index 1f6c1b8a053..d66ff79dee8 100644 --- a/curriculum/challenges/arabic/14-responsive-web-design-22/learn-html-forms-by-building-a-registration-form/6537e0be715fcb57d31ba8c3.md +++ b/curriculum/challenges/arabic/14-responsive-web-design-22/learn-html-forms-by-building-a-registration-form/6537e0be715fcb57d31ba8c3.md @@ -13,16 +13,12 @@ Lastly change the text color of the `terms and conditions` link element to `#dfd # --hints-- -يجب عليك استخدام منتقي العناصر `a`. - -```js -assert.exists(new __helpers.CSSHelp(document).getStyle('a')); -``` يجب عليك إعطاء عناصر `a` الـ `color` بقيمة `#dfdfe2`. ```js -assert.equal(new __helpers.CSSHelp(document).getStyle('a')?.color, 'rgb(223, 223, 226)'); +const linkElement = document.querySelector("a"); +assert.equal(window.getComputedStyle(linkElement)?.color, 'rgb(223, 223, 226)'); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/build-a-cash-register-project/build-a-cash-register.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/build-a-cash-register-project/build-a-cash-register.md index 09412cc3a31..0ea718d968a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/build-a-cash-register-project/build-a-cash-register.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/build-a-cash-register-project/build-a-cash-register.md @@ -10,11 +10,9 @@ dashedName: build-a-cash-register Here you'll build a cash register app that will return change to the customer based on the price of the item, the amount of cash provided by the customer, and the amount of cash in the cash drawer. You'll also need to show different messages to the user in different scenarios, such as when the customer provides too little cash or when the cash drawer doesn't have enough to issue the correct change. -There are a few variables you'll need to use in your code: +In the `script.js` file, you have been provided with the `price` and `cid` variables. The `price` variable is the price of the item, and the `cid` variable is the cash-in-drawer, which is a 2D array listing the available currency in the cash drawer. -- `price`: the price of the item as a floating point number. -- `cash`: the amount of cash provided by the customer for the item, which is provided via an `input` element on the page. -- `cid`: cash-in-drawer, a 2D array listing available currency in the cash drawer. +The other variable you will need add is the `cash` variable, which is the amount of cash provided by the customer for the item, which is provided via an `input` element on the page. If you'd like to test your application with different values for `price` and `cid`, make sure to declare them with the `let` keyword so they can be reassigned by our tests. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/build-a-pokemon-search-app-project/build-a-pokemon-search-app.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/build-a-pokemon-search-app-project/build-a-pokemon-search-app.md index fe6f43c6855..94c0f6cce14 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/build-a-pokemon-search-app-project/build-a-pokemon-search-app.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/build-a-pokemon-search-app-project/build-a-pokemon-search-app.md @@ -28,10 +28,10 @@ In this project, you'll build an app that will search for Pokémon by name or ID 1. You should have an element with an `id` of `special-defense` 1. You should have an element with an `id` of `speed` 1. When the `#search-input` element contains the value `Red` and the `#search-button` element is clicked, an alert should appear with the text `Pokémon not found` -1. When the `#search-input` element contains the value `Pikachu` and the `#search-button` element is clicked, the values in the `#pokemon-name`, `#pokemon-id`, `#weight`, `#height`, `#hp`, `#attack`, `#defense`, `#special-attack`, and `#special-defense` elements should be `PIKACHU`, `#25` or `25`, `Weight: 60` or `60`, `Height: 4` or `4`, `35`, `55`, `40`, `50`, `50`, and `90`, respectively +1. When the `#search-input` element contains the value `Pikachu` and the `#search-button` element is clicked, the values in the `#pokemon-name`, `#pokemon-id`, `#weight`, `#height`, `#hp`, `#attack`, `#defense`, `#special-attack`, `#special-defense`, and `#speed` elements should be `PIKACHU`, `#25` or `25`, `Weight: 60` or `60`, `Height: 4` or `4`, `35`, `55`, `40`, `50`, `50`, and `90`, respectively 1. When the `#search-input` element contains the value `Pikachu` and the `#search-button` element is clicked, you should add an `img` element with the `id` of `sprite` and the `src` set to the Pokémon's `front_default` sprite to the page 1. When the `#search-input` element contains the value `Pikachu` and the `#search-button` element is clicked, the `#types` element should contain a single inner element with the value `ELECTRIC`. The `#types` element content should be cleared between searches -1. When the `#search-input` element contains the value `94` and the `#search-button` element is clicked, the values in the `#pokemon-name`, `#pokemon-id`, `#weight`, `#height`, `#hp`, `#attack`, `#defense`, `#special-attack`, and `#special-defense` elements should be `GENGAR`, `#94` or `94`, `Weight: 405` or `405`, `Height: 15` or `15`, `60`, `65`, `60`, `130`, `75`, and `110`, respectively +1. When the `#search-input` element contains the value `94` and the `#search-button` element is clicked, the values in the `#pokemon-name`, `#pokemon-id`, `#weight`, `#height`, `#hp`, `#attack`, `#defense`, `#special-attack`, `#special-defense`, and `#speed`elements should be `GENGAR`, `#94` or `94`, `Weight: 405` or `405`, `Height: 15` or `15`, `60`, `65`, `60`, `130`, `75`, and `110`, respectively 1. When the `#search-input` element contains the value `94` and the `#search-button` element is clicked, you should add an `img` element with the `id` of `sprite` and the `src` set to the Pokémon's `front_default` sprite to the page 1. When the `#search-input` element contains the value `94` and the `#search-button` element is clicked, the `#types` element should contain two inner elements with the text values `GHOST` and `POISON`, respectively. The `#types` element content should be cleared between searches @@ -158,7 +158,7 @@ async () => { }; ``` -When the `#search-input` element contains the value `Pikachu` and the `#search-button` element is clicked, the values in the `#pokemon-name`, `#pokemon-id`, `#weight`, `#height`, `#hp`, `#attack`, `#defense`, `#special-attack`, and `#special-defense` elements should be `PIKACHU`, `#25` or `25`, `Weight: 60` or `60`, `Height: 4` or `4`, `35`, `55`, `40`, `50`, `50`, and `90`, respectively. +When the `#search-input` element contains the value `Pikachu` and the `#search-button` element is clicked, the values in the `#pokemon-name`, `#pokemon-id`, `#weight`, `#height`, `#hp`, `#attack`, `#defense`, `#special-attack`, `#special-defense`, and `#speed` elements should be `PIKACHU`, `#25` or `25`, `Weight: 60` or `60`, `Height: 4` or `4`, `35`, `55`, `40`, `50`, `50`, and `90`, respectively. ```js async () => { @@ -251,7 +251,7 @@ async () => { }; ``` -When the `#search-input` element contains the value `94` and the `#search-button` element is clicked, the values in the `#pokemon-name`, `#pokemon-id`, `#weight`, `#height`, `#hp`, `#attack`, `#defense`, `#special-attack`, and `#special-defense` elements should be `GENGAR`, `#94` or `94`, `Weight: 405` or `405`, `Height: 15` or `15`, `60`, `65`, `60`, `130`, `75`, and `110`, respectively. +When the `#search-input` element contains the value `94` and the `#search-button` element is clicked, the values in the `#pokemon-name`, `#pokemon-id`, `#weight`, `#height`, `#hp`, `#attack`, `#defense`, `#special-attack`, `#special-defense`, and `#speed` elements should be `GENGAR`, `#94` or `94`, `Weight: 405` or `405`, `Height: 15` or `15`, `60`, `65`, `60`, `130`, `75`, and `110`, respectively. ```js async () => { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507bcbfe4ede356e624395.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507bcbfe4ede356e624395.md index 87403fe8d7b..0afb0a5e66f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507bcbfe4ede356e624395.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507bcbfe4ede356e624395.md @@ -11,7 +11,7 @@ Now that you have the value of the input, you need to split it into an array of The `.split()` method takes a string and splits it into an array of strings. You can pass it a string of characters or a RegEx to use as a separator. For example, `string.split(",")` would split the string at each comma and return an array of strings. -Use the `/,\s*/g` regex to split the `value` string by commas. You can tweak it based on the number of spaces seperating your values. Store the array in an `array` variable. +Use the `/,\s*/g` regex to split the `value` string by commas. You can tweak it based on the number of spaces separating your values. Store the array in an `array` variable. # --hints-- @@ -36,7 +36,7 @@ assert.match(code.toString(), /array\s*=\s*value\.split()/); You should use `/,\s*/g` for the `split()` method's separator. ```js -assert.match(code.toString(), /value\.split\(\s*\/,\s*\\s*\*\s*\/g\)/); +assert.match(code.toString(), /value\.split\(\s*\/,\s*\\s*\*\s*\/g\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507c19151201368ee3e16c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507c19151201368ee3e16c.md index 8c9a0f2d28e..b5cd74c6a43 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507c19151201368ee3e16c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507c19151201368ee3e16c.md @@ -22,7 +22,7 @@ assert.match(calculate.toString(), /numbers/); You should use the `.map()` method on your `array` variable. ```js -assert.match(calculate.toString(), /array\.map\(\)/); +assert.match(calculate.toString(), /array\.map\(\s*\)/); ``` You should assign the result of your `.map()` call to your `numbers` variable. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507c4b63731437227b0134.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507c4b63731437227b0134.md index 8c458116261..e32488bb058 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507c4b63731437227b0134.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507c4b63731437227b0134.md @@ -24,7 +24,7 @@ Add a callback function to your `.map()` method that converts each element to a Your `.map()` method should have a callback function which takes an `el` parameter. ```js -assert.match(calculate.toString(), /array\.map\(\(?\s*el\s*\)?\s*=>|array\.map\(function\s*\(?el\)\s*\{/) +assert.match(calculate.toString(), /array\.map\(\s*(\(\s*el\s*\)|el)\s*=>|array\.map\(\s*function\s*\(\s*el\s*\)\s*\{/) ``` Your callback function should use the `Number` constructor to convert `el` to a number. @@ -42,7 +42,7 @@ assert.notMatch(calculate.toString(), /new/); Your callback function should return the element converted to a number. ```js -assert.match(calculate.toString(), /(array\.map\(\(?\s*el\s*\)?\s*=>|array\.map\(function\s*\(?el\)\s*\{)\s*(return\s+)?Number\(\s*el\s*\)/); +assert.match(calculate.toString(), /(array\.map\(\s*(\(\s*el\s*\)|el)\s*=>|array\.map\(\s*function\s*\(\s*el\s*\)\s*\{)\s*(return\s+)?Number\(\s*el\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507d810f1a2e38f1908fd8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507d810f1a2e38f1908fd8.md index 373b4f69d57..32158500c6a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507d810f1a2e38f1908fd8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507d810f1a2e38f1908fd8.md @@ -24,13 +24,13 @@ assert.match(calculate.toString(), /filtered/); Your `calculate` function should use the `.filter()` method on the `numbers` array. ```js -assert.match(calculate.toString(), /numbers\.filter\(\)/) +assert.match(calculate.toString(), /numbers\.filter\(\s*\)/) ``` You should assign the result of `numbers.filter()` to the `filtered` variable. ```js -assert.match(calculate.toString(), /filtered\s*=\s*numbers\.filter\(\)/); +assert.match(calculate.toString(), /filtered\s*=\s*numbers\.filter\(\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507e4562cdde3a28e8de1b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507e4562cdde3a28e8de1b.md index 0b47aab84e7..3627060d9d3 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507e4562cdde3a28e8de1b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507e4562cdde3a28e8de1b.md @@ -26,7 +26,7 @@ Add a callback function to your `.filter()` method that returns `true` if the el Your `.filter()` method should have a callback which accepts `el` as a parameter. ```js -assert.match(calculate.toString(), /numbers\.filter\(\(?\s*el\s*\)?\s*=>|numbers\.filter\(function\s*\(?el\)\s*\{/) +assert.match(calculate.toString(), /numbers\.filter\(\s*(\(\s*el\s*\)|el)\s*=>|numbers\.filter\(\s*function\s*\(\s*el\s*\)\s*\{/) ``` Your callback function should use `!` and `isNaN()` to check if `el` is NOT `NaN`. @@ -38,7 +38,7 @@ assert.match(calculate.toString(), /!\s*(Number\.)?isNaN\(\s*el\s*\)/); Your callback function should return elements that are not `NaN`. ```js -assert.match(calculate.toString(), /(numbers\.filter\(\(?\s*el\s*\)?\s*=>|numbers\.filter\(function\s*\(?el\)\s*\{)\s*(return\s*)?!(Number\.)?isNaN\(\s*el\s*\)/); +assert.match(calculate.toString(), /(numbers\.filter\(\s*(\(\s*el\s*\)|el)\s*=>|numbers\.filter\(\s*function\s*\(\s*el\s*\)\s*\{)\s*(return\s*)?!(Number\.)?isNaN\(\s*el\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507ebb0c50ce3b9d669cd9.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507ebb0c50ce3b9d669cd9.md index 286d0de8f04..ead070ee889 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507ebb0c50ce3b9d669cd9.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63507ebb0c50ce3b9d669cd9.md @@ -28,20 +28,19 @@ assert.notMatch(calculate.toString(), /filtered/); You should chain your `.filter()` call to your `.map()` call. ```js -console.log(calculate.toString()); assert.match(calculate.toString(), /array\.map\(.*\)\.filter\(/s); ``` You should not remove the `.map()` callback. ```js -assert.match(calculate.toString(), /(array\.map\(\(?\s*el\s*\)?\s*=>|array\.map\(function\s*\(?el\)\s*\{)\s*(return\s+)?Number\(\s*el\s*\)/); +assert.match(calculate.toString(), /(array\.map\(\s*(\(\s*el\s*\)|el)\s*=>|array\.map\(\s*function\s*\(\s*el\s*\)\s*\{)\s*(return\s+)?Number\(\s*el\s*\)/); ``` You should not remove the `.filter()` callback. ```js -assert.match(calculate.toString(), /(\.filter\(\(?\s*el\s*\)?\s*=>|\.filter\(function\s*\(?el\)\s*\{)\s*(return\s*)?!(Number\.)?isNaN\(\s*el\s*\)/s); +assert.match(calculate.toString(), /(\.filter\(\s*(\(\s*el\s*\)|el)\s*=>|\.filter\(\s*function\s*\(\s*el\s*\)\s*\{)\s*(return\s*)?!(Number\.)?isNaN\(\s*el\s*\)/s); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6350805fe0fe283dd347b0dc.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6350805fe0fe283dd347b0dc.md index 3123e3787fc..11c129ed9df 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6350805fe0fe283dd347b0dc.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6350805fe0fe283dd347b0dc.md @@ -22,13 +22,13 @@ assert.match(getMean.toString(), /sum/); Your `getMean` function should use the `.reduce()` method of the `array` parameter. ```js -assert.match(getMean.toString(), /array\.reduce\(\)/); +assert.match(getMean.toString(), /array\.reduce\(\s*\)/); ``` You should assign the result of `array.reduce()` to the `sum` variable. ```js -assert.match(getMean.toString(), /sum\s*=\s*array\.reduce\(\)/); +assert.match(getMean.toString(), /sum\s*=\s*array\.reduce\(\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635080d80b72803e973841da.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635080d80b72803e973841da.md index 23fb51273e8..f955c417623 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635080d80b72803e973841da.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635080d80b72803e973841da.md @@ -22,13 +22,13 @@ For your `sum` variable, pass a callback to `.reduce()` that takes the accumulat Your `reduce` method should have a callback function which takes an `acc` and an `el` parameters. ```js -assert.match(getMean.toString(), /(array\.reduce\(\(acc\s*,\s*el\s*\)\s*=>|array\.reduce\(function\s*\(acc\s*,\s*el\)\s*\{)/) +assert.match(getMean.toString(), /(array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>|array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{)/) ``` Your `reduce` method should return the sum of `acc` and `el`. ```js -assert.match(getMean.toString(), /(array\.reduce\(\(acc\s*,\s*el\s*\)\s*=>|array\.reduce\(function\s*\(acc\s*,\s*el\)\s*\{)\s*(return)?\s*acc\s*\+\s*el/) +assert.match(getMean.toString(), /(array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>|array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{)\s*(return\s+)?\s*acc\s*\+\s*el/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6350854411ffb73feb6bb84e.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6350854411ffb73feb6bb84e.md index 88c47fd56a5..4d75b5ff010 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6350854411ffb73feb6bb84e.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6350854411ffb73feb6bb84e.md @@ -22,7 +22,7 @@ Set the initial value of the accumulator to `0`. Your `reduce` method should have `0` as the initial value. ```js -assert.match(getMean.toString(), /(array\.reduce\(\(acc\s*,\s*el\s*\)\s*=>|array\.reduce\(function\s*\(acc\s*,\s*el\)\s*\{)\s*(return)?\s*acc\s*\+\s*el;\s*\}?\s*,\s*0\)/) +assert.match(getMean.toString(), /(array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>|array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{)\s*(return\s+)?\s*acc\s*\+\s*el;\s*\}?\s*,\s*0\s*\)/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635085f80bd9b5429faa40c4.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635085f80bd9b5429faa40c4.md index 4ec58d04ac3..04b4aa83cff 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635085f80bd9b5429faa40c4.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635085f80bd9b5429faa40c4.md @@ -28,19 +28,19 @@ assert.notMatch(getMean.toString(), /mean\s*=/); You should not change the logic within the `reduce` method. ```js -assert.match(getMean.toString(), /(array\.reduce\(\(acc\s*,\s*el\s*\)\s*=>|array\.reduce\(function\s*\(acc\s*,\s*el\)\s*\{)\s*(return)?\s*acc\s*\+\s*el;\s*\}?\s*,\s*0\)/) +assert.match(getMean.toString(), /(array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>|array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{)\s*(return\s+)?\s*acc\s*\+\s*el;\s*\}?\s*,\s*0\s*\)/) ``` You should divide the result of the `reduce` method by the length of the array. ```js -assert.match(getMean.toString(), /(array\.reduce\(\(acc\s*,\s*el\s*\)\s*=>|array\.reduce\(function\s*\(acc\s*,\s*el\)\s*\{)\s*(return)?\s*acc\s*\+\s*el;\s*\}?\s*,\s*0\)\s*\/\s*array\.length/) +assert.match(getMean.toString(), /(array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>|array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{)\s*(return\s+)?\s*acc\s*\+\s*el;\s*\}?\s*,\s*0\s*\)\s*\/\s*array\.length/) ``` You should use implicit return syntax to directly return the result of `reduce` divided by the array length. ```js -assert.match(code, /const\s+getMean\s*=\s*\(?array\)?\s*=>\s*array\.reduce\(\(acc\s*,\s*el\)\s*=>\s*acc\s*\+\s*el\s*,\s*0\s*\)\s*\/\s*array\.length/) +assert.match(code, /const\s+getMean\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*array\.reduce\(\s*\(\s*acc\s*,\s*el\s*\)\s*=>\s*acc\s*\+\s*el\s*,\s*0\s*\)\s*\/\s*array\.length/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63508c898d753754757bd5e3.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63508c898d753754757bd5e3.md index 41ec2869784..836abf04d00 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63508c898d753754757bd5e3.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/63508c898d753754757bd5e3.md @@ -18,13 +18,13 @@ To sort your numbers from smallest to largest, pass a callback function that tak Your `sort` method should have a callback function which takes an `a` and a `b` parameters. ```js -assert.match(getMedian.toString(), /(array\.sort\(\(\s*a\s*,\s*b\s*\)\s*=>|array\.sort\(function\s*\(\s*a\s*,\s*b\)\s*\{)/) +assert.match(getMedian.toString(), /(array\.sort\(\s*\(\s*a\s*,\s*b\s*\)\s*=>|array\.sort\(\s*function\s*\(\s*a\s*,\s*b\s*\)\s*\{)/) ``` Your `sort` method should return the result of subtracting `b` from `a`. ```js -assert.match(getMedian.toString(), /(array\.sort\(\(\s*a\s*,\s*b\s*\)\s*=>|array\.sort\(function\s*\(\s*a\s*,\s*b\)\s*\{)\s*(return)?\s*a\s*\-\s*b/) +assert.match(getMedian.toString(), /(array\.sort\(\s*\(\s*a\s*,\s*b\s*\)\s*=>|array\.sort\(\s*function\s*\(\s*a\s*,\s*b\s*\)\s*\{)\s*(return\s+)?\s*a\s*\-\s*b/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635090f47eb6d9563a6fed05.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635090f47eb6d9563a6fed05.md index a23bc59a5d8..171f2962a19 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635090f47eb6d9563a6fed05.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635090f47eb6d9563a6fed05.md @@ -34,13 +34,13 @@ assert.match(getMedian.toString(), /median\s*=\s*array\.length\s*%\s*2\s*===\s*0 If `array.length` is even, pass an array with the two middle numbers from the `sorted` array to the `getMean` function. The first item in the array argument should be the value at index `array.length / 2` from `sorted` and the second should use the value at the index `array.length / 2 - 1` from `sorted`. ```js -assert.match(getMedian.toString(), /median\s*=\s*array\.length\s*%\s*2\s*===\s*0\s*\?\s*getMean\(\s*\[sorted\[array\.length\s*\/\s*2\]\s*,\s*sorted\[\s*array\.length\s*\/\s*2\s*-\s*1\]\]\)\s*\:/); +assert.match(getMedian.toString(), /median\s*=\s*array\.length\s*%\s*2\s*===\s*0\s*\?\s*getMean\(\s*\[\s*sorted\s*\[\s*array\.length\s*\/\s*2\s*\]\s*,\s*sorted\s*\[\s*array\.length\s*\/\s*2\s*-\s*1\s*\]\s*\]\s*\)\s*\:/); ``` If the `array.length` is odd, your `median` variable should assign the middle number to the `median` variable. The middle number is the value of `sorted` at `Math.floor(array.length / 2)`. ```js -assert.match(getMedian.toString(), /median\s*=\s*array\.length\s*%\s*2\s*===\s*0\s*\?\s*getMean\(\s*\[sorted\[array\.length\s*\/\s*2\]\s*,\s*sorted\[\s*array\.length\s*\/\s*2\s*-\s*1\]\]\)\s*\:\s*sorted\[\s*Math\.floor\(\s*array\.length\s*\/\s*2\)\];/); +assert.match(getMedian.toString(), /median\s*=\s*array\.length\s*%\s*2\s*===\s*0\s*\?\s*getMean\(\s*\[\s*sorted\s*\[\s*array\.length\s*\/\s*2\s*\]\s*,\s*sorted\s*\[\s*array\.length\s*\/\s*2\s*-\s*1\s*\]\s*\]\s*\)\s*\:\s*sorted\s*\[\s*Math\.floor\(\s*array\.length\s*\/\s*2\s*\)\s*\]\s*;/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e79d15aae30fac58f48e.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e79d15aae30fac58f48e.md index 25ebad89a0e..d3f17f6c618 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e79d15aae30fac58f48e.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e79d15aae30fac58f48e.md @@ -22,13 +22,13 @@ assert.match(calculate.toString(), /median\s*=/); Your `median` variable should be assigned the value of `getMedian(numbers)`. ```js -assert.match(calculate.toString(), /median\s*=\s*getMedian\(numbers\)/); +assert.match(calculate.toString(), /median\s*=\s*getMedian\(\s*numbers\s*\)/); ``` Your `calculate` function should query the DOM for the `#median` element and set the `textContent` to `median`. ```js -assert.match(calculate.toString(), /document\.querySelector\(('|")#median\1\)\.textContent\s*=\s*median/); +assert.match(calculate.toString(), /document\.querySelector\(\s*('|")#median\1\s*\)\.textContent\s*=\s*median/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e96d2604f813c656750b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e96d2604f813c656750b.md index c09262cdd84..398fab28bd1 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e96d2604f813c656750b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352e96d2604f813c656750b.md @@ -22,14 +22,13 @@ assert.match(getMode.toString(), /array\.forEach\(/); Your `.forEach()` method should have a callback function which takes an `el` parameter. ```js -console.log(getMode.toString()); -assert.match(getMode.toString(), /(array\.forEach\(\(?\s*el\s*\)?\s*=>|array\.forEach\(function\s*\(?el\)?\s*\{)/); +assert.match(getMode.toString(), /(array\.forEach\(\s*(\(\s*el\s*\)|el)\s*=>|array\.forEach\(\s*function\s*\(\s*el\s*\)\s*\{)/); ``` Your `.forEach()` method should increment the count for each number. Don't forget the fallback value. ```js -assert.match(getMode.toString(), /(array\.forEach\(\(?\s*el\s*\)?\s*=>|array\.forEach\(function\s*\(?el\)?\s*\{)\s*\{?\s*(return)?\s*counts\[\s*el\s*\]\s*=\s*\(\s*counts\[\s*el\s*\]\s*\|\|\s*0\s*\)\s*\+\s*1\s*\}?/); +assert.match(getMode.toString(), /(array\.forEach\(\s*(\(\s*el\s*\)|el)\s*=>|array\.forEach\(\s*function\s*\(\s*el\s*\)\s*\{)\s*\{?\s*(return)?\s*counts\s*\[\s*el\s*\]\s*=\s*\(\s*counts\s*\[\s*el\s*\]\s*\|\|\s*0\s*\)\s*\+\s*1\s*\}?/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ec8b9c70fd17b8c7ba3f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ec8b9c70fd17b8c7ba3f.md index ecb256c5343..dc865d7d709 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ec8b9c70fd17b8c7ba3f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ec8b9c70fd17b8c7ba3f.md @@ -24,19 +24,19 @@ assert.match(getMode.toString(), /highest\s*=\s*Object\.keys\(\s*counts\s*\)\.so Your `getMode` function should pass a callback to the `sort` method with parameters `a` and `b`. ```js -assert.match(getMode.toString(), /highest\s*=\s*Object\.keys\(\s*counts\s*\)\.sort\(function\s*\(\s*a\s*,\s*b\s*\)/) +assert.match(getMode.toString(), /highest\s*=\s*Object\.keys\(\s*counts\s*\)\.sort\(\s*function\s*\(\s*a\s*,\s*b\s*\)/) ``` Your `getMode` function should use the `sort` method to sort the `Object.keys()` array and return the value of `counts[b]` minus the value of `counts[a]`. ```js -assert.match(getMode.toString(), /highest\s*=\s*Object\.keys\(\s*counts\s*\)\.sort\(\s*function\s*\(\s*a\s*,\s*b\s*\)\s*\{\s*return\s+counts\[\s*b\s*\]\s*-\s*counts\[\s*a\s*\];?\s*\}\s*\)/) +assert.match(getMode.toString(), /highest\s*=\s*Object\.keys\(\s*counts\s*\)\.sort\(\s*function\s*\(\s*a\s*,\s*b\s*\)\s*\{\s*return\s+counts\s*\[\s*b\s*\]\s*-\s*counts\s*\[\s*a\s*\]\s*;?\s*\}\s*\)/) ``` Your `highest` variable should have the value of the first entry in the sorted `Object.keys(counts)` array. ```js -assert.match(getMode.toString(), /highest\s*=\s*Object\.keys\(\s*counts\s*\)\.sort\(\s*function\s*\(\s*a\s*,\s*b\s*\)\s*\{\s*return\s+counts\[\s*b\s*\]\s*-\s*counts\[\s*a\s*\];?\s*\}\s*\)\[0\];/) +assert.match(getMode.toString(), /highest\s*=\s*Object\.keys\(\s*counts\s*\)\.sort\(\s*function\s*\(\s*a\s*,\s*b\s*\)\s*\{\s*return\s+counts\s*\[\s*b\s*\]\s*-\s*counts\s*\[\s*a\s*\]\s*;?\s*\}\s*\)\s*\[\s*0\s*\]\s*;/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352edee8a4de01ad693f0e4.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352edee8a4de01ad693f0e4.md index 2415a5af6b0..e6f306055ec 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352edee8a4de01ad693f0e4.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352edee8a4de01ad693f0e4.md @@ -20,13 +20,13 @@ assert.match(getMode.toString(), /mode\s*=\s*Object\.keys\(\s*counts\s*\)\.filte Your `.filter()` method should take a callback function with a parameter `el`. ```js -assert.match(getMode.toString(), /mode\s*=\s*Object\.keys\(\s*counts\s*\)\.filter\(function\s*\(\s*el\s*\)/); +assert.match(getMode.toString(), /mode\s*=\s*Object\.keys\(\s*counts\s*\)\.filter\(\s*function\s*\(\s*el\s*\)/); ``` Your `.filter()` method should return whether the value of `counts[el]` is equal to `counts[highest]`. ```js -assert.match(getMode.toString(), /mode\s*=\s*Object\.keys\(\s*counts\s*\)\.filter\(function\s*\(\s*el\s*\)\s*\{\s*return\s+counts\[\s*el\s*\]\s*===\s*counts\[\s*highest\s*\];\s*\}/); +assert.match(getMode.toString(), /mode\s*=\s*Object\.keys\(\s*counts\s*\)\.filter\(\s*function\s*\(\s*el\s*\)\s*\{\s*return\s+counts\s*\[\s*el\s*\]\s*===\s*counts\s*\[\s*highest\s*\]\s*;\s*\}/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f09b1e53a420e7873344.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f09b1e53a420e7873344.md index 10a4f465d92..78a0941990f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f09b1e53a420e7873344.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f09b1e53a420e7873344.md @@ -20,7 +20,7 @@ assert.match(calculate.toString(), /mode\s*=\s*getMode\(\s*numbers\s*\);/); Your `calculate` function should query the DOM for the `#mode` element and set the `textContent` to `mode`. ```js -assert.match(calculate.toString(), /document\.querySelector\(('|")#mode\1\)\.textContent\s*=\s*mode;/); +assert.match(calculate.toString(), /document\.querySelector\(\s*('|")#mode\1\s*\)\.textContent\s*=\s*mode;/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f179bdca23221298a5ba.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f179bdca23221298a5ba.md index 1dd05dd96be..71de3bd791e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f179bdca23221298a5ba.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f179bdca23221298a5ba.md @@ -12,7 +12,10 @@ Your next calculation is the range, which is the difference between t You previously learned about the global `Math` object. `Math` has a `.min()` method to get the smallest number from a series of numbers, and the `.max()` method to get the largest number. Here's an example that gets the smallest number from an array: ```js -Math.min(1, 9, 11, -3, 0.5); +const numbersArr = [2, 3, 1]; + +console.log(Math.min(...numbersArr)); +// Expected output: 1 ``` Declare a `getRange` function that takes the same `array` parameter you have been using. Using `Math.min()`, `Math.max()`, and the spread operator, return the difference between the largest and smallest numbers in the list. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f2526dccb523150b64fb.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f2526dccb523150b64fb.md index 3461129df1d..62be62ebf63 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f2526dccb523150b64fb.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352f2526dccb523150b64fb.md @@ -14,13 +14,13 @@ Add the logic for calculating and displaying the range to your `calculate` funct Your `calculate` function should set a `range` variable to the result of `getRange(numbers)`. ```js -assert.match(calculate.toString(), /range\s*=\s*getRange\(numbers\);/); +assert.match(calculate.toString(), /range\s*=\s*getRange\(\s*numbers\s*\);/); ``` Your `calculate` function should set the `#range` element's `textContent` to the `range` variable. ```js -assert.match(calculate.toString(), /document\.querySelector\(('|")#range\1\)\.textContent\s*=\s*range;/); +assert.match(calculate.toString(), /document\.querySelector\(\s*('|")#range\1\s*\)\.textContent\s*=\s*range;/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352faf71a9db52631864634.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352faf71a9db52631864634.md index 02b84764104..b21796dc2e8 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352faf71a9db52631864634.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352faf71a9db52631864634.md @@ -26,13 +26,13 @@ assert.match(getVariance.toString(), /differences\s*=\s*array\.map\(/); Your `differences` variable should use the `el` parameter in the callback function. ```js -assert.match(getVariance.toString(), /differences\s*=\s*array\.map\(function\s*\(?\s*el\s*\)?/); +assert.match(getVariance.toString(), /differences\s*=\s*array\.map\(\s*function\s*\(?\s*el\s*\)?/); ``` Your `map` callback should return the value of `el` minus `mean`. ```js -assert.match(getVariance.toString(), /differences\s*=\s*array\.map\(function\s*\(?\s*el\s*\)?\s*\{\s*return\s+el\s*-\s*mean;?\s*\}/); +assert.match(getVariance.toString(), /differences\s*=\s*array\.map\(\s*function\s*\(?\s*el\s*\)?\s*\{\s*return\s+el\s*-\s*mean;?\s*\}/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fbb93a91a8272f838d42.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fbb93a91a8272f838d42.md index 379d1afa733..9190c16f086 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fbb93a91a8272f838d42.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fbb93a91a8272f838d42.md @@ -28,13 +28,13 @@ assert.match(getVariance.toString(), /squaredDifferences\s*=\s*differences\.map\ Your `squaredDifferences` variable should use the `el` parameter in the callback function. ```js -assert.match(getVariance.toString(), /squaredDifferences\s*=\s*differences\.map\(function\s*\(?\s*el\s*\)?/); +assert.match(getVariance.toString(), /squaredDifferences\s*=\s*differences\.map\(\s*function\s*\(?\s*el\s*\)?/); ``` Your `map` callback should return the value of `el` squared. ```js -assert.match(getVariance.toString(), /squaredDifferences\s*=\s*differences\.map\(function\s*\(?\s*el\s*\)?\s*\{\s*return\s+Math\.pow\(\s*el\s*,\s*2\s*\);\s*\}/); +assert.match(getVariance.toString(), /squaredDifferences\s*=\s*differences\.map\(\s*function\s*\(?\s*el\s*\)?\s*\{\s*return\s+Math\.pow\(\s*el\s*,\s*2\s*\);\s*\}/); ``` Your `map` callback should use the `**` operator. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md index ba3283ba507..f7b77d29c7d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fcb156834128001ea945.md @@ -28,14 +28,13 @@ assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDiffere Your `sumSquaredDifferences` variable should use the `acc` and `el` parameters in the callback function. ```js -assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDifferences\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?/); +assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDifferences\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)/); ``` Your `reduce` callback should return the sum of `acc` and `el`. ```js -console.log(getVariance.toString()); -assert.match(getVariance.toString(), /sumSquaredDifferences\s*=\s*squaredDifferences\.reduce\(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*0\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fce75b2d3b2924930f1e.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fce75b2d3b2924930f1e.md index 59c486b27b9..2253f1f8582 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fce75b2d3b2924930f1e.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fce75b2d3b2924930f1e.md @@ -46,19 +46,19 @@ assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(/); Your `variance` variable should use the `acc` and `el` parameters in the callback function. ```js -assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?/); +assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)/); ``` Your `reduce` callback should be an empty function. ```js -assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*\}/); +assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*\}/); ``` Your `reduce` callback should have an initial value of `0`. ```js -assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*\}\s*,\s*0\s*\)/); +assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*\}\s*,\s*0\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fe473d53592a40ae403b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fe473d53592a40ae403b.md index a822e35acd0..f15f8ea3732 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fe473d53592a40ae403b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fe473d53592a40ae403b.md @@ -14,37 +14,37 @@ Within your empty `.reduce()` callback, declare a variable `difference` and set Your `reduce` callback should have a `difference` variable. ```js -assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s+difference\s*=/); +assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=/); ``` Your `difference` variable should be set to the value of `el` minus `mean`. ```js -assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;/); +assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;/); ``` Your `reduce` callback should have a `squared` variable. ```js -assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=/); +assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=/); ``` Your `squared` variable should be set to the value of `difference` to the power of 2. ```js -assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);/); +assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);/); ``` Your `reduce` callback should return the value of `acc` plus `squared`. ```js -assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s+acc\s*\+\s*squared\s*;/); +assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s+acc\s*\+\s*squared\s*;/); ``` You should not remove the initial value of `0` from your `.reduce()` method. ```js -assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s+acc\s*\+\s*squared\s*;\s*\}\s*,\s*0\)/); +assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s+acc\s*\+\s*squared\s*;\s*\}\s*,\s*0\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fed209792d2b89e92ea1.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fed209792d2b89e92ea1.md index e70d3e7656c..ed853638976 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fed209792d2b89e92ea1.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352fed209792d2b89e92ea1.md @@ -16,7 +16,7 @@ Divide your `.reduce()` call by the length of the array (in your `variance` decl You should divide the result of the `.reduce()` call by the length of the array. ```js -assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s+acc\s*\+\s*squared\s*;\s*\}\s*,\s*0\)\s*\/\s*array\.length;/); +assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(\s*function\s*\(\s*acc\s*,\s*el\s*\)\s*\{\s*var\s+difference\s*=\s*el\s*-\s*mean\s*;\s*var\s+squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s+acc\s*\+\s*squared\s*;\s*\}\s*,\s*0\s*\)\s*\/\s*array\.length;/); ``` You should return the value of `variance`. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ff27e0e51b2c7dce0010.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ff27e0e51b2c7dce0010.md index 63f3eade7fe..478443d2529 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ff27e0e51b2c7dce0010.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6352ff27e0e51b2c7dce0010.md @@ -20,7 +20,7 @@ assert.match(calculate.toString(), /variance\s*=\s*getVariance\(\s*numbers\s*\)/ You should set the `textContent` of the `#variance` element to the value of the `variance` variable. ```js -assert.match(calculate.toString(), /document\.querySelector\(('|")#variance\1\)\.textContent\s*=\s*variance/); +assert.match(calculate.toString(), /document\.querySelector\(\s*('|")#variance\1\s*\)\.textContent\s*=\s*variance/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635302be760d6031d11a06cd.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635302be760d6031d11a06cd.md index bdb88c50ff4..0e0a8540946 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635302be760d6031d11a06cd.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/635302be760d6031d11a06cd.md @@ -14,13 +14,13 @@ Now update the `calculate` function to include the standard deviation logic, lik Your `calculate` function should have a `standardDeviation` variable set to the result of `getStandardDeviation(numbers)`. ```js -assert.match(calculate.toString(), /standardDeviation\s*=\s*getStandardDeviation\(numbers\)/); +assert.match(calculate.toString(), /standardDeviation\s*=\s*getStandardDeviation\(\s*numbers\s*\)/); ``` You should update the `textContent` of the `#standardDeviation` element to be the `standardDeviation` variable. ```js -assert.match(calculate.toString(), /document\.querySelector\(('|")#standardDeviation\1\)\.textContent\s*=\s*standardDeviation/); +assert.match(calculate.toString(), /document\.querySelector\(\s*('|")#standardDeviation\1\s*\)\.textContent\s*=\s*standardDeviation/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6374249d3fbf2a5b079ba036.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6374249d3fbf2a5b079ba036.md index 2b4c3a10d9c..6179831b5b0 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6374249d3fbf2a5b079ba036.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-advanced-array-methods-by-building-a-statistics-calculator/6374249d3fbf2a5b079ba036.md @@ -16,19 +16,19 @@ To fix this, add an empty `.slice()` call before your `.sort()` method. The empt You should call `.slice()` on the `array` parameter. ```js -assert.match(getMedian.toString(), /array\.slice\(\)/); +assert.match(getMedian.toString(), /array\.slice\(\s*\)/); ``` Your `.sort()` call should be chained to the `.slice()` call. ```js -assert.match(getMedian.toString(), /array\.slice\(\)\.sort\(/); +assert.match(getMedian.toString(), /array\.slice\(\s*\)\.sort\(/); ``` You should not modify the `.sort()` method callback. ```js -assert.match(getMedian.toString(), /array\.slice\(\)\.sort\(function\s*\(\s*a\s*,\s*b\s*\)\s*\{\s*(return)?\s*a\s*\-\s*b/) +assert.match(getMedian.toString(), /array\.slice\(\s*\)\.sort\(\s*function\s*\(\s*a\s*,\s*b\s*\)\s*\{\s*(return\s+)?\s*a\s*\-\s*b/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/64388945b59341057e955fbb.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/64388945b59341057e955fbb.md index a946f911fc5..6d1d89c9410 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/64388945b59341057e955fbb.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/64388945b59341057e955fbb.md @@ -24,7 +24,7 @@ Use the `async` keyword to create an asynchronous arrow function called `fetchDa You should use the `async` keyword to create an asynchronous arrow function called `fetchData`. ```js -assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\)\s*=>\s*{\s*[^}]*\s*}/); +assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\s*\)\s*=>\s*{\s*[^}]*\s*}/); ``` `fetchData` should be defined. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c0ab6779047014ca69b4f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c0ab6779047014ca69b4f.md index 22082c2b460..3d2d795120d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c0ab6779047014ca69b4f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c0ab6779047014ca69b4f.md @@ -37,7 +37,7 @@ assert.match(code, /\s*const\s+res\s*=\s*await\s+fetch\(\s*(.*)\s*\)/); You should pass in the `forumLatest` constant to the `fetch` call. ```js -assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\)\s*=>\s*{\s*try\s*{\s*const\s+res\s*=\s*await\s+fetch\(\s*forumLatest\s*\)\s*;?\s*}\s*catch\s*\(\s*err\s*\)\s*{\s*}\s*}/); +assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\s*\)\s*=>\s*{\s*try\s*{\s*const\s+res\s*=\s*await\s+fetch\(\s*forumLatest\s*\)\s*;?\s*}\s*catch\s*\(\s*err\s*\)\s*{\s*}\s*}/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c14c8027369027334e802.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c14c8027369027334e802.md index 143cd902317..d82695bdef8 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c14c8027369027334e802.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c14c8027369027334e802.md @@ -22,7 +22,7 @@ assert.match(code, /const\s+data/); You should assign `await res.json()` to the `data` variable. ```js -assert.match(code, /\s*const\s+data\s*=\s*await\s+res\.json\(\);?\s*/); +assert.match(code, /\s*const\s+data\s*=\s*await\s+res\.json\(\s*\);?\s*/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c337176a83407d0cd915c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c337176a83407d0cd915c.md index 1aa78bc12ad..a0659e566a6 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c337176a83407d0cd915c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c337176a83407d0cd915c.md @@ -28,7 +28,7 @@ assert.match(code, /\s*try\s*{[\s\S]*\s*console\.log\(\s*data\s*\)[\s\S]*}\s*cat You should call the `fetchData()` function, after the `fetchData()` function is defined. ```js -assert.match(code, /};?\s*fetchData\(\)/); +assert.match(code, /};?\s*fetchData\(\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c565936a10109b3f59326.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c565936a10109b3f59326.md index ff73503d329..52b78f485e2 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c565936a10109b3f59326.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/643c565936a10109b3f59326.md @@ -22,7 +22,7 @@ assert.match(code, /\s*showLatestPosts\(.*\);??\s*/); You should pass `data` as the argument to `showLatestsPosts()`. ```js -assert.match(code, /\s*showLatestPosts\(data\);?\s*/); +assert.match(code, /\s*showLatestPosts\(\s*data\s*\);?\s*/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/6444ec416a1fe1017e517bd8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/6444ec416a1fe1017e517bd8.md index 4489056f01f..d45019d378e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/6444ec416a1fe1017e517bd8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/6444ec416a1fe1017e517bd8.md @@ -20,7 +20,7 @@ assert.match(code, /\s*const\s+thousands\s*=/); Your should assign `Math.floor(views / 1000)` to your `thousands` variable. ```js -assert.match(code, /\s*const\s+thousands\s*=\s*Math\.floor\(views\s*\/\s*1000\)\s*/); +assert.match(code, /\s*const\s+thousands\s*=\s*Math\.floor\(\s*views\s*\/\s*1000\s*\)\s*/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/644b97360868a301bf9ba463.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/644b97360868a301bf9ba463.md index 589ba81f233..798b38afaf1 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/644b97360868a301bf9ba463.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/644b97360868a301bf9ba463.md @@ -14,7 +14,7 @@ Inside the `if` statement, destructure `className` and `category` from the `allC You should destructure `className` and `category` from the `allCategories[id]` object. The properties can be in any order. ```js -assert(code.match(/const\s*\{\s*(className|category)\s*,\s*(className|category)\s*\}\s*=\s*allCategories\[id\]\s*/g)); +assert(code.match(/const\s*\{\s*(className|category)\s*,\s*(className|category)\s*\}\s*=\s*allCategories\s*\[\s*id\s*\]\s*/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/653f173100e7791a72a8a4c8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/653f173100e7791a72a8a4c8.md index 31f9290fa3a..0676ca29947 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/653f173100e7791a72a8a4c8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/653f173100e7791a72a8a4c8.md @@ -27,19 +27,19 @@ Inside your `fetchData` function, add a `try...catch` statement. The `catch` blo You should have a `try` block inside your `fetchData` function. ```js -assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\)\s*=>\s*{\s*try\s*{[^}]*\s*}/); +assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\s*\)\s*=>\s*{\s*try\s*{[^}]*\s*}/); ``` You should have a `catch` block after your `try` block. ```js -assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\)\s*=>\s*{\s*try\s*{[^}]*\s*}\s*catch\s*\(.*\)\s*{[^}]*\s*}/); +assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\s*\)\s*=>\s*{\s*try\s*{[^}]*\s*}\s*catch\s*\(.*\)\s*{[^}]*\s*}/); ``` Your `catch` block should have an `err` parameter. ```js -assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\)\s*=>\s*{\s*try\s*{[^}]*\s*}\s*catch\s*\(\s*err\s*\)\s*{[^}]*\s*}/); +assert.match(code, /const\s+fetchData\s*=\s*async\s*\(\s*\)\s*=>\s*{\s*try\s*{[^}]*\s*}\s*catch\s*\(\s*err\s*\)\s*{[^}]*\s*}/); ``` diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/6573d962423e118f6d851e6b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/6573d962423e118f6d851e6b.md index 0bf669ce63b..1c2bb438be6 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/6573d962423e118f6d851e6b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-asynchronous-programming-by-building-an-fcc-forum-leaderboard/6573d962423e118f6d851e6b.md @@ -20,13 +20,13 @@ assert.match(code, /const\s+postsContainer\s*=/); You should use `document.getElementById()` to get the `#posts-container` element. ```js -assert.match(code, /document\.getElementById\(('|"|`)posts-container\1\)/); +assert.match(code, /document\.getElementById\(\s*('|"|`)posts-container\1\s*\)/); ``` You should assign the `#posts-container` element to your `postsContainer` variable. ```js -assert(code.match(/const\s+postsContainer\s*=\s*document\.getElementById\(('|"|`)posts-container\1\)/g)); +assert(code.match(/const\s+postsContainer\s*=\s*document\.getElementById\(\s*('|"|`)posts-container\1\s*\)/g)); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6406a71d2b35103a340dba06.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6406a71d2b35103a340dba06.md index b6fddc55ea1..ff579a1c92b 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6406a71d2b35103a340dba06.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6406a71d2b35103a340dba06.md @@ -14,7 +14,7 @@ You will be using this as an event listener for the `sortButton`. Because button Your `sortInputArray` function should call `event.preventDefault()`. ```js -assert.match(sortInputArray.toString(), /event\.preventDefault\(\)/); +assert.match(sortInputArray.toString(), /event\.preventDefault\(\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6410edb33eeaf50dd9a22ab4.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6410edb33eeaf50dd9a22ab4.md index 4352b2ed6d3..81ad9316ddb 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6410edb33eeaf50dd9a22ab4.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6410edb33eeaf50dd9a22ab4.md @@ -22,19 +22,19 @@ assert.match(code, /const\s+bubbleSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s* You should assign `temp` the value of `array[j]`. ```js -assert.match(code, /const\s+bubbleSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\s*\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*>\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\)\s*{\s*const\s+temp\s*=\s*array\s*\[\s*j\s*\];?/); +assert.match(code, /const\s+bubbleSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\s*\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*>\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\)\s*{\s*const\s+temp\s*=\s*array\s*\[\s*j\s*\]\s*;?/); ``` You should assign `array[j]` the value of `array[j + 1]`. ```js -assert.match(code, /const\s+bubbleSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\s*\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*>\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\)\s*{\s*const\s+temp\s*=\s*array\s*\[\s*j\s*\];?\s*array\s*\[\s*j\s*\]\s*=\s*array\s*\[\s*j\s*\+\s*1\s*\];?/); +assert.match(code, /const\s+bubbleSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\s*\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*>\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\)\s*{\s*const\s+temp\s*=\s*array\s*\[\s*j\s*\]\s*;?\s*array\s*\[\s*j\s*\]\s*=\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*;?/); ``` You should assign `array[j + 1]` the value of `temp`. ```js -assert.match(code, /const\s+bubbleSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\s*\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*>\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\)\s*{\s*const\s+temp\s*=\s*array\s*\[\s*j\s*\];?\s*array\s*\[\s*j\s*\]\s*=\s*array\s*\[\s*j\s*\+\s*1\s*\];?\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*temp\s*;?/); +assert.match(code, /const\s+bubbleSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\s*\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*>\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\)\s*{\s*const\s+temp\s*=\s*array\s*\[\s*j\s*\]\s*;?\s*array\s*\[\s*j\s*\]\s*=\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*;?\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*temp\s*;?/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6410efff0ae97c0f06856511.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6410efff0ae97c0f06856511.md index 4300edb6ec0..96e3eafb555 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6410efff0ae97c0f06856511.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6410efff0ae97c0f06856511.md @@ -14,7 +14,7 @@ Finally, after your outer loop has finished executing, return the sorted array. You should `return` the `array` variable. ```js -assert.match(code, /const\s+bubbleSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\s*\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*>\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\)\s*{\s*const\s+temp\s*=\s*array\s*\[\s*j\s*\];?\s*array\s*\[\s*j\s*\]\s*=\s*array\s*\[\s*j\s*\+\s*1\s*\];?\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*temp\s*;?\s*}\s*}\s*}\s*return\s+array;?\s*}/); +assert.match(code, /const\s+bubbleSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*for\s*\(\s*let\s+j\s*=\s*0\s*;\s*j\s*<\s*array\.length\s*-\s*1\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\s*\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\);?\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*>\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*\)\s*{\s*const\s+temp\s*=\s*array\s*\[\s*j\s*\]\s*;?\s*array\s*\[\s*j\s*\]\s*=\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*;?\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*temp\s*;?\s*}\s*}\s*}\s*return\s+array;?\s*}/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6410f9a443d57414ee50fada.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6410f9a443d57414ee50fada.md index 77053630e72..bba22da86e0 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6410f9a443d57414ee50fada.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6410f9a443d57414ee50fada.md @@ -17,7 +17,7 @@ You should remove your `console.log()` call. ```js // Thanks loop-protect -assert.notMatch(bubbleSort.toString(), /console\.log\((?!"Potential infinite)/); +assert.notMatch(bubbleSort.toString(), /console\.log\(\s*(?!"Potential infinite)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6411024727181d190ef03166.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6411024727181d190ef03166.md index 95e89bccc70..810622c0129 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6411024727181d190ef03166.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6411024727181d190ef03166.md @@ -22,19 +22,19 @@ assert.match(code, /const\s+selectionSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{ You should assign `array[i]` to `temp`. ```js -assert.match(code, /const\s+selectionSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s+minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{\s*minIndex\s*=\s*j\s*;?\s*}\s*}\s*const\s+temp\s*=\s*array\[i\]/) +assert.match(code, /const\s+selectionSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s+minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{\s*minIndex\s*=\s*j\s*;?\s*}\s*}\s*const\s+temp\s*=\s*array\s*\[\s*i\s*\]/) ``` You should assign `array[minIndex]` to `array[i]`. ```js -assert.match(code, /const\s+selectionSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s+minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{\s*minIndex\s*=\s*j\s*;?\s*}\s*}\s*const\s+temp\s*=\s*array\[i\]\s*;?\s*array\[i\]\s*=\s*array\[minIndex\]/) +assert.match(code, /const\s+selectionSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s+minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{\s*minIndex\s*=\s*j\s*;?\s*}\s*}\s*const\s+temp\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*array\s*\[\s*i\s*\]\s*=\s*array\s*\[\s*minIndex\s*\]/) ``` You should assign `temp` to `array[minIndex]`. ```js -assert.match(code, /const\s+selectionSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s+minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{\s*minIndex\s*=\s*j\s*;?\s*}\s*}\s*const\s+temp\s*=\s*array\[i\]\s*;?\s*array\[i\]\s*=\s*array\[minIndex\]\s*;?\s*array\[minIndex\]\s*=\s*temp\s*;?\s*}/) +assert.match(code, /const\s+selectionSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s+minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{\s*minIndex\s*=\s*j\s*;?\s*}\s*}\s*const\s+temp\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*array\s*\[\s*i\s*\]\s*=\s*array\s*\[\s*minIndex\s*\]\s*;?\s*array\s*\[\s*minIndex\s*\]\s*=\s*temp\s*;?\s*}/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64110727cefd3d1d9bdb0128.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64110727cefd3d1d9bdb0128.md index 8980ed4b762..592955fb781 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64110727cefd3d1d9bdb0128.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64110727cefd3d1d9bdb0128.md @@ -14,7 +14,7 @@ Finally, after your outer loop has finished, you need to return the array. Once You should `return` the `array` after your outer loop completes. ```js -assert.match(code, /const\s+selectionSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s+minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{\s*minIndex\s*=\s*j\s*;?\s*}\s*}\s*const\s+temp\s*=\s*array\[i\]\s*;?\s*array\[i\]\s*=\s*array\[minIndex\]\s*;?\s*array\[minIndex\]\s*=\s*temp\s*;?\s*}\s*return\s+array;?\s*/) +assert.match(code, /const\s+selectionSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*0\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*let\s+minIndex\s*=\s*i\s*;?\s*for\s*\(\s*let\s+j\s*=\s*i\s*\+\s*1\s*;\s*j\s*<\s*array\.length\s*;\s*j\s*\+\+\s*\)\s*{\s*console\.log\(\s*array\s*,\s*array\s*\[\s*j\s*\]\s*,\s*array\s*\[\s*minIndex\s*\]\s*\);\s*if\s*\(\s*array\s*\[\s*j\s*\]\s*<\s*array\s*\[\s*minIndex\s*\]\s*\)\s*{\s*minIndex\s*=\s*j\s*;?\s*}\s*}\s*const\s+temp\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*array\s*\[\s*i\s*\]\s*=\s*array\s*\[\s*minIndex\s*\]\s*;?\s*array\s*\[\s*minIndex\s*\]\s*=\s*temp\s*;?\s*}\s*return\s+array;?\s*/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6411083020a3101e9514a0f5.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6411083020a3101e9514a0f5.md index 40a86c66067..691dd9318f4 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6411083020a3101e9514a0f5.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6411083020a3101e9514a0f5.md @@ -15,7 +15,7 @@ You should remove the `console.log()` statement from `selectionSort()`. ```js // Thanks loop-protect -assert.notMatch(selectionSort.toString(), /console\.log\((?!"Potential infinite)/); +assert.notMatch(selectionSort.toString(), /console\.log\(\s*(?!"Potential infinite)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6411135e9ee2fa26c882eb02.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6411135e9ee2fa26c882eb02.md index f7132d200ea..10beeeffc99 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6411135e9ee2fa26c882eb02.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/6411135e9ee2fa26c882eb02.md @@ -16,7 +16,7 @@ Do so by assigning the value at the `j` index to the next index. Before decrementing `j`, assign the value at `j` to the index `j + 1`. ```js -assert.match(code, /const\s+insertionSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s+currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*let\s+j\s*=\s*i\s*-\s*1\s*;?\s*while\s*\(\s*j\s*>=\s*0\s*&&\s*array\s*\[\s*j\s*\]\s*>\s*currValue\s*\)\s*{\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*array\s*\[\s*j\s*\];?\s*j--;?\s*\}/); +assert.match(code, /const\s+insertionSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s+currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*let\s+j\s*=\s*i\s*-\s*1\s*;?\s*while\s*\(\s*j\s*>=\s*0\s*&&\s*array\s*\[\s*j\s*\]\s*>\s*currValue\s*\)\s*{\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*array\s*\[\s*j\s*\]\s*;?\s*j--;?\s*\}/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64112c9cf53d632910ea2f9b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64112c9cf53d632910ea2f9b.md index 30f9ea31762..176bc466aea 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64112c9cf53d632910ea2f9b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64112c9cf53d632910ea2f9b.md @@ -16,7 +16,7 @@ Use the assignment operator to insert your current value into the correct index. You should assign `currValue` to the index `j + 1`. ```js -assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s+currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*let\s+j\s*=\s*i\s*-\s*1\s*;?\s*while\s*\(\s*j\s*>=\s*0\s*&&\s*array\s*\[\s*j\s*\]\s*>\s*currValue\s*\)\s*{\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*array\s*\[\s*j\s*\];?\s*j--;?\s*\}\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*currValue;?/); +assert.match(code, /const\s+insertionSort\s*=\s*\(\s*array\s*\)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s+currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*let\s+j\s*=\s*i\s*-\s*1\s*;?\s*while\s*\(\s*j\s*>=\s*0\s*&&\s*array\s*\[\s*j\s*\]\s*>\s*currValue\s*\)\s*{\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*array\s*\[\s*j\s*\]\s*;?\s*j--;?\s*\}\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*currValue;?/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64112cea9e6ac22a314628b0.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64112cea9e6ac22a314628b0.md index ec06c11ce79..bc7228c8c09 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64112cea9e6ac22a314628b0.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-algorithmic-thinking-by-building-a-number-sorter/64112cea9e6ac22a314628b0.md @@ -14,7 +14,7 @@ After your `for` loop has finished, you need to return the array. You should the You should `return` the `array`. ```js -assert.match(code, /const\s+insertionSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s+currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*let\s+j\s*=\s*i\s*-\s*1\s*;?\s*while\s*\(\s*j\s*>=\s*0\s*&&\s*array\s*\[\s*j\s*\]\s*>\s*currValue\s*\)\s*{\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*array\s*\[\s*j\s*\];?\s*j--;?\s*\}\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*currValue;?\s*\}\s*return\s+array;?\s*\}/); +assert.match(code, /const\s+insertionSort\s*=\s*(\(\s*array\s*\)|array)\s*=>\s*{\s*for\s*\(\s*let\s+i\s*=\s*1\s*;\s*i\s*<\s*array\.length\s*;\s*i\s*\+\+\s*\)\s*{\s*const\s+currValue\s*=\s*array\s*\[\s*i\s*\]\s*;?\s*let\s+j\s*=\s*i\s*-\s*1\s*;?\s*while\s*\(\s*j\s*>=\s*0\s*&&\s*array\s*\[\s*j\s*\]\s*>\s*currValue\s*\)\s*{\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*array\s*\[\s*j\s*\]\s*;?\s*j--;?\s*\}\s*array\s*\[\s*j\s*\+\s*1\s*\]\s*=\s*currValue;?\s*\}\s*return\s+array;?\s*\}/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a255dae245b52317da824a.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a255dae245b52317da824a.md index 64451ab8bd9..53f85b0bf4f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a255dae245b52317da824a.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a255dae245b52317da824a.md @@ -11,7 +11,7 @@ One of the most powerful tools is your developer console. Depending on your brow The developer console will include errors that are produced by your code, but you can also use it to see values of variables in your code, which is helpful for debugging. -Add a `console.log("Hello World");` line between your `script` tags. Then click the "Console" button to open the console. You should see the text `Hello World`. +Add a `console.log("Hello World");` line between your `script` tags. Then click the "Console" button to open the console. You should see the text `"Hello World"`. Note how the line ends with a semi-colon. It is common practice in JavaScript to end your code lines with semi-colons. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3a488b24fb32b91155d56.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3a488b24fb32b91155d56.md index f97a16d838f..8aec1fe60fc 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3a488b24fb32b91155d56.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3a488b24fb32b91155d56.md @@ -10,10 +10,10 @@ dashedName: step-7 Variables can be assigned a value. When you do this while you declare it, this is called initialization. For example: ```js -let camperbot = "Bot"; +let age = 32; ``` -This would initialize the `camperbot` variable with a value of `Bot`, a string. +This would initialize the `age` variable with a value of `32`, a number. Initialize your `xp` variable to have a value of `0`, a number. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b506dbaead396f58a701.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b506dbaead396f58a701.md index bbe36de1357..ca6f2dc1138 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b506dbaead396f58a701.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b506dbaead396f58a701.md @@ -15,7 +15,7 @@ let order = ["first", "second", "third"]; This is an array which holds three values. Notice how the values are separated by commas. -Change your `inventory` variable to be an array with the strings `stick`, `dagger`, and `sword`. +Change your `inventory` variable to be an array with the strings `"stick"`, `"dagger"`, and `"sword"`. # --hints-- @@ -31,19 +31,19 @@ Your `inventory` variable should have three values. assert.lengthOf(inventory, 3); ``` -Your `inventory` variable should include the string `stick`. +Your `inventory` variable should include the string `"stick"`. ```js assert.include(inventory, "stick"); ``` -Your `inventory` variable should include the string `dagger`. +Your `inventory` variable should include the string `"dagger"`. ```js assert.include(inventory, "dagger"); ``` -Your `inventory` variable should include the string `sword`. +Your `inventory` variable should include the string `"sword"`. ```js assert.include(inventory, "sword"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b5843544ce3a77459c27.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b5843544ce3a77459c27.md index d02e648b202..448da406750 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b5843544ce3a77459c27.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b5843544ce3a77459c27.md @@ -7,7 +7,7 @@ dashedName: step-14 # --description-- -For now, you want the player to start with just the `stick`. Change the `inventory` array to have `stick` as its only value. +For now, you want the player to start with just the `"stick"`. Change the `inventory` array to have `"stick"` as its only value. # --hints-- @@ -23,7 +23,7 @@ Your `inventory` variable should only have one value. assert.lengthOf(inventory, 1); ``` -Your `inventory` variable should include the string `stick`. +Your `inventory` variable should include the string `"stick"`. ```js assert.include(inventory, "stick"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b79d520a7f3d0e25afd6.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b79d520a7f3d0e25afd6.md index 7683ce8e490..af942191f6a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b79d520a7f3d0e25afd6.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3b79d520a7f3d0e25afd6.md @@ -33,10 +33,10 @@ You should use `document.querySelector()`. assert.match(code, /document\.querySelector/); ``` -You should use the `#button1` selector. +You should use the `"#button1"` selector. ```js -assert.match(code, /querySelector\(('|")#button1\1\)/); +assert.match(code, /querySelector\(\s*('|")#button1\1\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c2fccf186146b59c6e96.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c2fccf186146b59c6e96.md index 6bd456556e9..797e60991da 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c2fccf186146b59c6e96.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c2fccf186146b59c6e96.md @@ -9,12 +9,14 @@ dashedName: step-40 `button1` represents your first `button` element. These elements have a special property called `onclick`, which you can use to determine what happens when someone clicks that button. -You can access properties in JavaScript a couple of different ways. The first is with dot notation. Accessing the `onclick` property of a button would look like: +You can access properties in JavaScript a couple of different ways. The first is with dot notation. Here is an example of using dot notation to set the `onclick` property of a button to a function reference. ```js -button.onclick +button.onclick = myFunction; ``` +In this example, `button` is the button element, and `myFunction` is a reference to a function. When the button is clicked, `myFunction` will be called. + Use dot notation to set the `onclick` property of your `button1` to the function reference of `goStore`. Note that `button1` is already declared, so you don't need to use `let` or `const`. # --hints-- @@ -31,10 +33,10 @@ You should not use `let` or `const`. assert.notMatch(code, /(let|const)\s+button1\.onclick/); ``` -You should assign the `goStore` function reference to `button1.onclick`. +You should assign the `goStore` function reference to `button1.onclick`. Make sure not to call the function. ```js -assert.match(code, /button1\.onclick\s*=\s*goStore/); +assert.match(code, /button1\.onclick\s*=\s*goStore\s*;?\s*$/m); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c4a0e52767482c5202d4.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c4a0e52767482c5202d4.md index c2291bf3a41..b22438a8539 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c4a0e52767482c5202d4.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c4a0e52767482c5202d4.md @@ -13,6 +13,12 @@ Using the same syntax, set the `onclick` properties of `button2` and `button3` t # --hints-- +You should assign the `goStore` function reference to `button1.onclick`. Make sure not to call the function. + +```js +assert.match(code, /button1\.onclick\s*=\s*goStore\s*;?\s*$/m); +``` + You should use dot notation to access the `onclick` property of `button2`. ```js @@ -25,10 +31,10 @@ You should not use `let` or `const` to assign `button2.onclick`. assert.notMatch(code, /(let|const)\s+button2\.onclick/); ``` -You should set the `onclick` property of `button2` to the variable `goCave`. +You should assign the `goCave` function reference to `button2.onclick`. Make sure not to call the function. ```js -assert.match(code, /button2\.onclick\s*=\s*goCave/); +assert.match(code, /button2\.onclick\s*=\s*goCave\s*;?\s*$/m); ``` You should use dot notation to access the `onclick` property of `button3`. @@ -43,10 +49,10 @@ You should not use `let` or `const` to assign `button3.onclick`. assert.notMatch(code, /(let|const)\s+button3\.onclick/); ``` -You should set the `onclick` property of `button3` to the variable `fightDragon`. +You should assign the `fightDragon` function reference to `button3.onclick`. Make sure not to call the function. ```js -assert.match(code, /button3\.onclick\s*=\s*fightDragon/); +assert.match(code, /button3\.onclick\s*=\s*fightDragon\s*;?\s*$/m); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c8bf3980c14c438d2aed.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c8bf3980c14c438d2aed.md index e8dcac0e2a5..9c0d4012a26 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c8bf3980c14c438d2aed.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c8bf3980c14c438d2aed.md @@ -7,7 +7,7 @@ dashedName: step-36 # --description-- -For now, make your `goStore` function output the message `Going to store.` to the console. For example, here is a function that outputs the message `Hello World`. +For now, make your `goStore` function output the message `"Going to store."` to the console. For example, here is a function that outputs the message `"Hello World"`. ```js function functionName() { @@ -20,13 +20,13 @@ function functionName() { You should have a `console.log("Going to store.");` line in your code. Don't forget the semi-colon. ```js -assert.match(code, /console\.log\(('|")Going to store\.\1\);/); +assert.match(code, /console\.log\(\s*('|")Going to store\.\1\s*\);/); ``` Your `console.log("Going to store.");` line should be in your `goStore` function. ```js -assert.match(goStore.toString(), /console\.log\(('|")Going to store\.\1\);/); +assert.match(goStore.toString(), /console\.log\(\s*('|")Going to store\.\1\s*\);/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c91a2bab1b4d6fabb726.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c91a2bab1b4d6fabb726.md index 479e5a02ec4..b69b0c6500d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c91a2bab1b4d6fabb726.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3c91a2bab1b4d6fabb726.md @@ -7,7 +7,7 @@ dashedName: step-37 # --description-- -Now create a `goCave` function that prints `Going to cave.` to the console. +Now create a `goCave` function that prints `"Going to cave."` to the console. # --hints-- @@ -26,13 +26,13 @@ assert.isFunction(goCave); You should have a `console.log("Going to cave.");` line in your code. ```js -assert.match(code, /console\.log\(('|")Going to cave\.\1\)/); +assert.match(code, /console\.log\(\s*('|")Going to cave\.\1\s*\)/); ``` Your `console.log("Going to cave.");` line should be inside your `goCave` function. ```js -assert.match(goCave.toString(), /console\.log\(('|")Going to cave\.\1\)/); +assert.match(goCave.toString(), /console\.log\(\s*('|")Going to cave\.\1\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cdb11478a34ff4a6470d.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cdb11478a34ff4a6470d.md index 0a1efd4fb60..f95534d380d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cdb11478a34ff4a6470d.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cdb11478a34ff4a6470d.md @@ -7,7 +7,7 @@ dashedName: step-38 # --description-- -Now create a `fightDragon` function that prints `Fighting dragon.` to the console. +Now create a `fightDragon` function that prints `"Fighting dragon."` to the console. # --hints-- @@ -26,13 +26,13 @@ assert.isFunction(fightDragon); You should have a `console.log("Fighting dragon.");` line in your code. ```js -assert.match(code, /console\.log\(('|")Fighting dragon\.\1\)/); +assert.match(code, /console\.log\(\s*('|")Fighting dragon\.\1\s*\)/); ``` Your `console.log("Fighting dragon.");` line should be inside your `fightDragon` function. ```js -assert.match(fightDragon.toString(), /console\.log\(('|")Fighting dragon\.\1\)/); +assert.match(fightDragon.toString(), /console\.log\(\s*('|")Fighting dragon\.\1\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cfc8328d3351b95d4f61.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cfc8328d3351b95d4f61.md index d1ec03b3a00..62dbdac6e74 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cfc8328d3351b95d4f61.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a3cfc8328d3351b95d4f61.md @@ -9,21 +9,25 @@ dashedName: step-42 The `innerText` property controls the text that appears in an HTML element. For example: -```js -const info = document.querySelector("#info"); -info.innerText = "Hello World"; +```html +

Demo content

``` -This code would change the element assigned to the `info` variable to have the text `Hello World`. +```js +const info = document.querySelector("#info"); +info.innerText = "Hello World"; +``` -When a player clicks your `Go to store` button, you want to change the buttons and text. Remove the code inside the `goStore` function and add a line that updates the text of `button1` to say `Buy 10 health (10 gold)`. +The following example would change the text of the `p` element from `Demo content` to `Hello World`. + +When a player clicks your `Go to store` button, you want to change the buttons and text. Remove the code inside the `goStore` function and add a line that updates the text of `button1` to say `"Buy 10 health (10 gold)"`. # --hints-- You should not have a `console.log("Going to store.");` line in your code. ```js -assert.notMatch(code, /console\.log\(('|")Going to store\.\1\)/); +assert.notMatch(code, /console\.log\(\s*('|")Going to store\.\1\s*\)/); ``` You should use dot notation to access the `innerText` property of `button1`. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7beb1ad61211ac153707f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7beb1ad61211ac153707f.md index 09595bb1b69..46633d1a6af 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7beb1ad61211ac153707f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7beb1ad61211ac153707f.md @@ -7,7 +7,7 @@ dashedName: step-43 # --description-- -Now, add a line that updates the text of `button2` to say `Buy weapon (30 gold)` and update the text of `button3` to say `Go to town square`. +Now, add a line that updates the text of `button2` to say `"Buy weapon (30 gold)"` and update the text of `button3` to say `"Go to town square"`. # --hints-- @@ -23,7 +23,7 @@ You should not use `let` or `const` to access the `innerText` property of `butto assert.notMatch(code, /(let|const)\s+button2\.innerText/); ``` -You should update the `innerText` property of `button2` to be `Buy weapon (30 gold)`. +You should update the `innerText` property of `button2` to be `"Buy weapon (30 gold)"`. ```js assert.match(code, /button2\.innerText\s*=\s*('|")Buy weapon \(30 gold\)\1/); @@ -47,7 +47,7 @@ You should not use `let` or `const` to access the `innerText` property of `butto assert.notMatch(code, /(let|const)\s+button3\.innerText/); ``` -You should update the `innerText` property of `button3` to be `Go to town square`. +You should update the `innerText` property of `button3` to be `"Go to town square"`. ```js assert.match(code, /button3\.innerText\s*=\s*('|")Go to town square\1/); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bfabe119461eb13ccbd6.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bfabe119461eb13ccbd6.md index 65ab19d7b57..23920a8fd68 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bfabe119461eb13ccbd6.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7bfabe119461eb13ccbd6.md @@ -7,7 +7,7 @@ dashedName: step-45 # --description-- -Now you need to modify your display text. Change the `innerText` property of the `text` to be `You enter the store.`. +Now you need to modify your display text. Change the `innerText` property of the `text` to be `"You enter the store."`. # --hints-- @@ -23,7 +23,7 @@ You should not use `let` or `const` to access the `innerText` property of `text` assert.notMatch(code, /(let|const)\s+text\.innerText/); ``` -You should update the `innerText` property of `text` to be `You enter the store.`. +You should update the `innerText` property of `text` to be `"You enter the store."`. ```js assert.match(code, /text\.innerText\s*=\s*('|")You enter the store.\1/); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c071219da921758a35bb.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c071219da921758a35bb.md index 30ffe8024df..d0c9ec1991e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c071219da921758a35bb.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7c071219da921758a35bb.md @@ -7,25 +7,25 @@ dashedName: step-48 # --description-- -In your `goTown` function, change your `button` elements' `innerText` properties to be `Go to store`, `Go to cave`, and `Fight dragon`. Update your `onclick` properties to be `goStore`, `goCave`, and `fightDragon`, respectively. +In your `goTown` function, change your `button` elements' `innerText` properties to be `"Go to store"`, `"Go to cave"`, and `"Fight dragon"`. Update your `onclick` properties to be `goStore`, `goCave`, and `fightDragon`, respectively. -Finally, update `innerText` property of your `text` to be `You are in the town square. You see a sign that says Store.`. +Finally, update `innerText` property of your `text` to be `"You are in the town square. You see a sign that says Store."`. # --hints-- -You should set the `button1.innerText` property to be `Go to store` in your `goTown` function. +You should set the `button1.innerText` property to be `"Go to store"` in your `goTown` function. ```js assert.match(goTown.toString(), /button1\.innerText\s*=\s*('|")Go to store\1/); ``` -You should set the `button2.innerText` property to be `Go to cave` in your `goTown` function. +You should set the `button2.innerText` property to be `"Go to cave"` in your `goTown` function. ```js assert.match(goTown.toString(), /button2\.innerText\s*=\s*('|")Go to cave\1/); ``` -You should set the `button3.innerText` property to be `Fight dragon` in your `goTown` function. +You should set the `button3.innerText` property to be `"Fight dragon"` in your `goTown` function. ```js assert.match(goTown.toString(), /button3\.innerText\s*=\s*('|")Fight dragon\1/); @@ -49,7 +49,7 @@ You should set the `button3.onclick` property to be `fightDragon` in your `goTow assert.match(goTown.toString(), /button3\.onclick\s*=\s*fightDragon/); ``` -You should set the `text.innerText` property to be `You are in the town square. You see a sign that says Store.` in your `goTown` function. +You should set the `text.innerText` property to be `"You are in the town square. You see a sign that says Store."` in your `goTown` function. ```js assert.match(goTown.toString(), /text\.innerText\s*=\s*('|")You are in the town square. You see a sign that says Store\.\1/); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7cc99577fbf25ee7a7d76.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7cc99577fbf25ee7a7d76.md index 4dbe7ea107b..a1037d94966 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7cc99577fbf25ee7a7d76.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a7cc99577fbf25ee7a7d76.md @@ -28,7 +28,7 @@ assert.match(code, /function\s+update/); Your `update` function should take a parameter called `location`. ```js -assert.match(update.toString(), /update\(location\)/); +assert.match(update.toString(), /update\(\s*location\s*\)/); ``` Your `update` function should be empty. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8aa98a8289d0a698eee1d.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8aa98a8289d0a698eee1d.md index 3c4c9fffb66..b1767342dc7 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8aa98a8289d0a698eee1d.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8aa98a8289d0a698eee1d.md @@ -7,7 +7,7 @@ dashedName: step-53 # --description-- -Object properties are written as `key: value` pairs, where `key` is the name of the property (or the key), and `value` is the value that property holds. For example, here is an object with a key of `name` set to `Quincy Larson`. +Object properties are written as `key: value` pairs, where `key` is the name of the property (or the key), and `value` is the value that property holds. For example, here is an object with a key of `name` set to `"Quincy Larson"`. ```js { @@ -15,7 +15,7 @@ Object properties are written as `key: value` pairs, where `key` is t } ``` -Add a `name` property to your empty object and give it a value of `town square`. +Add a `name` property to your empty object and give it a value of `"town square"`. # --hints-- @@ -31,7 +31,7 @@ Your first value of `locations` should have a `name` property. assert.isDefined(locations[0].name); ``` -Your first value of `locations` should have a `name` property with a value of `town square`. +Your first value of `locations` should have a `name` property with a value of `"town square"`. ```js assert.equal(locations[0].name, "town square"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ac194679e60cb561b0a8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ac194679e60cb561b0a8.md index a18a4f05b5d..cba2680e514 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ac194679e60cb561b0a8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ac194679e60cb561b0a8.md @@ -25,19 +25,19 @@ assert.isString(locations[0]["button text"][1]); assert.isString(locations[0]["button text"][2]); ``` -The first value in the `button text` array should be "Go to store". +The first value in the `button text` array should be `"Go to store"`. ```js assert.equal(locations[0]["button text"][0], "Go to store"); ``` -The second value in the `button text` array should be "Go to cave". +The second value in the `button text` array should be `"Go to cave"`. ```js assert.equal(locations[0]["button text"][1], "Go to cave"); ``` -The third value in the `button text` array should be "Fight dragon". +The third value in the `button text` array should be `"Fight dragon"`. ```js assert.equal(locations[0]["button text"][2], "Fight dragon"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ade9b2f5b30ef0b606c2.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ade9b2f5b30ef0b606c2.md index fab40445163..5241587b2d2 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ade9b2f5b30ef0b606c2.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ade9b2f5b30ef0b606c2.md @@ -23,7 +23,7 @@ Your `text` property should be a string. assert.isString(locations[0]["text"]); ``` -Your `text` property should have the value `You are in the town square. You see a sign that says \"Store\".` +Your `text` property should have the value `"You are in the town square. You see a sign that says \"Store\"."` ```js assert.equal(locations[0]["text"], "You are in the town square. You see a sign that says \"Store\"."); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ae85fcaedc0fddc7ca4f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ae85fcaedc0fddc7ca4f.md index 3215b996f44..2b4b511b144 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ae85fcaedc0fddc7ca4f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ae85fcaedc0fddc7ca4f.md @@ -37,7 +37,7 @@ Your second `locations` object should have a `button text` property which is an assert.isArray(locations[1]["button text"]); ``` -Your `button text` property should have the string values `Buy 10 health (10 gold)`, `Buy weapon (30 gold)`, and `Go to town square`. +Your `button text` property should have the string values `"Buy 10 health (10 gold)"`, `"Buy weapon (30 gold)"`, and `"Go to town square"`. ```js assert.equal(locations[1]["button text"][0], "Buy 10 health (10 gold)"); @@ -65,7 +65,7 @@ Your second `locations` object should have a `text` property which is a string. assert.isString(locations[1].text); ``` -Your second `locations` object should have a `text` property with the value of `You enter the store.`. +Your second `locations` object should have a `text` property with the value of `"You enter the store."`. ```js assert.equal(locations[1].text, "You enter the store."); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b0b5053f16111b0b6b5f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b0b5053f16111b0b6b5f.md index b36e7b6f74f..6ac3ba5b333 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b0b5053f16111b0b6b5f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b0b5053f16111b0b6b5f.md @@ -11,19 +11,19 @@ Now you can consolidate some of your code. Start by copying the code from inside # --hints-- -Your `update` function should set `button1.innerText` to `Go to store`. +Your `update` function should set `button1.innerText` to `"Go to store"`. ```js assert.match(update.toString(), /button1\.innerText\s*=\s*('|")Go to store\1/); ``` -Your `update` function should set `button2.innerText` to `Go to cave`. +Your `update` function should set `button2.innerText` to `"Go to cave"`. ```js assert.match(update.toString(), /button2\.innerText\s*=\s*('|")Go to cave\1/); ``` -Your `update` function should set `button3.innerText` to `Fight dragon`. +Your `update` function should set `button3.innerText` to `"Fight dragon"`. ```js assert.match(update.toString(), /button3\.innerText\s*=\s*('|")Fight dragon\1/); @@ -47,7 +47,7 @@ Your `update` function should set `button3.onclick` to `fightDragon`. assert.match(update.toString(), /button3\.onclick\s*=\s*fightDragon/); ``` -Your `update` function should set `text.innerText` to `You are in the town square. You see a sign that says \"Store\".`. +Your `update` function should set `text.innerText` to `"You are in the town square. You see a sign that says \"Store\"."`. ```js assert.match(update.toString(), /text\.innerText\s*=\s*"You are in the town square. You see a sign that says \\"Store\\"\."/); @@ -56,13 +56,13 @@ assert.match(update.toString(), /text\.innerText\s*=\s*"You are in the town squa Your `goTown` function should be empty. ```js -assert.match(goTown.toString(), /function goTown\(\) \{\}/); +assert.match(goTown.toString(), /function goTown\(\s*\) \{\}/); ``` Your `goStore` function should be empty. ```js -assert.match(goStore.toString(), /function goStore\(\) \{\}/); +assert.match(goStore.toString(), /function goStore\(\s*\) \{\}/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b1762b7775124622e1a3.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b1762b7775124622e1a3.md index b33a673c18c..3fecc2a0238 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b1762b7775124622e1a3.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b1762b7775124622e1a3.md @@ -20,13 +20,13 @@ myFunction(); You should call the `update` function in the `goTown` function. ```js -assert.match(goTown.toString(), /update\(\)/); +assert.match(goTown.toString(), /update\(\s*\)/); ``` Don't forget your ending semi-colon. ```js -assert.match(goTown.toString(), /update\(\);/); +assert.match(goTown.toString(), /update\(\s*\);/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b3cc436db8139cc5fc09.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b3cc436db8139cc5fc09.md index cc490a974fa..e53b6ea71e6 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b3cc436db8139cc5fc09.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b3cc436db8139cc5fc09.md @@ -20,7 +20,7 @@ myFunction(arg) يجب أن تبعث القائمة `locations` ألى `update` عند تفعيلها. ```js -assert.match(goTown.toString(), /update\(locations\);/); +assert.match(goTown.toString(), /update\(\s*locations\s*\);/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b6536156c51500739b41.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b6536156c51500739b41.md index 300dd43a544..b1510540a56 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b6536156c51500739b41.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b6536156c51500739b41.md @@ -7,7 +7,7 @@ dashedName: step-62 # --description-- -The `locations` array contains two locations: the `town square` and the `store`. Currently you are passing that entire array into the `update` function. +The `locations` array contains two locations: the `"town square"` and the `"store"`. Currently you are passing that entire array into the `update` function. Pass in only the first element of the `locations` array by adding `[0]` at the end of the variable. For example: `myFunction(arg[0]);`. @@ -18,25 +18,25 @@ This is called bracket notation. Values in an array are accessed by i You should use bracket notation with `locations`. ```js -assert.match(code, /locations\[/); +assert.match(code, /locations\s*\[/); ``` You should access the first object in the `locations` array. Remember that arrays are zero-based. ```js -assert.match(code, /locations\[0\]/); +assert.match(code, /locations\s*\[\s*0\s*\]/); ``` You should pass the first object in the `locations` array into the `update` function. ```js -assert.match(code, /update\(locations\[0\]\);/); +assert.match(code, /update\(\s*locations\s*\[\s*0\s*\]\s*\);/); ``` This call should still be in your `goTown()` function. ```js -assert.match(goTown.toString(), /update\(locations\[0\]\);/); +assert.match(goTown.toString(), /update\(\s*locations\s*\[\s*0\s*\]\s*\);/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b711ab7a12161c7d9b67.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b711ab7a12161c7d9b67.md index 905309169ca..6982815699d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b711ab7a12161c7d9b67.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b711ab7a12161c7d9b67.md @@ -9,20 +9,20 @@ dashedName: step-63 Now your `update` function needs to use the argument you pass into it. -Inside the `update` function, change the value of the `button1.innerText` assignment to be `location["button text"]`. That way, you use bracket notation to get the `button text` property of the `location` object passed into the function. +Inside the `update` function, change the value of the `button1.innerText` assignment to be `location["button text"]`. That way, you use bracket notation to get the `"button text"` property of the `location` object passed into the function. # --hints-- -Your `update` function should use bracket notation to get the `button text` property of the `location` object passed into the function. +Your `update` function should use bracket notation to get the `"button text"` property of the `location` object passed into the function. ```js assert.match(update.toString(), /location[('|")button text\1]/); ``` -You should assign the value of the `button text` property of the `location` object to the `innerText` property of `button1`. +You should assign the value of the `"button text"` property of the `location` object to the `innerText` property of `button1`. ```js -assert.match(update.toString(), /button1\.innerText\s*=\s*location\[('|")button text\1\]/); +assert.match(update.toString(), /button1\.innerText\s*=\s*location\s*\[\s*('|")button text\1\s*\]/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b9770050d217d2247801.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b9770050d217d2247801.md index 6bd25398768..10bd5b1d925 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b9770050d217d2247801.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8b9770050d217d2247801.md @@ -7,20 +7,20 @@ dashedName: step-64 # --description-- -`location["button text"]` is an array with three elements. Change the `button1.innerText` assignment to be the first element of that array instead. +`location["button text"]` is an array with three elements. Change the `button1.innerText` assignment to be `location["button text"][0]` which represents the first element of the array. # --hints-- -You should access the first element of the `button text` property of the `location` parameter. +You should access the first element of the `"button text"` property of the `location` parameter. ```js -assert.match(update.toString(), /location\[('|")button text\1\]\[0\]/); +assert.match(update.toString(), /location\s*\[\s*('|")button text\1\s*\]\s*\[\s*0\s*\]/); ``` -You should set the `button1.innerText` property to be the first element of the `button text` property of the `location` parameter. +You should set the `button1.innerText` property to be the first element of the `"button text"` property of the `location` parameter. ```js -assert.match(update.toString(), /button1\.innerText\s*=\s*location\[('|")button text\1\]\[0\]/); +assert.match(update.toString(), /button1\.innerText\s*=\s*location\s*\[\s*('|")button text\1\s*\]\s*\[\s*0\s*\]/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c0c8313e891a15ec23e7.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c0c8313e891a15ec23e7.md index 3906b73f231..3e3c4369184 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c0c8313e891a15ec23e7.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c0c8313e891a15ec23e7.md @@ -7,32 +7,32 @@ dashedName: step-65 # --description-- -Now update `button2.innerText` and `button3.innerText` to be assigned the second and third values of the `button text` array, respectively. +Now update `button2.innerText` and `button3.innerText` to be assigned the second and third values of the `"button text"` array, respectively. # --hints-- -You should access the second element of the `button text` property of the `location` parameter. +You should access the second element of the `"button text"` property of the `location` parameter. ```js -assert.match(update.toString(), /location\[('|")button text\1\]\[1\]/); +assert.match(update.toString(), /location\s*\[\s*('|")button text\1\s*\]\s*\[\s*1\s*\]/); ``` -You should set the `button2.innerText` property to be the second element of the `button text` property of the `location` parameter. +You should set the `button2.innerText` property to be the second element of the `"button text"` property of the `location` parameter. ```js -assert.match(update.toString(), /button2\.innerText\s*=\s*location\[('|")button text\1\]\[1\]/); +assert.match(update.toString(), /button2\.innerText\s*=\s*location\s*\[\s*('|")button text\1\s*\]\s*\[\s*1\s*\]/); ``` -You should access the third element of the `button text` property of the `location` parameter. +You should access the third element of the `"button text"` property of the `location` parameter. ```js -assert.match(update.toString(), /location\[('|")button text\1\]\[2\]/); +assert.match(update.toString(), /location\s*\[\s*('|")button text\1\s*\]\s*\[\s*2\s*\]/); ``` -You should set the `button3.innerText` property to be the third element of the `button text` property of the `location` parameter. +You should set the `button3.innerText` property to be the third element of the `"button text"` property of the `location` parameter. ```js -assert.match(update.toString(), /button3\.innerText\s*=\s*location\[('|")button text\1\]\[2\]/); +assert.match(update.toString(), /button3\.innerText\s*=\s*location\s*\[\s*('|")button text\1\s*\]\s*\[\s*2\s*\]/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c1154d3ae11aee80353f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c1154d3ae11aee80353f.md index 9cc79d0eef6..f6db1f69140 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c1154d3ae11aee80353f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c1154d3ae11aee80353f.md @@ -7,44 +7,44 @@ dashedName: step-66 # --description-- -Following the same pattern as you did for the button text, update the three buttons' `onclick` assignments to be the first, second, and third values of the `button functions` array. +Following the same pattern as you did for the button text, update the three buttons' `onclick` assignments to be the first, second, and third values of the `"button functions"` array. # --hints-- -You should access the first element of the `button functions` property of the `location` parameter. +You should access the first element of the `"button functions"` property of the `location` parameter. ```js -assert.match(update.toString(), /location\[('|")button functions\1\]\[0\]/); +assert.match(update.toString(), /location\s*\[\s*('|")button functions\1\s*\]\s*\[\s*0\s*\]/); ``` -You should set the `button1.onclick` property to be the first element of the `button functions` property of the `location` parameter. +You should set the `button1.onclick` property to be the first element of the `"button functions"` property of the `location` parameter. ```js -assert.match(update.toString(), /button1\.onclick\s*=\s*location\[('|")button functions\1\]\[0\]/); +assert.match(update.toString(), /button1\.onclick\s*=\s*location\s*\[\s*('|")button functions\1\s*\]\s*\[\s*0\s*\]/); ``` -You should access the second element of the `button functions` property of the `location` parameter. +You should access the second element of the `"button functions"` property of the `location` parameter. ```js -assert.match(update.toString(), /location\[('|")button functions\1\]\[1\]/); +assert.match(update.toString(), /location\s*\[\s*('|")button functions\1\s*\]\s*\[\s*1\s*\]/); ``` -You should set the `button2.onclick` property to be the second element of the `button functions` property of the `location` parameter. +You should set the `button2.onclick` property to be the second element of the `"button functions"` property of the `location` parameter. ```js -assert.match(update.toString(), /button2\.onclick\s*=\s*location\[('|")button functions\1\]\[1\]/); +assert.match(update.toString(), /button2\.onclick\s*=\s*location\s*\[\s*('|")button functions\1\s*\]\s*\[\s*1\s*\]/); ``` -You should access the third element of the `button functions` property of the `location` parameter. +You should access the third element of the `"button functions"` property of the `location` parameter. ```js -assert.match(update.toString(), /location\[('|")button functions\1\]\[2\]/); +assert.match(update.toString(), /location\s*\[\s*('|")button functions\1\s*\]\s*\[\s*2\s*\]/); ``` -You should set the `button3.onclick` property to be the third element of the `button functions` property of the `location` parameter. +You should set the `button3.onclick` property to be the third element of the `"button functions"` property of the `location` parameter. ```js -assert.match(update.toString(), /button3\.onclick\s*=\s*location\[('|")button functions\1\]\[2\]/); +assert.match(update.toString(), /button3\.onclick\s*=\s*location\s*\[\s*('|")button functions\1\s*\]\s*\[\s*2\s*\]/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c173949f851c83c64756.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c173949f851c83c64756.md index 63df177f5fb..36a8e54e43e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c173949f851c83c64756.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c173949f851c83c64756.md @@ -22,7 +22,7 @@ assert.match(goStore.toString(), /update\(/); Your `goStore` function should pass the second element of the `locations` array as your argument to `update()`. ```js -assert.match(goStore.toString(), /update\(locations\[1\]\)/); +assert.match(goStore.toString(), /update\(\s*locations\s*\[\s*1\s*\]\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c242b25a531f2909e5bc.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c242b25a531f2909e5bc.md index 6e3c920c359..f00c035cf73 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c242b25a531f2909e5bc.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c242b25a531f2909e5bc.md @@ -26,13 +26,13 @@ assert.isFunction(fightBeast); `fightSlime` should be empty. ```js -assert.match(fightSlime.toString(), /function fightSlime\(\) \{\}/); +assert.match(fightSlime.toString(), /function fightSlime\(\s*\) \{\}/); ``` `fightBeast` should be empty. ```js -assert.match(fightBeast.toString(), /function fightBeast\(\) \{\}/); +assert.match(fightBeast.toString(), /function fightBeast\(\s*\) \{\}/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c2bbbd8aa82052f47c53.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c2bbbd8aa82052f47c53.md index f0feb6a7442..3730d46d59a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c2bbbd8aa82052f47c53.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c2bbbd8aa82052f47c53.md @@ -9,14 +9,13 @@ dashedName: step-70 Add a third object to the `locations` array. Give it the same properties as the other two objects. -Set `name` to `cave`. Set `button text` to an array with the strings `Fight slime`, `Fight fanged beast`, and `Go to town square`. Set the `button functions` to an array with the variables `fightSlime`, `fightBeast`, and `goTown`. Set the `text` property to `You enter the cave. You see some monsters.`. +Set `name` to `cave`. Set `button text` to an array with the strings `"Fight slime"`, `"Fight fanged beast"`, and `"Go to town square"`. Set the `"button functions"` to an array with the variables `fightSlime`, `fightBeast`, and `goTown`. Set the `text` property to `"You enter the cave. You see some monsters."`. # --hints-- You should have three values in your `locations` array. ```js -console.log(locations); assert.lengthOf(locations, 3); ``` @@ -26,19 +25,19 @@ Your third `locations` value should be an object. assert.isObject(locations[2]); ``` -Your third `locations` object should have a `name` property with the value of `cave`. +Your third `locations` object should have a `name` property with the value of `"cave"`. ```js assert.equal(locations[2].name, "cave"); ``` -Your third `locations` object should have a `button text` property which is an array. +Your third `locations` object should have a `"button text"` property which is an array. ```js assert.isArray(locations[2]["button text"]); ``` -Your `button text` property should have the string values `Fight slime`, `Fight fanged beast`, and `Go to town square`. +Your `"button text"` property should have the string values `"Fight slime"`, `"Fight fanged beast"`, and `"Go to town square"`. ```js assert.equal(locations[2]["button text"][0], "Fight slime"); @@ -46,13 +45,13 @@ assert.equal(locations[2]["button text"][1], "Fight fanged beast"); assert.equal(locations[2]["button text"][2], "Go to town square"); ``` -Your third `locations` object should have a `button functions` property which is an array. +Your third `locations` object should have a `"button functions"` property which is an array. ```js assert.isArray(locations[2]["button functions"]); ``` -Your `button functions` property should have the function values `fightSlime`, `fightBeast`, and `goTown`. +Your `"button functions"` property should have the function values `fightSlime`, `fightBeast`, and `goTown`. ```js assert.equal(locations[2]["button functions"][0], fightSlime); @@ -66,7 +65,7 @@ assert.equal(locations[2]["button functions"][2], goTown); assert.isString(locations[2].text); ``` -Your third `locations` object should have a `text` property with the value of `You enter the cave. You see some monsters.`. +Your third `locations` object should have a `text` property with the value of `"You enter the cave. You see some monsters."`. ```js assert.equal(locations[2].text, "You enter the cave. You see some monsters."); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c31ec0ec78216a1c36a0.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c31ec0ec78216a1c36a0.md index c714f08fc4a..de8ca8be2e2 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c31ec0ec78216a1c36a0.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c31ec0ec78216a1c36a0.md @@ -7,7 +7,7 @@ dashedName: step-71 # --description-- -Now that you have a `cave` location object, update your `goCave` function to call `update` and pass that new `cave` location. Remember that this is the third element in your `locations` array. +Now that you have a `"cave"` location object, update your `goCave` function to call `update` and pass that new `"cave"` location. Remember that this is the third element in your `locations` array. Don't forget to remove your `console.log` call! @@ -16,19 +16,19 @@ Don't forget to remove your `console.log` call! You should use bracket notation to access the third element in your `locations` array. ```js -assert.match(code, /locations\[2\]/); +assert.match(code, /locations\s*\[\s*2\s*\]/); ``` You should pass the third element in your `locations` array to `update`. ```js -assert.match(code, /update\(locations\[2\]\)/); +assert.match(code, /update\(\s*locations\s*\[\s*2\s*\]\s*\)/); ``` You should call `update` with the third element in your `locations` array in your `goCave` function. ```js -assert.match(goCave.toString(), /update\(locations\[2\]\)/); +assert.match(goCave.toString(), /update\(\s*locations\s*\[\s*2\s*\]\s*\)/); ``` You should not have the `console.log` statement in your `goCave` function. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c370ad8c68227137e0bc.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c370ad8c68227137e0bc.md index 4d1dbe391b0..93be9c07f85 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c370ad8c68227137e0bc.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c370ad8c68227137e0bc.md @@ -7,7 +7,7 @@ dashedName: step-72 # --description-- -Now that your `store` and `cave` locations are complete, you can code the actions the player takes at those locations. Inside the `buyHealth` function, set `gold` equal to `gold` minus `10`. +Now that your `"store"` and `"cave"` locations are complete, you can code the actions the player takes at those locations. Inside the `buyHealth` function, set `gold` equal to `gold` minus `10`. For example, here is how you would set `num` equal to `5` less than `num`: `num = num - 5;`. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c465fa7b0c252f4a8f0c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c465fa7b0c252f4a8f0c.md index 42dbcd9d574..3fda1395a8c 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c465fa7b0c252f4a8f0c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c465fa7b0c252f4a8f0c.md @@ -19,7 +19,7 @@ const total = document.querySelector('#total'); total.innerText = value; ``` -You can test this by clicking your "Go to store" button, followed by your "Buy Health" button. +You can test this by clicking your `"Go to store"` button, followed by your `"Buy Health"` button. **Note:** Your answer should only be two lines of code. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c4db0710f3260f867a92.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c4db0710f3260f867a92.md index 55a30a76fa0..bd39c41b2b3 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c4db0710f3260f867a92.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c4db0710f3260f867a92.md @@ -7,17 +7,20 @@ dashedName: step-76 # --description-- -ماذا لو لم يكن لدى اللاعب ما يكفي من الذهب (gold) لشراء الصحة (health)؟ عندما تريد تشغيل الكود بشروط معيَّنة، يمكنك استخدام تعبير `if`. ضع كل الكود في وظيفة `buyHealth` داخل تعبير `if`. على سبيل المثال: +ماذا لو لم يكن لدى اللاعب ما يكفي من الذهب (gold) لشراء الصحة (health)؟ When you want to run code conditionally, you can use the if statement. + +An `if` statement is used to make decisions in code. The keyword `if` is followed by a condition in parentheses. If the condition is true, the code inside the curly braces `{}` is executed. If the condition is false, the code inside the curly braces is skipped. + +Here is an example of an `if` statement: ```js -function myFunction() { - if ("condition") { - console.log("Hello World!"); - } +const num = 5; +if (num >= 3) { + console.log("This code will run because num is greater than or equal to 3."); } ``` -For now, the `if` statement condition should be set to the string `condition` as a placeholder. +Start by placing all of the code in your `buyHealth` function inside an `if` statement. For the `if` statement condition, check if `gold` is greater than or equal to `10`. # --hints-- @@ -27,16 +30,16 @@ Your `buyHealth` function should have an `if` statement. assert.match(buyHealth.toString(), /if/); ``` -Your `if` statement should have the string `condition` for the condition. +Your `if` statement should check if `gold` is greater than or equal to `10`. ```js -assert.match(buyHealth.toString(), /if\s*\(('|")condition\1\)/); +assert.match(buyHealth.toString(), /if\s*\(\s*gold\s*>=\s*10\s*\)/); ``` All of your `buyHealth` code should be inside the `if` statement. ```js -assert.match(buyHealth.toString(), /if\s*\(('|")condition\1\)\s*\{[\s\S]*\}/); +assert.match(buyHealth.toString(), /if\s*\(\s*gold\s*>=\s*10\s*\)\s*{\s*gold\s*-=\s*10;\s*health\s*\+=\s*10;\s*goldText\.innerText\s*=\s*gold;\s*healthText\.innerText\s*=\s*health;\s*}/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c5db7888af27af23f0dd.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c5db7888af27af23f0dd.md index 403da825182..051ddd2f2d7 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c5db7888af27af23f0dd.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c5db7888af27af23f0dd.md @@ -1,8 +1,8 @@ --- id: 62a8c5db7888af27af23f0dd -title: الخطوة 78 +title: Step 77 challengeType: 0 -dashedName: step-78 +dashedName: step-77 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c65b75664c28a8e59c16.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c65b75664c28a8e59c16.md index 22e1b895ea1..1498e6c09c4 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c65b75664c28a8e59c16.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c65b75664c28a8e59c16.md @@ -1,17 +1,17 @@ --- id: 62a8c65b75664c28a8e59c16 -title: الخطوة 79 +title: Step 78 challengeType: 0 -dashedName: step-79 +dashedName: step-78 --- # --description-- -Inside the `else` statement, set `text.innerText` to equal `You do not have enough gold to buy health.`. +Inside the `else` statement, set `text.innerText` to equal `"You do not have enough gold to buy health."`. # --hints-- -Your `buyHealth` function should set `text.innerText` to equal `You do not have enough gold to buy health.`. +Your `buyHealth` function should set `text.innerText` to equal `"You do not have enough gold to buy health."`. ```js assert.match(buyHealth.toString(), /text\.innerText\s*=\s*('|")You do not have enough gold to buy health\.\1/); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c6815f5f1a29735efe1b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c6815f5f1a29735efe1b.md index 90e408f18ac..f38b4906897 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c6815f5f1a29735efe1b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c6815f5f1a29735efe1b.md @@ -1,8 +1,8 @@ --- id: 62a8c6815f5f1a29735efe1b -title: الخطوة 80 +title: Step 79 challengeType: 0 -dashedName: step-80 +dashedName: step-79 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7322e42962ad53ad204.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7322e42962ad53ad204.md index bf134af9315..b2dc007106e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7322e42962ad53ad204.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7322e42962ad53ad204.md @@ -1,13 +1,13 @@ --- id: 62a8c7322e42962ad53ad204 -title: الخطوة 81 +title: Step 80 challengeType: 0 -dashedName: step-81 +dashedName: step-80 --- # --description-- -Just like your `locations` array, your `weapons` array will hold objects. Add four objects to the `weapons` array, each with two properties: `name` and `power`. The first should have the `name` set to `stick` and the `power` set to `5`. The second should be `dagger` and `30`. The third, `claw hammer` and `50`. The fourth, `sword` and `100`. +Just like your `locations` array, your `weapons` array will hold objects. Add four objects to the `weapons` array, each with two properties: `name` and `power`. The first should have the `name` set to `"stick"` and the `power` set to `5`. The second should be `"dagger"` and `30`. The third, `"claw hammer"` and `50`. The fourth, `"sword"` and `100`. # --hints-- @@ -26,28 +26,28 @@ assert.isObject(weapons[2]); assert.isObject(weapons[3]); ``` -Your first `weapons` object should have the `name` set to `stick` and the `power` set to `5`. +Your first `weapons` object should have the `name` set to `"stick"` and the `power` set to `5`. ```js assert.equal(weapons[0].name, 'stick'); assert.equal(weapons[0].power, 5); ``` -Your second `weapons` object should have the `name` set to `dagger` and the `power` set to `30`. +Your second `weapons` object should have the `name` set to `"dagger"` and the `power` set to `30`. ```js assert.equal(weapons[1].name, 'dagger'); assert.equal(weapons[1].power, 30); ``` -Your third `weapons` object should have the `name` set to `claw hammer` and the `power` set to `50`. +Your third `weapons` object should have the `name` set to `"claw hammer"` and the `power` set to `50`. ```js assert.equal(weapons[2].name, 'claw hammer'); assert.equal(weapons[2].power, 50); ``` -Your fourth `weapons` object should have the `name` set to `sword` and the `power` set to `100`. +Your fourth `weapons` object should have the `name` set to `"sword"` and the `power` set to `100`. ```js assert.equal(weapons[3].name, 'sword'); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7a59e72c02bb1c717d2.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7a59e72c02bb1c717d2.md index 455f57b86d0..dd8e2a5d9ec 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7a59e72c02bb1c717d2.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c7a59e72c02bb1c717d2.md @@ -1,8 +1,8 @@ --- id: 62a8c7a59e72c02bb1c717d2 -title: الخطوة 82 +title: Step 81 challengeType: 0 -dashedName: step-82 +dashedName: step-81 --- # --description-- @@ -20,7 +20,7 @@ assert.include(buyWeapon.toString(), 'if'); Your `if` statement should check if `gold` is greater than or equal to `30`. ```js -assert.match(buyWeapon.toString(), /if\s*\(gold\s*>=\s*30\)/); +assert.match(buyWeapon.toString(), /if\s*\(\s*gold\s*>=\s*30\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c89e4272512d44fc1c66.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c89e4272512d44fc1c66.md index 08928a6e1c1..570844fee8c 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c89e4272512d44fc1c66.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c89e4272512d44fc1c66.md @@ -1,8 +1,8 @@ --- id: 62a8c89e4272512d44fc1c66 -title: الخطوة 83 +title: Step 82 challengeType: 0 -dashedName: step-83 +dashedName: step-82 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c8cee8e5cf2e001789b4.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c8cee8e5cf2e001789b4.md index 7d79d7a494e..acdc8838246 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c8cee8e5cf2e001789b4.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8c8cee8e5cf2e001789b4.md @@ -1,13 +1,13 @@ --- id: 62a8c8cee8e5cf2e001789b4 -title: الخطوة 84 +title: Step 83 challengeType: 0 -dashedName: step-84 +dashedName: step-83 --- # --description-- -تتوافق قيمة المتغير `currentWeapon` مع رقم الترتيب في قائمة `weapons`. The player starts with a `stick`, since `currentWeapon` starts at `0` and `weapons[0]` is the `stick` weapon. +تتوافق قيمة المتغير `currentWeapon` مع رقم الترتيب في قائمة `weapons`. The player starts with a `"stick"`, since `currentWeapon` starts at `0` and `weapons[0]` is the `"stick"` weapon. In the `buyWeapon` function, use compound assignment to add `1` to `currentWeapon` - the user is buying the next weapon in the `weapons` array. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ca22d29fe62f3952bdf5.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ca22d29fe62f3952bdf5.md index a1b866479b2..c2b63fbfcee 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ca22d29fe62f3952bdf5.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ca22d29fe62f3952bdf5.md @@ -1,8 +1,8 @@ --- id: 62a8ca22d29fe62f3952bdf5 -title: الخطوة 85 +title: Step 84 challengeType: 0 -dashedName: step-85 +dashedName: step-84 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cb19bd7f8a304e5427a1.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cb19bd7f8a304e5427a1.md index f7e5b4c5824..8ebcf334d01 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cb19bd7f8a304e5427a1.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cb19bd7f8a304e5427a1.md @@ -1,13 +1,13 @@ --- id: 62a8cb19bd7f8a304e5427a1 -title: الخطوة 86 +title: Step 85 challengeType: 0 -dashedName: step-86 +dashedName: step-85 --- # --description-- -Now update the `goldText` element to display the new value of `gold`, and update the `text` element to display `You now have a new weapon.`. +Now update the `goldText` element to display the new value of `gold`, and update the `text` element to display `"You now have a new weapon."`. # --hints-- @@ -17,7 +17,7 @@ You should update the `innerText` property of the `goldText` element to be `gold assert.match(buyWeapon.toString(), /goldText\.innerText\s*=\s*gold/); ``` -You should update the `innerText` property of the `text` element to be `You now have a new weapon.`. +You should update the `innerText` property of the `text` element to be `"You now have a new weapon."`. ```js assert.match(buyWeapon.toString(), /text\.innerText\s*=\s*('|")You now have a new weapon\.\1/); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cbd1e3595431d5a2b3f1.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cbd1e3595431d5a2b3f1.md index 7012abb4265..81ebba26eab 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cbd1e3595431d5a2b3f1.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cbd1e3595431d5a2b3f1.md @@ -1,8 +1,8 @@ --- id: 62a8cbd1e3595431d5a2b3f1 -title: الخطوة 87 +title: Step 86 challengeType: 0 -dashedName: step-87 +dashedName: step-86 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cce1b0c32c33017cf2e9.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cce1b0c32c33017cf2e9.md index b2470ff9bfa..a55298fd7e8 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cce1b0c32c33017cf2e9.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cce1b0c32c33017cf2e9.md @@ -1,8 +1,8 @@ --- id: 62a8cce1b0c32c33017cf2e9 -title: الخطوة 88 +title: Step 87 challengeType: 0 -dashedName: step-88 +dashedName: step-87 --- # --description-- @@ -22,7 +22,7 @@ let value = array[index]; You should update `newWeapon` to have the value of `weapons[currentWeapon]`. ```js -assert.match(buyWeapon.toString(), /newWeapon\s*=\s*weapons\[currentWeapon\]/); +assert.match(buyWeapon.toString(), /newWeapon\s*=\s*weapons\s*\[\s*currentWeapon\s*\]/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce1dfc990134162b3bd9.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce1dfc990134162b3bd9.md index 0af92dbf644..af0ce0a447a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce1dfc990134162b3bd9.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce1dfc990134162b3bd9.md @@ -1,8 +1,8 @@ --- id: 62a8ce1dfc990134162b3bd9 -title: الخطوة 89 +title: Step 88 challengeType: 0 -dashedName: step-89 +dashedName: step-88 --- # --description-- @@ -14,7 +14,7 @@ dashedName: step-89 You should update `newWeapon` to have the value of `weapons[currentWeapon].name`. ```js -assert.match(buyWeapon.toString(), /newWeapon\s*=\s*weapons\[currentWeapon\]\.name;/); +assert.match(buyWeapon.toString(), /newWeapon\s*=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.name\s*;?/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce73d0dce43468f6689c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce73d0dce43468f6689c.md index 2945f659767..a06ea68706d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce73d0dce43468f6689c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ce73d0dce43468f6689c.md @@ -1,15 +1,15 @@ --- id: 62a8ce73d0dce43468f6689c -title: الخطوة 90 +title: Step 89 challengeType: 0 -dashedName: step-90 +dashedName: step-89 --- # --description-- -You can insert variables into a string with the concatenation operator `+`. Update the `You now have a new weapon.` string to say `You now have a` and the name of the new weapon. Remember to end the sentence with a period. +You can insert variables into a string with the concatenation operator `+`. Update the `"You now have a new weapon."` string to say `"You now have a "` and the name of the new weapon. Remember to end the sentence with a period. -Here is an example that creates the string `Hello, our name is freeCodeCamp.`: +Here is an example that creates the string `"Hello, our name is freeCodeCamp."`: ```js const ourName = "freeCodeCamp"; @@ -18,7 +18,7 @@ const ourStr = "Hello, our name is " + ourName + "."; # --hints-- -You should update the `text.innerText` assignment to start with the string `You now have a`. +You should update the `text.innerText` assignment to start with the string `"You now have a "`. ```js assert.match(buyWeapon.toString(), /text\.innerText\s*=\s*('|")You now have a \1/); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cf22272d6d35af80d4ac.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cf22272d6d35af80d4ac.md index cc862730454..4f2ed89e0ac 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cf22272d6d35af80d4ac.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8cf22272d6d35af80d4ac.md @@ -1,8 +1,8 @@ --- id: 62a8cf22272d6d35af80d4ac -title: الخطوة 91 +title: Step 90 challengeType: 0 -dashedName: step-91 +dashedName: step-90 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0337d7c67377a4a76c6.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0337d7c67377a4a76c6.md index 47fd633655b..fddaa343d3b 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0337d7c67377a4a76c6.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0337d7c67377a4a76c6.md @@ -1,15 +1,15 @@ --- id: 62a8d0337d7c67377a4a76c6 -title: الخطوة 92 +title: Step 91 challengeType: 0 -dashedName: step-92 +dashedName: step-91 --- # --description-- Up until now, any time `text.innerText` was updated, the old text was erased. This time, use the `+=` operator to add text to the end of `text.innerText`. -Add the string `In your inventory you have:` - include the spaces at the beginning and the end. +Add the string `" In your inventory you have: "` - include the spaces at the beginning and the end. # --hints-- @@ -26,7 +26,7 @@ You should use the `+=` operator to add to `text.innerText`. assert.match(buyWeapon.toString(), /text\.innerText\s*\+=\s*/) ``` -You should add the string `In your inventory you have:` to the end of `text.innerText`. Mind the spaces! +You should add the string `" In your inventory you have: "` to the end of `text.innerText`. Mind the spaces! ```js assert.match(buyWeapon.toString(), /text\.innerText\s*\+=\s*('|")\sIn your inventory you have:\s\1/) diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d08668fa8b38732486e9.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d08668fa8b38732486e9.md index 83a7274cb86..d2d697233c5 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d08668fa8b38732486e9.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d08668fa8b38732486e9.md @@ -1,8 +1,8 @@ --- id: 62a8d08668fa8b38732486e9 -title: الخطوة 93 +title: Step 92 challengeType: 0 -dashedName: step-93 +dashedName: step-92 --- # --description-- @@ -11,7 +11,7 @@ At the end of the second `text.innerText` string you just added, use the concate # --hints-- -You should not change the `In your inventory you have:` string. +You should not change the `" In your inventory you have: "` string. ```js assert.match(buyWeapon.toString(), /text\.innerText\s*\+=\s*('|")\sIn your inventory you have:\s\1/) diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0c4f12c2239b6618582.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0c4f12c2239b6618582.md index 18e8e893a20..08f3472f27d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0c4f12c2239b6618582.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0c4f12c2239b6618582.md @@ -1,13 +1,13 @@ --- id: 62a8d0c4f12c2239b6618582 -title: الخطوة 94 +title: Step 93 challengeType: 0 -dashedName: step-94 +dashedName: step-93 --- # --description-- -Add an `else` statement to your `buyWeapon` function. In that statement, set `text.innerText` to equal `You do not have enough gold to buy a weapon.`. +Add an `else` statement to your `buyWeapon` function. In that statement, set `text.innerText` to equal `"You do not have enough gold to buy a weapon."`. # --hints-- @@ -24,13 +24,13 @@ const split = buyWeapon.toString().split(/\s|\n/); assert.isAbove(split.indexOf('else'), split.indexOf('if')); ``` -You should set `text.innerText` to `You do not have enough gold to buy a weapon.`. +You should set `text.innerText` to `"You do not have enough gold to buy a weapon."`. ```js assert.match(buyWeapon.toString(), /text\.innerText\s*=\s*('|")You do not have enough gold to buy a weapon.\1/); ``` -Your `else` statement should set `text.innerText` to `You do not have enough gold to buy a weapon.`. +Your `else` statement should set `text.innerText` to `"You do not have enough gold to buy a weapon."`. ```js gold = 20; diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0fdf2dad83a92883a80.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0fdf2dad83a92883a80.md index b650b6ee138..b8fe5b50826 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0fdf2dad83a92883a80.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d0fdf2dad83a92883a80.md @@ -1,8 +1,8 @@ --- id: 62a8d0fdf2dad83a92883a80 -title: الخطوة 95 +title: Step 94 challengeType: 0 -dashedName: step-95 +dashedName: step-94 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d143f2a58e3b6d6e9c33.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d143f2a58e3b6d6e9c33.md index 18d0e060f13..0814d277818 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d143f2a58e3b6d6e9c33.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d143f2a58e3b6d6e9c33.md @@ -1,8 +1,8 @@ --- id: 62a8d143f2a58e3b6d6e9c33 -title: الخطوة 96 +title: Step 95 challengeType: 0 -dashedName: step-96 +dashedName: step-95 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d1c72e8bb13c2074d93c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d1c72e8bb13c2074d93c.md index 4e51a43192e..821369edf60 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d1c72e8bb13c2074d93c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d1c72e8bb13c2074d93c.md @@ -1,8 +1,8 @@ --- id: 62a8d1c72e8bb13c2074d93c -title: الخطوة 97 +title: Step 96 challengeType: 0 -dashedName: step-97 +dashedName: step-96 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2146a3e853d0a6e28ca.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2146a3e853d0a6e28ca.md index 743922baa9c..5b21812459f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2146a3e853d0a6e28ca.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2146a3e853d0a6e28ca.md @@ -1,13 +1,13 @@ --- id: 62a8d2146a3e853d0a6e28ca -title: الخطوة 98 +title: Step 97 challengeType: 0 -dashedName: step-98 +dashedName: step-97 --- # --description-- -Add an `else` statement for your outer `if` statement. Inside this new `else` statement, set `text.innerText` to `You already have the most powerful weapon!`. +Add an `else` statement for your outer `if` statement. Inside this new `else` statement, set `text.innerText` to `"You already have the most powerful weapon!"`. # --hints-- @@ -18,13 +18,13 @@ const matches = buyWeapon.toString().match(/else/g); assert.equal(matches.length, 2); ``` -You should set `text.innerText` to `You already have the most powerful weapon!`. +You should set `text.innerText` to `"You already have the most powerful weapon!"`. ```js assert.match(buyWeapon.toString(), /('|")You already have the most powerful weapon!\1/); ``` -You should modify your `text.innerText` to `You already have the most powerful weapon!` within your outer `else` statement. +You should modify your `text.innerText` to `"You already have the most powerful weapon!"` within your outer `else` statement. ```js currentWeapon = 5; diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d24c97461b3ddb9397c8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d24c97461b3ddb9397c8.md index 79141373ac1..8adbb83ea32 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d24c97461b3ddb9397c8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d24c97461b3ddb9397c8.md @@ -1,15 +1,15 @@ --- id: 62a8d24c97461b3ddb9397c8 -title: الخطوة 99 +title: Step 98 challengeType: 0 -dashedName: step-99 +dashedName: step-98 --- # --description-- Once a player has the most powerful weapon, you can give them the ability to sell their old weapons. -In the outer `else` statement, set `button2.innerText` to `Sell weapon for 15 gold`. Also set `button2.onclick` to the function name `sellWeapon`. +In the outer `else` statement, set `button2.innerText` to `"Sell weapon for 15 gold"`. Also set `button2.onclick` to the function name `sellWeapon`. # --hints-- @@ -19,7 +19,7 @@ You should set the value of `button2.innerText`. assert.match(buyWeapon.toString(), /button2\.innerText/); ``` -You should set the value of `button2.innerText` to `Sell weapon for 15 gold`. +You should set the value of `button2.innerText` to `"Sell weapon for 15 gold"`. ```js assert.match(buyWeapon.toString(), /button2\.innerText\s*=\s*('|")Sell weapon for 15 gold\1;/); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2e2a073be3edb46116f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2e2a073be3edb46116f.md index 031cd1bd3df..f239b5e07bb 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2e2a073be3edb46116f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d2e2a073be3edb46116f.md @@ -1,8 +1,8 @@ --- id: 62a8d2e2a073be3edb46116f -title: الخطوة 100 +title: Step 99 challengeType: 0 -dashedName: step-100 +dashedName: step-99 --- # --description-- @@ -20,7 +20,7 @@ assert.isFunction(sellWeapon); `sellWeapon` should be an empty function. ```js -assert.match(sellWeapon.toString(), /sellWeapon\(\)\s*\{\s*\}/); +assert.match(sellWeapon.toString(), /sellWeapon\(\s*\)\s*\{\s*\}/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d31ebbc10e3fe1b28e03.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d31ebbc10e3fe1b28e03.md index e53fbc1aba3..3cf081b462d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d31ebbc10e3fe1b28e03.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d31ebbc10e3fe1b28e03.md @@ -1,8 +1,8 @@ --- id: 62a8d31ebbc10e3fe1b28e03 -title: الخطوة 101 +title: Step 100 challengeType: 0 -dashedName: step-101 +dashedName: step-100 --- # --description-- @@ -20,7 +20,7 @@ assert.match(sellWeapon.toString(), /if/); Your `if` statement should check if `inventory.length` is greater than `1`. ```js -assert.match(sellWeapon.toString(), /if\s*\(inventory\.length\s*>\s*1\)/); +assert.match(sellWeapon.toString(), /if\s*\(\s*inventory\.length\s*>\s*1\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d35660db4040ba292193.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d35660db4040ba292193.md index f748b46ae93..1aa870dcd42 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d35660db4040ba292193.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d35660db4040ba292193.md @@ -1,8 +1,8 @@ --- id: 62a8d35660db4040ba292193 -title: الخطوة 102 +title: Step 101 challengeType: 0 -dashedName: step-102 +dashedName: step-101 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d382cd075f4169223e14.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d382cd075f4169223e14.md index b7e1817a271..c9a8d067c6f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d382cd075f4169223e14.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d382cd075f4169223e14.md @@ -1,8 +1,8 @@ --- id: 62a8d382cd075f4169223e14 -title: الخطوة 103 +title: Step 102 challengeType: 0 -dashedName: step-103 +dashedName: step-102 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d539dc11cb42b5dd7ec8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d539dc11cb42b5dd7ec8.md index 38586ee5bec..e6174703f8c 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d539dc11cb42b5dd7ec8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d539dc11cb42b5dd7ec8.md @@ -1,8 +1,8 @@ --- id: 62a8d539dc11cb42b5dd7ec8 -title: الخطوة 104 +title: Step 103 challengeType: 0 -dashedName: step-104 +dashedName: step-103 --- # --description-- @@ -21,19 +21,19 @@ Use the `shift()` method to take the first element from the `inventory` array an Your `sellWeapon` function should use the `shift()` method. ```js -assert.match(sellWeapon.toString(), /shift\(\)/); +assert.match(sellWeapon.toString(), /shift\(\s*\)/); ``` You should use the `shift()` method on the `inventory` array. ```js -assert.match(sellWeapon.toString(), /inventory\.shift\(\)/); +assert.match(sellWeapon.toString(), /inventory\.shift\(\s*\)/); ``` You should assign the value of `inventory.shift()` to your `currentWeapon` variable. ```js -assert.match(sellWeapon.toString(), /currentWeapon\s*=\s*inventory\.shift\(\)/); +assert.match(sellWeapon.toString(), /currentWeapon\s*=\s*inventory\.shift\(\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d61ddfe35744369365b7.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d61ddfe35744369365b7.md index ea5ca7367c8..9b5f9e125ed 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d61ddfe35744369365b7.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d61ddfe35744369365b7.md @@ -1,13 +1,13 @@ --- id: 62a8d61ddfe35744369365b7 -title: الخطوة 105 +title: Step 104 challengeType: 0 -dashedName: step-105 +dashedName: step-104 --- # --description-- -After your `currentWeapon`, use the concatenation operator to set `text.innerText` to the string `You sold a`, then `currentWeapon`, then the string `.`. +After your `currentWeapon`, use the concatenation operator to set `text.innerText` to the string `"You sold a "`, then `currentWeapon`, then the string `"."`. # --hints-- @@ -17,19 +17,19 @@ You should use the assignment operator with `text.innerText`. assert.match(sellWeapon.toString(), /text\.innerText\s*=/); ``` -You should add `You sold a` to `text.innerText`. Spacing is important. +You should add `"You sold a "` to `text.innerText`. Spacing is important. ```js assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")You sold a \1/); ``` -You should add the value of `currentWeapon` to the `You sold a` string. Use the concatenation operator to do this on the same line. +You should add the value of `currentWeapon` to the `"You sold a "` string. Use the concatenation operator to do this on the same line. ```js assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")You sold a\s\1\s*\+\s*\_currentWeapon/); ``` -You should add the string `.` to the value of `currentWeapon`. Use the concatenation operator to do this on the same line. +You should add the string `"."` to the value of `currentWeapon`. Use the concatenation operator to do this on the same line. ```js assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")You sold a \1\s*\+\s*\_currentWeapon\s+\+\s+('|")\.\2/); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d6c7001ebc45350e3d16.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d6c7001ebc45350e3d16.md index a9f40531039..59c6c536b8b 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d6c7001ebc45350e3d16.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d6c7001ebc45350e3d16.md @@ -1,13 +1,13 @@ --- id: 62a8d6c7001ebc45350e3d16 -title: الخطوة 106 +title: Step 105 challengeType: 0 -dashedName: step-106 +dashedName: step-105 --- # --description-- -Now use the `+=` operator to add the string `In your inventory you have:` and the contents of `inventory` to the `text.innerText`. Make sure to include the space at the beginning and end of the `In your inventory you have:` string. +Now use the `+=` operator to add the string `" In your inventory you have: "` and the contents of `inventory` to the `text.innerText`. Make sure to include the space at the beginning and end of the `" In your inventory you have: "` string. # --hints-- @@ -25,7 +25,7 @@ const matches = sellWeapon.toString().match(/text\.innerText\s*\+=/g); assert.equal(matches.length, 1); ``` -You should add the string `In your inventory you have:` to the second `text.innerText` line. Spacing matters. +You should add the string `" In your inventory you have: "` to the second `text.innerText` line. Spacing matters. ```js assert.match(sellWeapon.toString(), /text\.innerText\s*\+=\s*('|") In your inventory you have: \1/); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d7b8ab568b4649998954.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d7b8ab568b4649998954.md index 4cf28305a2e..c7dfa1f9628 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d7b8ab568b4649998954.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d7b8ab568b4649998954.md @@ -1,13 +1,13 @@ --- id: 62a8d7b8ab568b4649998954 -title: الخطوة 107 +title: Step 106 challengeType: 0 -dashedName: step-107 +dashedName: step-106 --- # --description-- -Use an `else` statement to run when the `inventory` length is not more than one. Set the `text.innerText` to say `Don't sell your only weapon!`. +Use an `else` statement to run when the `inventory` length is not more than one. Set the `text.innerText` to say `"Don't sell your only weapon!"`. # --hints-- @@ -17,7 +17,7 @@ Your `sellWeapon` function should have an `else` statement. assert.match(sellWeapon.toString(), /else/); ``` -You should set `text.innerText` to `Don't sell your only weapon!`. +You should set `text.innerText` to `"Don't sell your only weapon!"`. ```js assert.match(sellWeapon.toString(), /text\.innerText\s*=\s*('|")Don't sell your only weapon!\1/); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d81f539f004776dd9b1e.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d81f539f004776dd9b1e.md index fd9b671de40..a8068715efb 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d81f539f004776dd9b1e.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8d81f539f004776dd9b1e.md @@ -1,15 +1,15 @@ --- id: 62a8d81f539f004776dd9b1e -title: الخطوة 108 +title: Step 107 challengeType: 0 -dashedName: step-108 +dashedName: step-107 --- # --description-- Now you can start the code to fight monsters. To keep your code organized, your `fightDragon` function has been moved for you to be near the other `fight` functions. -Below your `weapons` array, define a `monsters` variable and assign it an array. Set that array to have three objects, each with a `name`, `level`, and `health` properties. The first object's values should be `slime`, `2`, and `15`, in order. The second should be `fanged beast`, `8`, and `60`. The third should be `dragon`, `20`, and `300`. +Below your `weapons` array, define a `monsters` variable and assign it an array. Set that array to have three objects, each with a `name`, `level`, and `health` properties. The first object's values should be `"slime"`, `2`, and `15`, in order. The second should be `"fanged beast"`, `8`, and `60`. The third should be `"dragon"`, `20`, and `300`. # --hints-- @@ -37,7 +37,7 @@ Your `monsters` array should have 3 objects. assert(monsters.every(val => typeof val === "object")); ``` -The first value in your `monsters` array should be an object with a `name` property set to `slime`. +The first value in your `monsters` array should be an object with a `name` property set to `"slime"`. ```js assert.equal(monsters[0].name, "slime"); @@ -55,7 +55,7 @@ The first value in your `monsters` array should be an object with a `health` pro assert.equal(monsters[0].health, 15); ``` -The second value in your `monsters` array should be an object with a `name` property set to `fanged beast`. +The second value in your `monsters` array should be an object with a `name` property set to `"fanged beast"`. ```js assert.equal(monsters[1].name, "fanged beast"); @@ -73,7 +73,7 @@ The second value in your `monsters` array should be an object with a `health` pr assert.equal(monsters[1].health, 60); ``` -The third value in your `monsters` array should be an object with a `name` property set to `dragon`. +The third value in your `monsters` array should be an object with a `name` property set to `"dragon"`. ```js assert.equal(monsters[2].name, "dragon"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd468debb449b4454086.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd468debb449b4454086.md index d89cf968429..f21aeb538fa 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd468debb449b4454086.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd468debb449b4454086.md @@ -1,8 +1,8 @@ --- id: 62a8dd468debb449b4454086 -title: الخطوة 109 +title: Step 108 challengeType: 0 -dashedName: step-109 +dashedName: step-108 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd9cdb16324b04cfd958.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd9cdb16324b04cfd958.md index 907ade1bb37..f2a071ee77d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd9cdb16324b04cfd958.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dd9cdb16324b04cfd958.md @@ -1,8 +1,8 @@ --- id: 62a8dd9cdb16324b04cfd958 -title: الخطوة 110 +title: Step 109 challengeType: 0 -dashedName: step-110 +dashedName: step-109 --- # --description-- @@ -28,7 +28,7 @@ assert.notMatch(fightSlime.toString(), /let|const/); You should call the `goFight` function. ```js -assert.match(fightSlime.toString(), /goFight\(\);/); +assert.match(fightSlime.toString(), /goFight\(\s*\);/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dfcf7fb1044d2f478fd1.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dfcf7fb1044d2f478fd1.md index d5322c3b44b..dff775b563a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dfcf7fb1044d2f478fd1.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8dfcf7fb1044d2f478fd1.md @@ -1,13 +1,13 @@ --- id: 62a8dfcf7fb1044d2f478fd1 -title: الخطوة 111 +title: Step 110 challengeType: 0 -dashedName: step-111 +dashedName: step-110 --- # --description-- -Following the same pattern, use that code in the `fightBeast` and `fightDragon` functions. Remember that `beast` is at index `1` and `dragon` is at index `2`. Also, remove the `console.log` call from your `fightDragon` function. +Following the same pattern as the `fightSlime` function, use that code in the `fightBeast` and `fightDragon` functions. Remember that `beast` is at index `1` and `dragon` is at index `2`. Also, remove the `console.log` call from your `fightDragon` function. # --hints-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e0d1d0110b4ec421489f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e0d1d0110b4ec421489f.md index b4301e3e124..fa62f97c4f9 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e0d1d0110b4ec421489f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e0d1d0110b4ec421489f.md @@ -1,8 +1,8 @@ --- id: 62a8e0d1d0110b4ec421489f -title: الخطوة 112 +title: Step 111 challengeType: 0 -dashedName: step-112 +dashedName: step-111 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e142f7f0bd4fed898de3.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e142f7f0bd4fed898de3.md index 3b29a930d24..9ff3ee038cb 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e142f7f0bd4fed898de3.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e142f7f0bd4fed898de3.md @@ -1,20 +1,19 @@ --- id: 62a8e142f7f0bd4fed898de3 -title: الخطوة 113 +title: Step 112 challengeType: 0 -dashedName: step-113 +dashedName: step-112 --- # --description-- -Add a new object to the end of the `locations` array, following the same properties as the rest of the objects. Set `name` to `fight`, `button text` to an array with `Attack`, `Dodge`, and `Run`, `button functions` to an array with `attack`, `dodge`, and `goTown`, and `text` to `You are fighting a monster.`. +Add a new object to the end of the `locations` array, following the same properties as the rest of the objects. Set `name` to `"fight"`, `"button text"` to an array with `"Attack"`, `"Dodge"`, and `"Run"`, `"button functions"` to an array with `attack`, `dodge`, and `goTown`, and `text` to `"You are fighting a monster."`. # --hints-- Your `locations` array should have 4 values in it. ```js -console.log(locations); assert.lengthOf(locations, 4); ``` @@ -24,25 +23,25 @@ Your new value should be an object. assert.isObject(locations[3]); ``` -Your new object should have a `name` property set to `fight`. +Your new object should have a `name` property set to `"fight"`. ```js assert.equal(locations[3].name, "fight"); ``` -Your new object should have a `button text` property set to an array with the strings `Attack`, `Dodge`, and `Run`. +Your new object should have a `"button text"` property set to an array with the strings `"Attack"`, `"Dodge"`, and `"Run"`. ```js assert.deepEqual(locations[3]["button text"], ["Attack", "Dodge", "Run"]); ``` -Your new object should have a `button functions` property set to an array with the variables `attack`, `dodge`, and `goTown`. +Your new object should have a `"button functions"` property set to an array with the variables `attack`, `dodge`, and `goTown`. ```js assert.deepEqual(locations[3]["button functions"], [attack, dodge, goTown]); ``` -Your new object should have a `text` property set to `You are fighting a monster.`. +Your new object should have a `text` property set to `"You are fighting a monster."`. ```js assert.equal(locations[3].text, "You are fighting a monster."); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e1dc897df55108bcb5e8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e1dc897df55108bcb5e8.md index d23bd002df4..1a6b6592b70 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e1dc897df55108bcb5e8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e1dc897df55108bcb5e8.md @@ -1,8 +1,8 @@ --- id: 62a8e1dc897df55108bcb5e8 -title: الخطوة 114 +title: Step 113 challengeType: 0 -dashedName: step-114 +dashedName: step-113 --- # --description-- @@ -20,7 +20,7 @@ assert.match(goFight.toString(), /update/); You should pass the fourth object in your `locations` array to your `update` call. ```js -assert.match(goFight.toString(), /update\(locations\[3\]\)/); +assert.match(goFight.toString(), /update\(\s*locations\s*\[\s*3\s*\]\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e21398ad61520edb724f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e21398ad61520edb724f.md index ef09a9b2b89..2e11e5e73a1 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e21398ad61520edb724f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e21398ad61520edb724f.md @@ -1,8 +1,8 @@ --- id: 62a8e21398ad61520edb724f -title: الخطوة 115 +title: Step 114 challengeType: 0 -dashedName: step-115 +dashedName: step-114 --- # --description-- @@ -14,13 +14,13 @@ Below your `update` call, set the `monsterHealth` to be the health of the curren You should use bracket notation to access the `monsters` array at the `fighting` index. ```js -assert.match(goFight.toString(), /monsters\[fighting\]/); +assert.match(goFight.toString(), /monsters\s*\[\s*fighting\s*\]/); ``` You should assign the value of `monsters[fighting]` to the `monsterHealth` variable. ```js -assert.match(goFight.toString(), /monsterHealth\s*=\s*monsters\[fighting\](\.health|\[('|")health\2\])/); +assert.match(goFight.toString(), /monsterHealth\s*=\s*monsters\s*\[\s*fighting\s*\]\s*(\.health|\[\s*('|")health\2\s*\])/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e24c673b075317cc0b09.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e24c673b075317cc0b09.md index c31375e84d4..95754b15eba 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e24c673b075317cc0b09.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e24c673b075317cc0b09.md @@ -1,18 +1,25 @@ --- id: 62a8e24c673b075317cc0b09 -title: الخطوة 116 +title: Step 115 challengeType: 0 -dashedName: step-116 +dashedName: step-115 --- # --description-- -The HTML element that shows the monster's stats has been hidden with CSS. Display the `monsterStats` element by updating the `display` property of the `style` property to `block`. For example, updating the `first` property of the `name` property of `user` would look like: +By default, the HTML element that shows the monster's stats has been hidden with CSS. When the player clicks the "Fight dragon" button, the monster's stats should be displayed. You can accomplish this by using the style and display properties on the `monsterStats` element. + +The `style` property is used to access the inline style of an element and the `display` property is used to set the visibility of an element. + +Here is an example of how to update the display for a paragraph element: ```js -user.name.first = "Naomi"; +const paragraph = document.querySelector('p'); +paragraph.style.display = 'block'; ``` +Display the `monsterStats` element by updating the `display` property of the `style` property to `block`. + # --hints-- You should use dot notation to access the `style` property of `monsterStats`. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e271f8e3d1541f9624ad.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e271f8e3d1541f9624ad.md index aa2108ff6bd..8629818b67e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e271f8e3d1541f9624ad.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e271f8e3d1541f9624ad.md @@ -1,13 +1,15 @@ --- id: 62a8e271f8e3d1541f9624ad -title: الخطوة 117 +title: Step 116 challengeType: 0 -dashedName: step-117 +dashedName: step-116 --- # --description-- -Now, set the `innerText` property of `monsterName` to be the `name` property of the current monster. Do the same for `monsterHealthText` and the `health` property. +Now, you will need to update the text for the current monster's name and health. + +Start by assigning `monsters[fighting].name` to the `innerText` property of `monsterName`. Then, assign `monsterHealth` to the `innerText` property of `monsterHealthText`. # --hints-- @@ -17,10 +19,10 @@ You should use dot notation to access the `innerText` property of `monsterName`. assert.match(goFight.toString(), /monsterName\.innerText/); ``` -You should set the `innerText` property of `monsterName` to be the `name` value of the current monster. Remember that you can get the current monster with `monsters[fighting]`. +You should assign `monsters[fighting].name` to `monsterName.innerText`. ```js -assert.match(goFight.toString(), /monsterName\.innerText\s*=\s*monsters\[fighting\]\.name/); +assert.match(goFight.toString(), /monsterName\.innerText\s*=\s*monsters\s*\[\s*fighting\s*\]\s*\.name/); ``` You should use dot notation to access the `innerText` property of `monsterHealthText`. @@ -29,10 +31,10 @@ You should use dot notation to access the `innerText` property of `monsterHealth assert.match(goFight.toString(), /monsterHealthText\.innerText/); ``` -You should set the `innerText` property of `monsterHealthText` to be the `health` value of the current monster. You can get the current monster with `monsters[fighting]` or you can access this value using the `monsterHealth` variable that you previously assigned. +You should assign `monsterHealth` to `monsterHealthText.innerText`. ```js -assert.match(goFight.toString(), /monsterHealthText\.innerText\s*=\s*monsterHealth|monsterHealthText\.innerText\s*=\s*monsters\[fighting\]\.health/); +assert.match(goFight.toString(), /monsterHealthText\.innerText\s*=\s*monsterHealth|monsterHealthText\.innerText\s*=\s*monsters\s*\[\s*fighting\s*\]\s*\.health/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e35675c18c56354c08cf.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e35675c18c56354c08cf.md index 487cadd6a64..51e16a3cb86 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e35675c18c56354c08cf.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e35675c18c56354c08cf.md @@ -1,13 +1,13 @@ --- id: 62a8e35675c18c56354c08cf -title: الخطوة 118 +title: Step 117 challengeType: 0 -dashedName: step-118 +dashedName: step-117 --- # --description-- -Now you can build the `attack` function. First, update the `text` message to say `The attacks.`, replacing `` with the name of the monster. Remember you can use the concatenation operator for this. +Now you can build the `attack` function. First, update the `text` message to say `"The attacks."`, replacing `` with the name of the monster. Remember you can use the concatenation operator for this. # --hints-- @@ -26,13 +26,13 @@ assert.match(attack.toString(), /text\.innerText\s*=\s*('|")The \1/); You should use the concatenation operator to add the value of `monsters[fighting].name` to the `The` string. ```js -assert.match(attack.toString(), /text\.innerText\s*=\s*('|")The \1\s*\+\s*monsters\[fighting\]\.name/); +assert.match(attack.toString(), /text\.innerText\s*=\s*('|")The \1\s*\+\s*monsters\s*\[\s*fighting\s*\]\s*\.name/); ``` You should use the concatenation operator to add the string `attacks.` to the `monsters[fighting].name` string. ```js -assert.match(attack.toString(), /text\.innerText\s*=\s*('|")The \1\s*\+\s*monsters\[fighting\]\.name\s*\+\s*('|") attacks\.\2/); +assert.match(attack.toString(), /text\.innerText\s*=\s*('|")The \1\s*\+\s*monsters\s*\[\s*fighting\s*\]\s*\.name\s*\+\s*('|") attacks\.\2/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e41e2f190c58404dd46e.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e41e2f190c58404dd46e.md index c9653b798ca..e062f34ae25 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e41e2f190c58404dd46e.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e41e2f190c58404dd46e.md @@ -1,13 +1,13 @@ --- id: 62a8e41e2f190c58404dd46e -title: Step 119 +title: Step 118 challengeType: 0 -dashedName: step-119 +dashedName: step-118 --- # --description-- -On a new line, add the string `You attack it with your .` to the `text` value, replacing `` with the player's current weapon. +On a new line, use the addition assignment operator(`+=`), to add the string `" You attack it with your ."` to the `text` value, replacing `` with the player's current weapon. Additionally, remember that this line of text starts with a space so it will properly display. # --hints-- @@ -24,7 +24,7 @@ You should use compound assignment with `text.innerText`. assert.match(attack.toString(), /text\.innerText\s*\+=/); ``` -You should add the string `You attack it with your` to the `text.innerText` value. Remember that spacing matters. +You should add the string `" You attack it with your "` to the `text.innerText` value. Remember that spacing matters. ```js assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1/); @@ -33,13 +33,13 @@ assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it wit You should use the concatenation operator to add the current weapon to the string. You can get the current weapon with `weapons[currentWeapon].name`. ```js -assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1\s*\+\s*weapons\[currentWeapon\]\.name/); +assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1\s*\+\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.name/); ``` -You should use the concatenation operator to end your string with `.`. +You should use the concatenation operator to end your string with `"."`. ```js -assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1\s*\+\s*weapons\[currentWeapon\]\.name\s*\+\s*('|")\.\2/); +assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|") You attack it with your \1\s*\+\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.name\s*\+\s*('|")\.\2/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e45cc600c3591cee671a.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e45cc600c3591cee671a.md index b361327a46e..689a350b599 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e45cc600c3591cee671a.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e45cc600c3591cee671a.md @@ -1,8 +1,8 @@ --- id: 62a8e45cc600c3591cee671a -title: Step 120 +title: Step 119 challengeType: 0 -dashedName: step-120 +dashedName: step-119 --- # --description-- @@ -20,7 +20,7 @@ assert.match(attack.toString(), /health\s*-=/); You should subtract the monster's current level from `health`. ```js -assert.match(attack.toString(), /health\s*-=\s*monsters\[fighting\]\.level/); +assert.match(attack.toString(), /health\s*-=\s*monsters\s*\[\s*fighting\s*\]\s*\.level/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e49f4df7af5ae2d7a616.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e49f4df7af5ae2d7a616.md index edbe68894a5..ac76865ed0a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e49f4df7af5ae2d7a616.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e49f4df7af5ae2d7a616.md @@ -1,13 +1,15 @@ --- id: 62a8e49f4df7af5ae2d7a616 -title: Step 121 +title: Step 120 challengeType: 0 -dashedName: step-121 +dashedName: step-120 --- # --description-- -Set `monsterHealth` to `monsterHealth` minus the power of the player's current weapon. Remember you have the `currentWeapon` variable and the `power` property. +Set `monsterHealth` to `monsterHealth` minus the power of the player's current weapon. + +Remember that you can access the power of the player's current weapon using `weapons[currentWeapon].power`. # --hints-- @@ -20,19 +22,19 @@ assert.match(attack.toString(), /monsterHealth\s*-=/); You should use bracket notation with `currentWeapon` to access `weapons`. ```js -assert.match(attack.toString(), /weapons\[currentWeapon\]/); +assert.match(attack.toString(), /weapons\s*\[\s*currentWeapon\s*\]/); ``` You should use dot notation to access the `power` property of `weapons[currentWeapon]`. ```js -assert.match(attack.toString(), /weapons\[currentWeapon\]\.power/); +assert.match(attack.toString(), /weapons\s*\[\s*currentWeapon\s*\]\s*\.power/); ``` You should subtract the `power` of the current weapon from `monsterHealth`. ```js -assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power/); +assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.power/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e4dc6a60f85bf256a0cb.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e4dc6a60f85bf256a0cb.md index 7052a0ec1ea..01b05467403 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e4dc6a60f85bf256a0cb.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e4dc6a60f85bf256a0cb.md @@ -1,15 +1,15 @@ --- id: 62a8e4dc6a60f85bf256a0cb -title: Step 122 +title: Step 121 challengeType: 0 -dashedName: step-122 +dashedName: step-121 --- # --description-- The `Math` object in JavaScript contains static properties and methods for mathematical constants and functions. One of those is `Math.random()`, which generates a random number from `0` (inclusive) to `1` (exclusive). Another is `Math.floor()`, which rounds a given number down to the nearest integer. -Using these, you can generate a random number within a range. For example, this generates a random number between 1 and 5: `Math.floor(Math.random() * 5) + 1;`. +Using these, you can generate a random number within a range. For example, this generates a random number between `1` and `5`: `Math.floor(Math.random() * 5) + 1;`. Following this pattern, use the addition operator (`+`) to add a random number between `1` and the value of `xp` to your `monsterHealth -= weapons[currentWeapon].power`. @@ -24,7 +24,7 @@ assert.lengthOf(attack.toString().match(/monsterHealth/g), 1); You should add to the `weapons[currentWeapon].power` value. ```js -assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power\s*\+/); +assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.power\s*\+/); ``` You should use `Math.floor()`. @@ -42,25 +42,25 @@ assert.match(attack.toString(), /Math\.random/); You should multiply `Math.random()` by the value of `xp`. ```js -assert.match(attack.toString(), /Math\.random\(\)\s*\*\s*xp/); +assert.match(attack.toString(), /Math\.random\(\s*\)\s*\*\s*xp/); ``` You should use `Math.floor()` to round the result of `Math.random() * xp` down. ```js -assert.match(attack.toString(), /Math\.floor\(\s*Math\.random\(\)\s*\*\s*xp\s*.*\)/); +assert.match(attack.toString(), /Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*.*\)/); ``` You should add `1` to the result of `Math.floor()`. ```js -assert.match(attack.toString(), /Math\.floor\(Math\.random\(\)\s*\*\s*xp(?:\s*\+\s*1)?\)(?:\s*\+ 1)?/); +assert.match(attack.toString(), /Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp(?:\s*\+\s*1)?\s*\)(?:\s*\+ 1)?/); ``` You should add the result of `Math.floor(Math.random() * xp) + 1` to the result of `weapons[currentWeapon].power`. ```js -assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power\s*\+\s*Math\.floor\(Math\.random\(\)\s*\*\s*xp(?:\s*\+\s*1)?\)(?:\s*\+ 1)?/); +assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp(?:\s*\+\s*1)?\s*\)(?:\s*\+ 1)?/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ed36d7a7915dfa444ba2.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ed36d7a7915dfa444ba2.md index d07c342c9ed..4931f15d514 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ed36d7a7915dfa444ba2.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ed36d7a7915dfa444ba2.md @@ -1,8 +1,8 @@ --- id: 62a8ed36d7a7915dfa444ba2 -title: Step 123 +title: Step 122 challengeType: 0 -dashedName: step-123 +dashedName: step-122 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8edd05e27cc668051686f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8edd05e27cc668051686f.md index 184411b324c..60667347322 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8edd05e27cc668051686f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8edd05e27cc668051686f.md @@ -1,8 +1,8 @@ --- id: 62a8edd05e27cc668051686f -title: Step 124 +title: Step 123 challengeType: 0 -dashedName: step-124 +dashedName: step-123 --- # --description-- @@ -20,13 +20,13 @@ assert.match(attack.toString(), /if/); Your `if` statement should check if `health` is less than or equal to `0`. ```js -assert.match(attack.toString(), /if\s*\(health\s*<=\s*0\)/); +assert.match(attack.toString(), /if\s*\(\s*health\s*<=\s*0\s*\)/); ``` Your `if` statement should call the `lose` function. ```js -assert.match(attack.toString(), /lose\(\)/); +assert.match(attack.toString(), /lose\(\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee154c8946678775c4a4.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee154c8946678775c4a4.md index af64a47f516..881f91fdb2f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee154c8946678775c4a4.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee154c8946678775c4a4.md @@ -1,8 +1,8 @@ --- id: 62a8ee154c8946678775c4a4 -title: Step 125 +title: Step 124 challengeType: 0 -dashedName: step-125 +dashedName: step-124 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee71f018e968a056d369.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee71f018e968a056d369.md index 6bbfbde991a..2929ee44bf5 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee71f018e968a056d369.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ee71f018e968a056d369.md @@ -1,8 +1,8 @@ --- id: 62a8ee71f018e968a056d369 -title: Step 126 +title: Step 125 challengeType: 0 -dashedName: step-126 +dashedName: step-125 --- # --description-- @@ -20,7 +20,7 @@ assert.match(code, /function\s+defeatMonster/); `defeatMonster` should be an empty function. ```js -assert.match(defeatMonster.toString(), /defeatMonster\s*\(\)\s*\{\s*\}/); +assert.match(defeatMonster.toString(), /defeatMonster\s*\(\s*\)\s*\{\s*\}/); ``` You should use the `function` keyword to declare `lose`. @@ -32,7 +32,7 @@ assert.match(code, /function\s+lose/); `lose` should be an empty function. ```js -assert.match(lose.toString(), /lose\s*\(\)\s*\{\s*\}/); +assert.match(lose.toString(), /lose\s*\(\s*\)\s*\{\s*\}/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eec45f77bc69e8775294.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eec45f77bc69e8775294.md index 477c4f7710e..f8f57306b03 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eec45f77bc69e8775294.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eec45f77bc69e8775294.md @@ -1,17 +1,17 @@ --- id: 62a8eec45f77bc69e8775294 -title: Step 127 +title: Step 126 challengeType: 0 -dashedName: step-127 +dashedName: step-126 --- # --description-- -Inside the `dodge` function, set `text.innerText` equal to the string `You dodge the attack from the `. Replace `` with the name of the monster, using the `name` property. +Inside the `dodge` function, set `text.innerText` equal to the string `"You dodge the attack from the "`. Replace `` with the name of the monster, using the `name` property. # --hints-- -You should assign the string `You dodge the attack from the` to the `text.innerText` property. Remember that spacing matters. +You should assign the string `"You dodge the attack from the "` to the `text.innerText` property. Remember that spacing matters. ```js assert.match(dodge.toString(), /text\.innerText\s*=\s*('|")You dodge the attack from the \1/); @@ -20,7 +20,7 @@ assert.match(dodge.toString(), /text\.innerText\s*=\s*('|")You dodge the attack You should use the concatenation operator to add the name of the monster to the end of the string. You can get this with `monsters[fighting].name`. ```js -assert.match(dodge.toString(), /text\.innerText\s*=\s*('|")You dodge the attack from the \1\s*\+\s*monsters\[fighting\]\.name/); +assert.match(dodge.toString(), /text\.innerText\s*=\s*('|")You dodge the attack from the \1\s*\+\s*monsters\s*\[\s*fighting\s*\]\s*\.name/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eefe2e68b66ac563816b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eefe2e68b66ac563816b.md index 06490d9093e..e32d3bd0439 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eefe2e68b66ac563816b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eefe2e68b66ac563816b.md @@ -1,13 +1,13 @@ --- id: 62a8eefe2e68b66ac563816b -title: Step 128 +title: Step 127 challengeType: 0 -dashedName: step-128 +dashedName: step-127 --- # --description-- -In your `defeatMonster` function, set `gold` equal to `gold` plus the monster's level times `6.7`. You can get the monster's level with the `level` property. +In your `defeatMonster` function, set `gold` equal to `gold` plus the monster's level times `6.7`. Remember you can get the monster's level by using `monsters[fighting].level`. Here is an example of setting `num` to `num` plus `5` * `8`: `num += 5 * 8`. Use `Math.floor()` to round the result down. @@ -22,13 +22,13 @@ assert.match(defeatMonster.toString(), /gold\s*\+=/); You should use `Math.floor()` to round the result of the monster's level times `6.7`. ```js -assert.match(defeatMonster.toString(), /(Math\.floor\(\s*monsters\[fighting\]\.level\s*\*\s*6\.7\s*\))|(Math\.floor\(\s*6\.7\s*\*\s*monsters\[fighting\]\.level\s*\))/); +assert.match(defeatMonster.toString(), /(Math\.floor\(\s*monsters\s*\[\s*fighting\s*\]\s*\.level\s*\*\s*6\.7\s*\))|(Math\.floor\(\s*6\.7\s*\*\s*monsters\s*\[\s*fighting\s*\]\s*\.level\s*\))/); ``` You should add the result of `Math.floor(monsters[fighting].level * 6.7)` to `gold`. ```js -assert.match(defeatMonster.toString(), /gold\s*\+=\s*(Math\.floor\(\s*monsters\[fighting\]\.level\s*\*\s*6\.7\s*\))|(Math\.floor\(\s*6\.7\s*\*\s*monsters\[fighting\]\.level\s*\))/); +assert.match(defeatMonster.toString(), /gold\s*\+=\s*((Math\.floor\(\s*monsters\s*\[\s*fighting\s*\]\s*\.level\s*\*\s*6\.7\s*\))|(Math\.floor\(\s*6\.7\s*\*\s*monsters\s*\[\s*fighting\s*\]\s*\.level\s*\)))/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef6a52292f6bdca4f6f8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef6a52292f6bdca4f6f8.md index 3301aa6246b..a23344528d5 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef6a52292f6bdca4f6f8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef6a52292f6bdca4f6f8.md @@ -1,8 +1,8 @@ --- id: 62a8ef6a52292f6bdca4f6f8 -title: Step 129 +title: Step 128 challengeType: 0 -dashedName: step-129 +dashedName: step-128 --- # --description-- @@ -20,7 +20,7 @@ assert.match(defeatMonster.toString(), /xp\s*\+=/); You should add the monster's level to `xp`. ```js -assert.match(defeatMonster.toString(), /xp\s*\+=\s*monsters\[fighting\]\.level/); +assert.match(defeatMonster.toString(), /xp\s*\+=\s*monsters\s*\[\s*fighting\s*\]\s*\.level/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef8f0c76a46cd221a68c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef8f0c76a46cd221a68c.md index 1170568e396..d573e966cac 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef8f0c76a46cd221a68c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8ef8f0c76a46cd221a68c.md @@ -1,8 +1,8 @@ --- id: 62a8ef8f0c76a46cd221a68c -title: Step 130 +title: Step 129 challengeType: 0 -dashedName: step-130 +dashedName: step-129 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8efb0e3ce826db8daf80f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8efb0e3ce826db8daf80f.md index fd123524213..4a948c96439 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8efb0e3ce826db8daf80f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8efb0e3ce826db8daf80f.md @@ -1,8 +1,8 @@ --- id: 62a8efb0e3ce826db8daf80f -title: Step 131 +title: Step 130 challengeType: 0 -dashedName: step-131 +dashedName: step-130 --- # --description-- @@ -20,7 +20,7 @@ assert.match(defeatMonster.toString(), /update/); You should pass `locations[4]` as the argument. ```js -assert.match(defeatMonster.toString(), /update\(locations\[4\]\)/); +assert.match(defeatMonster.toString(), /update\(\s*locations\s*\[\s*4\s*\]\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eff21c0b0f6ebe5b8e38.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eff21c0b0f6ebe5b8e38.md index db2c7c81425..76fd64bb570 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eff21c0b0f6ebe5b8e38.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8eff21c0b0f6ebe5b8e38.md @@ -1,15 +1,15 @@ --- id: 62a8eff21c0b0f6ebe5b8e38 -title: Step 132 +title: Step 131 challengeType: 0 -dashedName: step-132 +dashedName: step-131 --- # --description-- Your `locations` array doesn't have a fifth element, so `locations[4]` doesn't work. -Add a new object at the end of the `locations` array, following the same structure as the other objects. Set `name` to `kill monster`, set `button text` to an array with three `Go to town square` strings, set `button functions` to an array with three `goTown` variables, and set `text` to `The monster screams Arg! as it dies. You gain experience points and find gold.`. +Add a new object at the end of the `locations` array, following the same structure as the other objects. Set `name` to `"kill monster"`, set `"button text"` to an array with three `"Go to town square"` strings, set `"button functions"` to an array with three `goTown` variables, and set `text` to `"The monster screams Arg! as it dies. You gain experience points and find gold."`. # --hints-- @@ -25,25 +25,25 @@ Your fifth `locations` value should be an object. assert.isObject(locations[4]); ``` -Your fifth `locations` value should have a `name` property with the value `kill monster`. +Your fifth `locations` value should have a `name` property with the value `"kill monster"`. ```js assert.equal(locations[4].name, 'kill monster'); ``` -Your fifth `locations` value should have a `button text` array with three `Go to town square` strings. +Your fifth `locations` value should have a `"button text"` array with three `"Go to town square"` strings. ```js assert.deepEqual(locations[4]["button text"], ['Go to town square', 'Go to town square', 'Go to town square']); ``` -Your fifth `locations` value should have a `button functions` array with three `goTown` variables. +Your fifth `locations` value should have a `"button functions"` array with three `goTown` variables. ```js assert.deepEqual(locations[4]["button functions"], [goTown, goTown, goTown]); ``` -Your fifth `locations` value should have a `text` property with the value `The monster screams Arg! as it dies. You gain experience points and find gold.`. +Your fifth `locations` value should have a `text` property with the value `"The monster screams Arg! as it dies. You gain experience points and find gold."`. ```js assert.equal(locations[4].text, 'The monster screams Arg! as it dies. You gain experience points and find gold.'); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f06fb318666fef69f91e.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f06fb318666fef69f91e.md index 6209dc3d35d..42320970f45 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f06fb318666fef69f91e.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f06fb318666fef69f91e.md @@ -1,15 +1,15 @@ --- id: 62a8f06fb318666fef69f91e -title: Step 133 +title: Step 132 challengeType: 0 -dashedName: step-133 +dashedName: step-132 --- # --description-- -The word `Arg!` should have quotes around it. Besides escaping quotes, there is another way you can include quotation marks inside a string. +The word `"Arg!"` should have quotes around it. Besides escaping quotes, there is another way you can include quotation marks inside a string. -Change the double quotes around the string `The monster screams Arg! as it dies. You gain experience points and find gold.` to single quotes `'`, then add double quotes around `Arg!`. +Change the double quotes around the string `"The monster screams Arg! as it dies. You gain experience points and find gold."` to single quotes `'`, then add double quotes around `"Arg!"`. # --hints-- @@ -19,7 +19,7 @@ You should use single quotes around the string. assert.match(code, /'The monster screams "?Arg!"? as it dies. You gain experience points and find gold.'/); ``` -You should use double quotes around `Arg!`. +You should use double quotes around `"Arg!"`. ```js assert.equal(locations[4].text, 'The monster screams "Arg!" as it dies. You gain experience points and find gold.'); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f14fe6d1fc72454648c7.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f14fe6d1fc72454648c7.md index d3d163e5feb..9137e403c0b 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f14fe6d1fc72454648c7.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f14fe6d1fc72454648c7.md @@ -1,8 +1,8 @@ --- id: 62a8f14fe6d1fc72454648c7 -title: Step 134 +title: Step 133 challengeType: 0 -dashedName: step-134 +dashedName: step-133 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f1d5f5ddbf74c07f733b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f1d5f5ddbf74c07f733b.md index 27cfddf7384..9d984dbb5a9 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f1d5f5ddbf74c07f733b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f1d5f5ddbf74c07f733b.md @@ -1,8 +1,8 @@ --- id: 62a8f1d5f5ddbf74c07f733b -title: Step 135 +title: Step 134 challengeType: 0 -dashedName: step-135 +dashedName: step-134 --- # --description-- @@ -20,7 +20,7 @@ assert.match(lose.toString(), /update\(/); Your `update` function should have `locations[5]` for the argument. ```js -assert.match(lose.toString(), /update\(locations\[5\]\)/); +assert.match(lose.toString(), /update\(\s*locations\s*\[\s*5\s*\]\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f20463b324759953edad.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f20463b324759953edad.md index 9947c835faa..a4d22989a7e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f20463b324759953edad.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f20463b324759953edad.md @@ -1,8 +1,8 @@ --- id: 62a8f20463b324759953edad -title: Step 136 +title: Step 135 challengeType: 0 -dashedName: step-136 +dashedName: step-135 --- # --description-- @@ -45,7 +45,7 @@ Your `restart` function should set `currentWeapon` to `0`. assert.match(restart.toString(), /currentWeapon\s*=\s*0/); ``` -Your `restart` function should set `inventory` to an array with the string `stick`. +Your `restart` function should set `inventory` to an array with the string `"stick"`. ```js assert.match(restart.toString(), /inventory\s*=\s*\[\s*('|")stick\1\s*\]/); @@ -54,7 +54,7 @@ assert.match(restart.toString(), /inventory\s*=\s*\[\s*('|")stick\1\s*\]/); Your `restart` function should call the `goTown()` function. ```js -assert.match(restart.toString(), /goTown\(\)/); +assert.match(restart.toString(), /goTown\(\s*\)/); ``` You should set `goldText.innerText` to the value of `gold`. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f256b813a476cae51f49.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f256b813a476cae51f49.md index 35c1b321145..6e05e05b776 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f256b813a476cae51f49.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f256b813a476cae51f49.md @@ -1,8 +1,8 @@ --- id: 62a8f256b813a476cae51f49 -title: Step 138 +title: Step 137 challengeType: 0 -dashedName: step-138 +dashedName: step-137 --- # --description-- @@ -41,7 +41,7 @@ You should call the `winGame` function in your `if` block. ```js const block = attack.toString().split("else if"); -assert.match(block[1], /if\s*\(\s*fighting\s*===\s*2\s*\)\s*(\{\s*)?winGame\(\)(\s*\})?/); +assert.match(block[1], /if\s*\(\s*fighting\s*===\s*2\s*\)\s*(\{\s*)?winGame\(\s*\)(\s*\})?/); ``` You should add an `else` block. @@ -55,7 +55,7 @@ Your `else` block should call the `defeatMonster` function. ```js const block = attack.toString().split("else if"); -assert.match(block[1], /else\s*(\{\s*)?defeatMonster\(\)(\s*\})?/); +assert.match(block[1], /else\s*(\{\s*)?defeatMonster\(\s*\)(\s*\})?/); ``` # --seed-- @@ -220,7 +220,7 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" } ]; diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f35bde1750791f58773f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f35bde1750791f58773f.md index 095200ed56e..a43ddc6b3af 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f35bde1750791f58773f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8f35bde1750791f58773f.md @@ -20,7 +20,7 @@ assert.match(code, /function\s+winGame/); Your `winGame` function should call the `update` function and pass in `locations[6]`. ```js -assert.match(winGame.toString(), /update\s*\(\s*locations\[6\]\s*\)/); +assert.match(winGame.toString(), /update\s*\(\s*locations\s*\[\s*6\s*\]\s*\)/); ``` # --seed-- @@ -185,7 +185,7 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" } ]; @@ -202,7 +202,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a94114ce0b8918b487390f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a94114ce0b8918b487390f.md index b70c74ede29..f2b63a0893c 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a94114ce0b8918b487390f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a94114ce0b8918b487390f.md @@ -7,7 +7,7 @@ dashedName: step-140 # --description-- -Add another object in the `locations` array. Everything should be the same as the `lose` object, except the `name` should be `win` and the `text` should be `You defeat the dragon! YOU WIN THE GAME! 🎉`. +Add another object in the `locations` array. Everything should be the same as the `lose` object, except the `name` should be `"win"` and the `text` should be `"You defeat the dragon! YOU WIN THE GAME! 🎉"`. # --hints-- @@ -23,13 +23,13 @@ Your seventh `locations` value should be an object. assert.isObject(locations[6]); ``` -Your seventh `locations` value should have a `name` property with the value `win`. +Your seventh `locations` value should have a `name` property with the value `"win"`. ```js assert.equal(locations[6].name, 'win'); ``` -Your seventh `locations` value should have a `button text` array with three `REPLAY?` strings. +Your seventh `locations` value should have a `button text` array with three `"REPLAY?"` strings. ```js assert.deepEqual(locations[6]["button text"], ['REPLAY?', 'REPLAY?', 'REPLAY?']); @@ -41,10 +41,10 @@ Your seventh `locations` value should have a `button functions` array with three assert.deepEqual(locations[6]["button functions"], [restart, restart, restart]); ``` -Your seventh `locations` value should have a `text` property with the value `You defeat the dragon! YOU WIN THE GAME! 🎉`. +Your seventh `locations` value should have a `text` property with the value `"You defeat the dragon! YOU WIN THE GAME! 🎉"`. ```js -assert.equal(locations[6].text, 'You defeat the dragon! YOU WIN THE GAME! 🎉'); +assert.equal(locations[6].text, 'You defeat the dragon! YOU WIN THE GAME! 🎉'); ``` # --seed-- @@ -210,7 +210,7 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" } --fcc-editable-region-- ]; @@ -228,7 +228,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1cea594f152ba626b872.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1cea594f152ba626b872.md index 8214d5dbf0f..b7bad4b4074 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1cea594f152ba626b872.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1cea594f152ba626b872.md @@ -16,7 +16,7 @@ Inside your `attack` function, change your `health -= monsters[fighting].level;` You should update your `health` line to be `health -= getMonsterAttackValue(monsters[fighting].level);`. ```js -assert.match(attack.toString(), /health\s*-=\s*getMonsterAttackValue\(monsters\[fighting\]\.level\)/); +assert.match(attack.toString(), /health\s*-=\s*getMonsterAttackValue\(\s*monsters\s*\[\s*fighting\s*\]\s*\.level\s*\)/); ``` # --seed-- @@ -181,13 +181,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -204,7 +204,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d6736ba262cfa74344b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d6736ba262cfa74344b.md index 73b31c2143e..f55432b2c36 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d6736ba262cfa74344b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d6736ba262cfa74344b.md @@ -185,13 +185,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -208,7 +208,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d9f535e102e4663e7a6.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d9f535e102e4663e7a6.md index a0adfe98005..94bef351fd7 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d9f535e102e4663e7a6.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1d9f535e102e4663e7a6.md @@ -22,13 +22,13 @@ assert.match(code, /const\s+hit/); You should use the equation `(level * 5) - (Math.floor(Math.random() * xp))`. ```js -assert.match(getMonsterAttackValue, /(level\s*\*\s*5)\s*-\s*(Math\.floor\(Math\.random\(\)\s*\*\s*xp\))/); +assert.match(getMonsterAttackValue, /(level\s*\*\s*5)\s*-\s*(Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*\))/); ``` You should set `hit` to the value of `(level * 5) - (Math.floor(Math.random() * xp))`. ```js -assert.match(code, /hit\s*=\s*\(level\s*\*\s*5\)\s*-\s*\(Math\.floor\(Math\.random\(\)\s*\*\s*xp\)\)/); +assert.match(code, /hit\s*=\s*\(\s*level\s*\*\s*5\s*\)\s*-\s*\(\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*\)\s*\)/); ``` # --seed-- @@ -193,13 +193,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -216,7 +216,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e3c7c3d552fb04f0f18.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e3c7c3d552fb04f0f18.md index 42231b65d84..1ac1b564f17 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e3c7c3d552fb04f0f18.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e3c7c3d552fb04f0f18.md @@ -179,13 +179,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -202,7 +202,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e8ccd579330e097ce44.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e8ccd579330e097ce44.md index 095532194d9..4258cf8fd54 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e8ccd579330e097ce44.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1e8ccd579330e097ce44.md @@ -188,13 +188,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -211,7 +211,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1eec891ed731db227a36.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1eec891ed731db227a36.md index df43e068822..52b90e06276 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1eec891ed731db227a36.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1eec891ed731db227a36.md @@ -207,13 +207,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -230,7 +230,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md index 86b76032640..351dab64559 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa1fed3d4e873366ff3131.md @@ -179,13 +179,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -202,7 +202,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa204c1e1d33348ff09944.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa204c1e1d33348ff09944.md index c06fa522511..8ac903940a1 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa204c1e1d33348ff09944.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa204c1e1d33348ff09944.md @@ -14,7 +14,7 @@ Move your `monsterHealth` assignment into your `if` block. You should move your `monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1` into your `if` block. ```js -assert.match(attack.toString(), /if\s*\(isMonsterHit\(\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power\s*\+\s*Math\.floor\(Math\.random\(\)\s*\*\s*xp\)\s*\+\s*1/) +assert.match(attack.toString(), /if\s*\(\s*isMonsterHit\(\s*\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*\)\s*\+\s*1/) ``` # --seed-- @@ -179,13 +179,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -202,7 +202,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa20e9cf1be9358f5aceae.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa20e9cf1be9358f5aceae.md index ec8229acffd..0f1429cf2ad 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa20e9cf1be9358f5aceae.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa20e9cf1be9358f5aceae.md @@ -7,20 +7,20 @@ dashedName: step-149 # --description-- -Add an `else` statement to the first `if` statement inside your `attack()` function. In the `else` statement, use the `+=` operator to add the text `You miss.` to the end of `text.innerText`. +Add an `else` statement to the first `if` statement inside your `attack()` function. In the `else` statement, use the `+=` operator to add the text `" You miss."` to the end of `text.innerText`. # --hints-- You should add an `else` block after your `if (isMonsterHit())` block. ```js -assert.match(attack.toString(), /if\s*\(isMonsterHit\(\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power\s*\+\s*Math\.floor\(Math\.random\(\)\s*\*\s*xp\)\s*\+\s*1;\s*\}\s*else/) +assert.match(attack.toString(), /if\s*\(\s*isMonsterHit\(\s*\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*\)\s*\+\s*1;\s*\}\s*else/) ``` -You should add the text `You miss.` to the end of `text.innerText`. Remember to use compound assignment and make sure there is a space before the word `You`. +You should add the text `" You miss."` to the end of `text.innerText`. Remember to use compound assignment and make sure there is a space before the word `You`. ```js -assert.match(attack.toString(), /if\s*\(isMonsterHit\(\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\[currentWeapon\]\.power\s*\+\s*Math\.floor\(Math\.random\(\)\s*\*\s*xp\)\s*\+\s*1;\s*\}\s*else\s*\{\s*text\.innerText\s*\+=\s*('|")\sYou miss\.\1/) +assert.match(attack.toString(), /if\s*\(\s*isMonsterHit\(\s*\)\s*\)\s*\{\s*monsterHealth\s*-=\s*weapons\s*\[\s*currentWeapon\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*\)\s*\+\s*1;\s*\}\s*else\s*\{\s*text\.innerText\s*\+=\s*('|")\sYou miss\.\1/) ``` # --seed-- @@ -185,13 +185,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -208,7 +208,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2136fc49b836dfedb959.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2136fc49b836dfedb959.md index 67dfb73b231..d416bbb7431 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2136fc49b836dfedb959.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2136fc49b836dfedb959.md @@ -20,7 +20,7 @@ assert.match(code, /function\s+isMonsterHit/); Your `isMonsterHit` function should return the result of the comparison `Math.random() > .2`. ```js -assert.match(isMonsterHit.toString(), /return\s+Math\.random\(\)\s*>\s*0?\.2/); +assert.match(isMonsterHit.toString(), /return\s+Math\.random\(\s*\)\s*>\s*0?\.2/); ``` # --seed-- @@ -185,13 +185,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -208,7 +208,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21971e3b743844849985.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21971e3b743844849985.md index b0a0653d893..7784c2d49de 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21971e3b743844849985.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21971e3b743844849985.md @@ -32,7 +32,7 @@ assert.match(isMonsterHit.toString(), /\|\|\s*health\s*<\s*20/); Your function should return the result of the comparison `Math.random() > .2` **or** `health < 20`. ```js -assert.match(isMonsterHit.toString(), /return\s+Math\.random\(\)\s*>\s*0?\.2\s*\|\|\s*health\s*<\s*20/); +assert.match(isMonsterHit.toString(), /return\s+Math\.random\(\s*\)\s*>\s*0?\.2\s*\|\|\s*health\s*<\s*20/); ``` # --seed-- @@ -197,13 +197,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -220,7 +220,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21ea8d9d9f396b95dd87.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21ea8d9d9f396b95dd87.md index 495bec18415..fa6e46189de 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21ea8d9d9f396b95dd87.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa21ea8d9d9f396b95dd87.md @@ -21,7 +21,7 @@ assert.lengthOf(ifs, 5); Your new `if` statement should check `Math.random() <= .1`. ```js -assert.match(attack.toString(), /if\s*\(\s*Math\.random\(\)\s*<=\s*0?\.1\s*\)/); +assert.match(attack.toString(), /if\s*\(\s*Math\.random\(\s*\)\s*<=\s*0?\.1\s*\)/); ``` # --seed-- @@ -186,13 +186,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -209,7 +209,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa226207f33d3ad4c6f546.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa226207f33d3ad4c6f546.md index 9ebf66f29ff..75e7e7fdc67 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa226207f33d3ad4c6f546.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa226207f33d3ad4c6f546.md @@ -7,7 +7,7 @@ dashedName: step-153 # --description-- -Use the `+=` operator to add `Your breaks.`, with a space in front of `Your`, to the end of `text.innerText`. Replace `` with the last item in the `inventory` array using `inventory.pop()`, which will remove the last item in the array AND return it so it appears in your string. +Use the `+=` operator to add `" Your breaks."`, with a space in front of `Your`, to the end of `text.innerText`. Replace `` with the last item in the `inventory` array using `inventory.pop()`, which will remove the last item in the array AND return it so it appears in your string. # --hints-- @@ -21,7 +21,7 @@ assert.lengthOf(concat, 3); You should use the `pop` method on the `inventory` array. ```js -assert.match(attack.toString(), /inventory\.pop\(\)/); +assert.match(attack.toString(), /inventory\.pop\(\s*\)/); ``` You should add `Your`, with a space before and after it, to `text.innerText`. @@ -30,17 +30,16 @@ You should add `Your`, with a space before and after it, to `text.innerText`. assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|")\sYour\s\1/); ``` -You should add the return value of `inventory.pop()` to the `Your` string. +You should add the return value of `inventory.pop()` to the `" Your "` string. ```js -console.log(attack.toString()); -assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|")\sYour\s\1\s*\+\s*inventory\.pop\(\)/); +assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|")\sYour\s\1\s*\+\s*inventory\.pop\(\s*\)/); ``` -You should add `breaks.`, with a space in front of it, to the end of your string. +You should add `" breaks."`, with a space in front of it, to the end of your string. ```js -assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|")\sYour\s\1\s*\+\s*inventory\.pop\(\)\s*\+\s*('|")\sbreaks\.\2/); +assert.match(attack.toString(), /text\.innerText\s*\+=\s*('|")\sYour\s\1\s*\+\s*inventory\.pop\(\s*\)\s*\+\s*('|")\sbreaks\.\2/); ``` # --seed-- @@ -205,13 +204,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -228,7 +227,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa22aba186563bcbf2c395.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa22aba186563bcbf2c395.md index 97d5746c0e6..cb4f98370a3 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa22aba186563bcbf2c395.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa22aba186563bcbf2c395.md @@ -7,7 +7,13 @@ dashedName: step-154 # --description-- -Remember that the increment operator `++` can be used to increase a variable's value by 1. There is also a decrement operator `--` that can be used to decrease a variable's value by 1. +Remember that the increment operator `++` can be used to increase a variable's value by `1`. There is also a decrement operator `--` that can be used to decrease a variable's value by `1`. For example : + +```js +let num = 10; +num--; +console.log(num); // Output: 9 +``` Decrement the value of `currentWeapon` in your `if` statement, after you update the text. @@ -187,13 +193,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -210,7 +216,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa234322d4ad3e8bce42cc.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa234322d4ad3e8bce42cc.md index 81204537ebf..fb08209886d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa234322d4ad3e8bce42cc.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa234322d4ad3e8bce42cc.md @@ -24,19 +24,19 @@ if (firstName === "Quincy" && lastName === "Larson") { You should not modify your existing `if` statement. ```js -assert.match(attack.toString(), /if\s*\(Math\.random\(\)\s*\<=\s*\.1/); +assert.match(attack.toString(), /if\s*\(\s*Math\.random\(\s*\)\s*\<=\s*\.1/); ``` You should use the logical AND operator `&&`. ```js -assert.match(attack.toString(), /if\s*\(Math\.random\(\)\s*\<=\s*\.1\s*&&/); +assert.match(attack.toString(), /if\s*\(\s*Math\.random\(\s*\)\s*\<=\s*\.1\s*&&/); ``` You should use the logical AND operator to check if `inventory.length` does not equal `1`. ```js -assert.match(attack.toString(), /if\s*\(Math\.random\(\)\s*\<=\s*\.1\s*&&\s*inventory\.length\s*\!\=\=\s*1\s*\)/); +assert.match(attack.toString(), /if\s*\(\s*Math\.random\(\s*\)\s*\<=\s*\.1\s*&&\s*inventory\.length\s*\!\=\=\s*1\s*\)/); ``` # --seed-- @@ -201,13 +201,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -224,7 +224,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2469c77b363fdb4f0e06.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2469c77b363fdb4f0e06.md index fe35aa83b6e..3320abac13c 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2469c77b363fdb4f0e06.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2469c77b363fdb4f0e06.md @@ -28,7 +28,7 @@ assert.match(easterEgg.toString(), /update\(/); `easterEgg` should call the `update` function with `locations[7]` as the argument. ```js -assert.match(easterEgg.toString(), /update\(\s*locations\[7\]\s*\)/); +assert.match(easterEgg.toString(), /update\(\s*locations\s*\[\s*7\s*\]\s*\)/); ``` # --seed-- @@ -193,13 +193,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -216,7 +216,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa252c3b1073415ba2b898.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa252c3b1073415ba2b898.md index 151cf4ed2d5..bc5c75fdb1e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa252c3b1073415ba2b898.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa252c3b1073415ba2b898.md @@ -185,13 +185,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -208,7 +208,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa258da314ef42ba0a1858.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa258da314ef42ba0a1858.md index 8ff8ec6621b..c4f60b0792a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa258da314ef42ba0a1858.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa258da314ef42ba0a1858.md @@ -211,13 +211,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" } ]; @@ -234,7 +234,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa25fcb5837d43b4d9873d.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa25fcb5837d43b4d9873d.md index b5755984113..5bcd8e739c0 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa25fcb5837d43b4d9873d.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa25fcb5837d43b4d9873d.md @@ -7,7 +7,7 @@ dashedName: step-159 # --description-- -Add another object to your `locations` array. Set `name` to `easter egg`, set `button text` to an array with the strings `2`, `8`, and `Go to town square?`, set `button functions` to an array with the variables `pickTwo`, `pickEight`, and `goTown`, and `text` to `You find a secret game. Pick a number above. Ten numbers will be randomly chosen between 0 and 10. If the number you choose matches one of the random numbers, you win!`. +Add another object to your `locations` array. Set `name` to `"easter egg"`, set `"button text"` to an array with the strings `"2"`, `"8"`, and `"Go to town square?"`, set `"button functions"` to an array with the variables `pickTwo`, `pickEight`, and `goTown`, and `text` to `"You find a secret game. Pick a number above. Ten numbers will be randomly chosen between 0 and 10. If the number you choose matches one of the random numbers, you win!"`. # --hints-- @@ -23,25 +23,25 @@ Your eighth `locations` value should be an object. assert.isObject(locations[7]); ``` -Your eighth `locations` value should have a `name` property with the value `easter egg`. +Your eighth `locations` value should have a `name` property with the value `"easter egg"`. ```js assert.equal(locations[7].name, "easter egg"); ``` -Your eighth `locations` value should have a `button text` array with the strings `2`, `8`, and `Go to town square?`. +Your eighth `locations` value should have a `"button text"` array with the strings `"2"`, `"8"`, and `"Go to town square?"`. ```js assert.deepEqual(locations[7]["button text"], ["2", "8", "Go to town square?"]); ``` -Your eighth `locations` value should have a `button functions` an array with the variables `pickTwo`, `pickEight`, and `goTown`. +Your eighth `locations` value should have a `"button functions"` an array with the variables `pickTwo`, `pickEight`, and `goTown`. ```js assert.deepEqual(locations[7]["button functions"], [pickTwo, pickEight, goTown]); ``` -Your eighth `locations` value should have a `text` property with the value `You find a secret game. Pick a number above. Ten numbers will be randomly chosen between 0 and 10. If the number you choose matches one of the random numbers, you win!`. +Your eighth `locations` value should have a `text` property with the value `"You find a secret game. Pick a number above. Ten numbers will be randomly chosen between 0 and 10. If the number you choose matches one of the random numbers, you win!"`. ```js assert.equal(locations[7].text, "You find a secret game. Pick a number above. Ten numbers will be randomly chosen between 0 and 10. If the number you choose matches one of the random numbers, you win!"); @@ -209,13 +209,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, --fcc-editable-region-- @@ -235,7 +235,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2626c3c10244b94c787b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2626c3c10244b94c787b.md index 4eb559dc555..144e384890e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2626c3c10244b94c787b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2626c3c10244b94c787b.md @@ -14,7 +14,7 @@ Inside `pick`, use `const` to initialize a variable named `numbers` and set it t Your `pick` function should initialize `numbers` to an empty array `[]`. ```js -assert.match(pick.toString(), /numbers\s*=\s*\[\]/); +assert.match(pick.toString(), /numbers\s*=\s*\[\s*\]/); ``` # --seed-- @@ -179,13 +179,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -208,7 +208,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa264d23cdaa45a20efada.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa264d23cdaa45a20efada.md index adff63df501..690b9c4efd5 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa264d23cdaa45a20efada.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa264d23cdaa45a20efada.md @@ -195,13 +195,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -224,7 +224,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa26cca3cd3d46c431e73b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa26cca3cd3d46c431e73b.md index 63256c6816a..c7319b7da11 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa26cca3cd3d46c431e73b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa26cca3cd3d46c431e73b.md @@ -20,13 +20,13 @@ assert.match(pick.toString(), /numbers\.push\(/); You should use `Math.floor(Math.random() * 11)` to create the random number. ```js -assert.match(pick.toString(), /Math\.floor\(Math\.random\(\)\s*\*\s*11\s*\)/); +assert.match(pick.toString(), /Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*11\s*\)/); ``` You should `push` the result of `Math.floor(Math.random() * 11)` to the end of the `numbers` array. ```js -assert.match(pick.toString(), /numbers\.push\(\s*Math\.floor\(Math\.random\(\)\s*\*\s*11\s*\)\s*\)/); +assert.match(pick.toString(), /numbers\.push\(\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*11\s*\)\s*\)/); ``` # --seed-- @@ -191,13 +191,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -220,7 +220,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27227399d647e1c37a3c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27227399d647e1c37a3c.md index 6f6db396fee..50ee79091f1 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27227399d647e1c37a3c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27227399d647e1c37a3c.md @@ -7,23 +7,23 @@ dashedName: step-163 # --description-- -After the `while` loop, set `text.innerText` to equal `You picked . Here are the random numbers:`. Replace `` with the `guess` function parameter. +After the `while` loop, set `text.innerText` to equal `"You picked . Here are the random numbers:"`. Replace `` with the `guess` function parameter. # --hints-- -You should set `text.innerText` to the string `You picked`. Remember that spacing matters. +You should set `text.innerText` to the string `"You picked "`. Remember that spacing matters. ```js assert.match(pick.toString(), /text\.innerText\s*=\s*('|")You picked \1/); ``` -You should use the concatenation operator to add the value of the `guess` parameter to your `You picked` string. +You should use the concatenation operator to add the value of the `guess` parameter to your `"You picked "` string. ```js assert.match(pick.toString(), /text\.innerText\s*=\s*('|")You picked \1\s*\+\s*guess/); ``` -You should use the concatenation operator to add the string `. Here are the random numbers:` to your `"You picked " + guess` string. +You should use the concatenation operator to add the string `". Here are the random numbers:"` to your `"You picked " + guess` string. ```js assert.match(pick.toString(), /text\.innerText\s*=\s*('|")You picked \1\s*\+\s*guess\s*\+\s*('|")\.\sHere are the random numbers:\2/); @@ -191,13 +191,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -220,7 +220,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27560def7048d7b4a095.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27560def7048d7b4a095.md index 5f4c6ece5c7..b5c0ff67275 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27560def7048d7b4a095.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27560def7048d7b4a095.md @@ -11,7 +11,7 @@ At the end of the string, before the final quote, insert the new line escape cha # --hints-- -You should add the new line escape character `\n` to your `. Here are the random numbers:` string. +You should add the new line escape character `\n` to your `". Here are the random numbers: "` string. ```js assert.match(pick.toString(), /text\.innerText\s*=\s*('|")You picked \1\s*\+\s*guess\s*\+\s*('|")\.\sHere are the random numbers:\\n\2/); @@ -179,13 +179,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -208,7 +208,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27c40ca6f04ab8be5fac.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27c40ca6f04ab8be5fac.md index b1feb5c19e8..4cfce9c5908 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27c40ca6f04ab8be5fac.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa27c40ca6f04ab8be5fac.md @@ -185,13 +185,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -214,7 +214,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28032d863d4bd8058799.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28032d863d4bd8058799.md index 0030e660a57..1f2ce1ffbfa 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28032d863d4bd8058799.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28032d863d4bd8058799.md @@ -11,7 +11,7 @@ dashedName: step-166 The initialization expression is executed only once, before the loop starts, and is often used to define and set up the loop variable. Think of it like declaring a counter to use in your loop. -Many `for` loops use `i` as the counter and start from 0, so change `let x = 1;` to `let i = 0;`. +Many `for` loops use `i` as the counter and start from `0`, so change `let x = 1;` to `let i = 0;`. # --hints-- @@ -183,13 +183,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -212,7 +212,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa287434dc284cea01157c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa287434dc284cea01157c.md index b6b9c8a6121..82b517528b7 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa287434dc284cea01157c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa287434dc284cea01157c.md @@ -9,7 +9,7 @@ dashedName: step-167 The second statement in a `for` loop, the condition statement, is evaluated at the beginning of every loop iteration. The loop will continue as long as the condition evaluates to be true. -We want the loop to run 10 times, so change `x < 5` to `i < 10`. +We want the loop to run `10` times, so change `x < 5` to `i < 10`. # --hints-- @@ -181,13 +181,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -210,7 +210,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28bbd6323e4dfb3ac43e.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28bbd6323e4dfb3ac43e.md index d9ec16a15e7..d87e5e62858 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28bbd6323e4dfb3ac43e.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28bbd6323e4dfb3ac43e.md @@ -181,13 +181,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -210,7 +210,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28fb651bf14efa2dbb16.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28fb651bf14efa2dbb16.md index d7f2dcd44d4..71875c1a0ea 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28fb651bf14efa2dbb16.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa28fb651bf14efa2dbb16.md @@ -20,20 +20,19 @@ assert.match(pick.toString(), /text\.innerText\s*\+=/); You should use bracket notation to access `numbers[i]`. ```js -assert.match(pick.toString(), /numbers\[i\]/); +assert.match(pick.toString(), /numbers\s*\[\s*i\s*\]/); ``` You should add `numbers[i]` to your `text.innerText` value. ```js -assert.match(pick.toString(), /text\.innerText\s*\+=\s*numbers\[i\]/); +assert.match(pick.toString(), /text\.innerText\s*\+=\s*numbers\s*\[\s*i\s*\]/); ``` You should add a new-line character after the `numbers[i]` value. Remember that you can do this with `\n`. ```js -console.log(pick.toString()); -assert.match(pick.toString(), /text\.innerText\s*\+=\s*numbers\[i\]\s*\+\s*('|")\\n\1/); +assert.match(pick.toString(), /text\.innerText\s*\+=\s*numbers\s*\[\s*i\s*\]\s*\+\s*('|")\\n\1/); ``` # --seed-- @@ -198,13 +197,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -227,7 +226,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2943669c9d5026af6985.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2943669c9d5026af6985.md index 04c6da995f6..5d2de454974 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2943669c9d5026af6985.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2943669c9d5026af6985.md @@ -198,13 +198,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -227,7 +227,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md index 8c027fab766..659e9a1e4b1 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2999ec27ec516655eba6.md @@ -7,11 +7,11 @@ dashedName: step-171 # --description-- -Inside the `if` statement, add the string `Right! You win 20 gold!` to the end of `text.innerText`. Also, add `20` to the value of `gold` and update the `goldText.innerText`. +Inside the `if` statement, add the string `"Right! You win 20 gold!"` to the end of `text.innerText`. Also, add `20` to the value of `gold` and update the `goldText.innerText`. # --hints-- -You should use compound assignment to add the string `Right! You win 20 gold!` to the end of `text.innerText`. +You should use compound assignment to add the string `"Right! You win 20 gold!"` to the end of `text.innerText`. ```js assert.match(pick.toString(), /text\.innerText\s*\+=\s*('|")Right! You win 20 gold!\1/); @@ -191,13 +191,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -220,7 +220,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa29d8f8f88152c91350ca.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa29d8f8f88152c91350ca.md index b5fc8597c6d..b0868a55bf0 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa29d8f8f88152c91350ca.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa29d8f8f88152c91350ca.md @@ -7,7 +7,7 @@ dashedName: step-172 # --description-- -Now add an `else` statement. Inside, add `Wrong! You lose 10 health!` to the end of `text.innerText`. Subtract `10` from `health` and update `healthText.innerText`. +Now add an `else` statement. Inside, add `"Wrong! You lose 10 health!"` to the end of `text.innerText`. Subtract `10` from `health` and update `healthText.innerText`. # --hints-- @@ -17,7 +17,7 @@ You should add an `else` block. assert.match(pick.toString(), /else\s*\{/); ``` -Your `else` block should use compound assignment to add `Wrong! You lose 10 health!` to the end of `text.innerText`. +Your `else` block should use compound assignment to add `"Wrong! You lose 10 health!"` to the end of `text.innerText`. ```js assert.match(pick.toString(), /text\.innerText\s*\+=\s*('|")Wrong! You lose 10 health!\1/); @@ -197,13 +197,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -226,7 +226,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md index 5a9af82631f..650fe59ddd1 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2aec2f09d454253aad6c.md @@ -27,7 +27,7 @@ assert.match(pick.toString(), /if\s*\(\s*health\s*<=\s*0\s*\)/); Your `if` statement should call the `lose` function. ```js -assert.match(pick.toString(), /lose\(\)/); +assert.match(pick.toString(), /lose\(\s*\)/); ``` # --seed-- @@ -192,13 +192,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -221,7 +221,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2ba9cd881355a6f0a5a8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2ba9cd881355a6f0a5a8.md index 7bff28bc93a..ebf70ca3d06 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2ba9cd881355a6f0a5a8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62aa2ba9cd881355a6f0a5a8.md @@ -7,13 +7,13 @@ dashedName: step-174 # --description-- -Looking at your `kill monster` object, `button functions` currently has three `goTown` variables. Replace the third one with `easterEgg` - this is how a player will access the hidden feature of the game. Do not change the `button text`. +Looking at your `"kill monster"` object, `"button functions"` currently has three `goTown` variables. Replace the third one with `easterEgg` - this is how a player will access the hidden feature of the game. Do not change the `"button text"`. With this, your RPG game is complete! You can now play around - can you defeat the dragon? # --hints-- -You should update your fifth `locations` object to have a `button functions` property of `[goTown, goTown, easterEgg]`. +You should update your fifth `locations` object to have a `"button functions"` property of `[goTown, goTown, easterEgg]`. ```js assert.deepEqual(locations[4]["button functions"], [goTown, goTown, easterEgg]); @@ -183,13 +183,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", @@ -212,7 +212,7 @@ function update(location) { button1.onclick = location["button functions"][0]; button2.onclick = location["button functions"][1]; button3.onclick = location["button functions"][2]; - text.innerText = location.text; + text.innerHTML = location.text; } function goTown() { @@ -557,13 +557,13 @@ const locations = [ name: "lose", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You die. ☠️" + text: "You die. ☠" }, { name: "win", "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], "button functions": [restart, restart, restart], - text: "You defeat the dragon! YOU WIN THE GAME! 🎉" + text: "You defeat the dragon! YOU WIN THE GAME! 🎉" }, { name: "easter egg", diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62ba17beef16c563069a65d8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62ba17beef16c563069a65d8.md index 710dd2e3c95..f3d11a95837 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62ba17beef16c563069a65d8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62ba17beef16c563069a65d8.md @@ -1,13 +1,13 @@ --- id: 62ba17beef16c563069a65d8 -title: Step 137 +title: Step 136 challengeType: 0 -dashedName: step-137 +dashedName: step-136 --- # --description-- -In the `locations` array, add another object at the end. Set the `name` property to `lose`, set `button text` to an array with three `REPLAY?` strings, set `button functions` to an array with three `restart` variables, and set `text` to `You die. ☠️`. You can copy that text to use the emote. +In the `locations` array, add another object at the end. Set the `name` property to `"lose"`, set `"button text"` to an array with three `"REPLAY?"` strings, set `"button functions"` to an array with three `restart` variables, and set `text` to `"You die. ☠"`. # --hints-- @@ -23,28 +23,28 @@ Your sixth `locations` value should be an object. assert.isObject(locations[5]); ``` -Your sixth `locations` value should have a `name` property with the value `lose`. +Your sixth `locations` value should have a `name` property with the value `"lose"`. ```js assert.equal(locations[5].name, 'lose'); ``` -Your sixth `locations` value should have a `button text` array with three `REPLAY?` strings. +Your sixth `locations` value should have a `"button text"` array with three `"REPLAY?"` strings. ```js assert.deepEqual(locations[5]["button text"], ['REPLAY?', 'REPLAY?', 'REPLAY?']); ``` -Your sixth `locations` value should have a `button functions` array with three `restart` variables. +Your sixth `locations` value should have a `"button functions"` array with three `restart` variables. ```js assert.deepEqual(locations[5]["button functions"], [restart, restart, restart]); ``` -Your sixth `locations` value should have a `text` property with the value `You die. ☠️`. +Your sixth `locations` value should have a `text` property with the value `"You die. ☠"`. ```js -assert.equal(locations[5].text, 'You die. ☠️'); +assert.equal(locations[5].text, 'You die. ☠'); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc20387ef88d1d1998aac5.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc20387ef88d1d1998aac5.md index 4e081fc552d..1bd55627a03 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc20387ef88d1d1998aac5.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62fc20387ef88d1d1998aac5.md @@ -17,7 +17,7 @@ You should declare a `button2` variable with `const`. assert.match(code, /const\s+button2/); ``` -Your `button2` variable should have the value of your `#button2` element. +Your `button2` variable should have the value of your `"#button2"` element. ```js assert.deepEqual(button2, document.querySelector('#button2')); @@ -29,7 +29,7 @@ You should declare a `button3` variable with `const`. assert.match(code, /const\s+button3/); ``` -Your `button3` variable should have the value of your `#button3` element. +Your `button3` variable should have the value of your `"#button3"` element. ```js assert.deepEqual(button3, document.querySelector('#button3')); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/65b2f6acce65b7a69751a090.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/65b2f6acce65b7a69751a090.md new file mode 100644 index 00000000000..432c7be3420 --- /dev/null +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/65b2f6acce65b7a69751a090.md @@ -0,0 +1,356 @@ +--- +id: 65b2f6acce65b7a69751a090 +title: Step 138 +challengeType: 0 +dashedName: step-138 +--- + +# --description-- + +In order for the `☠` emoticon text to properly display on the page, you will need to use the innerHTML property. + +The `innerHTML` property allows you to access or modify the content inside an HTML element using JavaScript. + +Here is an example of updating the content for this paragraph element using the `innerHTML` property. + +```html +

This is a paragraph.

+``` + +```js +document.querySelector("#demo").innerHTML = "Hello, innerHTML!"; +``` + +In the `update` function, change `text.innerText` to `text.innerHTML`. + +# --hints-- + + +You should use dot notation to access the `innerHTML` property of `text`. + +```js +assert.match(code, /text\.innerHTML/); +``` + +You should not use `let` or `const` to access the `innerHTML` property of `text`. + +```js +assert.notMatch(code, /(let|const)\s+text.innerHTML/); +``` + +You should set `innerHTML` equal to the `text` property of `location`. + +```js +assert.match(code, /text\.innerHTML\s*=\s*location\.text/); +``` + + +# --seed-- + +## --seed-contents-- + +```html + + + + + + RPG - Dragon Repeller + + +
+
+ XP: 0 + Health: 100 + Gold: 50 +
+
+ + + +
+
+ Monster Name: + Health: +
+
+ Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above. +
+
+ + + +``` + +```css +body { + background-color: #0a0a23; +} + +#text { + background-color: #0a0a23; + color: #ffffff; + padding: 10px; +} + +#game { + max-width: 500px; + max-height: 400px; + background-color: #ffffff; + color: #ffffff; + margin: 30px auto 0px; + padding: 10px; +} + +#controls, +#stats { + border: 1px solid #0a0a23; + padding: 5px; + color: #0a0a23; +} + +#monsterStats { + display: none; + border: 1px solid #0a0a23; + padding: 5px; + color: #ffffff; + background-color: #c70d0d; +} + +.stat { + padding-right: 10px; +} + +button { + cursor: pointer; + color: #0a0a23; + background-color: #feac32; + background-image: linear-gradient(#fecc4c, #ffac33); + border: 3px solid #feac32; +} +``` + +```js +let xp = 0; +let health = 100; +let gold = 50; +let currentWeapon = 0; +let fighting; +let monsterHealth; +let inventory = ["stick"]; + +const button1 = document.querySelector('#button1'); +const button2 = document.querySelector("#button2"); +const button3 = document.querySelector("#button3"); +const text = document.querySelector("#text"); +const xpText = document.querySelector("#xpText"); +const healthText = document.querySelector("#healthText"); +const goldText = document.querySelector("#goldText"); +const monsterStats = document.querySelector("#monsterStats"); +const monsterName = document.querySelector("#monsterName"); +const monsterHealthText = document.querySelector("#monsterHealth"); +const weapons = [ + { name: 'stick', power: 5 }, + { name: 'dagger', power: 30 }, + { name: 'claw hammer', power: 50 }, + { name: 'sword', power: 100 } +]; +const monsters = [ + { + name: "slime", + level: 2, + health: 15 + }, + { + name: "fanged beast", + level: 8, + health: 60 + }, + { + name: "dragon", + level: 20, + health: 300 + } +] +const locations = [ + { + name: "town square", + "button text": ["Go to store", "Go to cave", "Fight dragon"], + "button functions": [goStore, goCave, fightDragon], + text: "You are in the town square. You see a sign that says \"Store\"." + }, + { + name: "store", + "button text": ["Buy 10 health (10 gold)", "Buy weapon (30 gold)", "Go to town square"], + "button functions": [buyHealth, buyWeapon, goTown], + text: "You enter the store." + }, + { + name: "cave", + "button text": ["Fight slime", "Fight fanged beast", "Go to town square"], + "button functions": [fightSlime, fightBeast, goTown], + text: "You enter the cave. You see some monsters." + }, + { + name: "fight", + "button text": ["Attack", "Dodge", "Run"], + "button functions": [attack, dodge, goTown], + text: "You are fighting a monster." + }, + { + name: "kill monster", + "button text": ["Go to town square", "Go to town square", "Go to town square"], + "button functions": [goTown, goTown, goTown], + text: 'The monster screams "Arg!" as it dies. You gain experience points and find gold.' + }, + { + name: "lose", + "button text": ["REPLAY?", "REPLAY?", "REPLAY?"], + "button functions": [restart, restart, restart], + text: "You die. ☠" + } + +]; + +// initialize buttons +button1.onclick = goStore; +button2.onclick = goCave; +button3.onclick = fightDragon; + +function update(location) { + --fcc-editable-region-- + monsterStats.style.display = "none"; + button1.innerText = location["button text"][0]; + button2.innerText = location["button text"][1]; + button3.innerText = location["button text"][2]; + button1.onclick = location["button functions"][0]; + button2.onclick = location["button functions"][1]; + button3.onclick = location["button functions"][2]; + text.innerText = location.text; + --fcc-editable-region-- +} + +function goTown() { + update(locations[0]); +} + +function goStore() { + update(locations[1]); +} + +function goCave() { + update(locations[2]); +} + +function buyHealth() { + if (gold >= 10) { + gold -= 10; + health += 10; + goldText.innerText = gold; + healthText.innerText = health; + } else { + text.innerText = "You do not have enough gold to buy health."; + } +} + +function buyWeapon() { + if (currentWeapon < weapons.length - 1) { + if (gold >= 30) { + gold -= 30; + currentWeapon++; + goldText.innerText = gold; + let newWeapon = weapons[currentWeapon].name; + text.innerText = "You now have a " + newWeapon + "."; + inventory.push(newWeapon); + text.innerText += " In your inventory you have: " + inventory; + } else { + text.innerText = "You do not have enough gold to buy a weapon."; + } + } else { + text.innerText = "You already have the most powerful weapon!"; + button2.innerText = "Sell weapon for 15 gold"; + button2.onclick = sellWeapon; + } +} + +function sellWeapon() { + if (inventory.length > 1) { + gold += 15; + goldText.innerText = gold; + let currentWeapon = inventory.shift(); + text.innerText = "You sold a " + currentWeapon + "."; + text.innerText += " In your inventory you have: " + inventory; + } else { + text.innerText = "Don't sell your only weapon!"; + } +} + +function fightSlime() { + fighting = 0; + goFight(); +} + +function fightBeast() { + fighting = 1; + goFight(); +} + +function fightDragon() { + fighting = 2; + goFight(); +} + +function goFight() { + update(locations[3]); + monsterHealth = monsters[fighting].health; + monsterStats.style.display = "block"; + monsterName.innerText = monsters[fighting].name; + monsterHealthText.innerText = monsterHealth; +} + +function attack() { + text.innerText = "The " + monsters[fighting].name + " attacks."; + text.innerText += " You attack it with your " + weapons[currentWeapon].name + "."; + health -= monsters[fighting].level; + monsterHealth -= weapons[currentWeapon].power + Math.floor(Math.random() * xp) + 1; + healthText.innerText = health; + monsterHealthText.innerText = monsterHealth; + if (health <= 0) { + lose(); + } else if (monsterHealth <= 0) { + if (fighting === 2) { + winGame(); + } else { + defeatMonster(); + } + } +} + +function dodge() { + text.innerText = "You dodge the attack from the " + monsters[fighting].name; +} + +function defeatMonster() { + gold += Math.floor(monsters[fighting].level * 6.7); + xp += monsters[fighting].level; + goldText.innerText = gold; + xpText.innerText = xp; + update(locations[4]); +} + +function lose() { + update(locations[5]); +} + +function restart() { + xp = 0; + health = 100; + gold = 50; + currentWeapon = 0; + inventory = ["stick"]; + goldText.innerText = gold; + healthText.innerText = health; + xpText.innerText = xp; + goTown(); +} +``` diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63efdbc22a0c56070beabed7.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63efdbc22a0c56070beabed7.md index 8cf076939de..8b264bf50e8 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63efdbc22a0c56070beabed7.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63efdbc22a0c56070beabed7.md @@ -22,21 +22,21 @@ You should use bracket notation to access the property of `totalCountPerProduct` ```js const cart = new ShoppingCart(); -assert.match(cart.addItem.toString(), /totalCountPerProduct\[\s*dessert\.id\s*\]/); +assert.match(cart.addItem.toString(), /totalCountPerProduct\s*\[\s*dessert\.id\s*\]/); ``` You should use the assignment operator to update the value of the property of `totalCountPerProduct` that corresponds to `dessert.id`. ```js const cart = new ShoppingCart(); -assert.match(cart.addItem.toString(), /totalCountPerProduct\[\s*dessert\.id\s*\]\s*=/); +assert.match(cart.addItem.toString(), /totalCountPerProduct\s*\[\s*dessert\.id\s*\]\s*=/); ``` You should update the value of `totalCountPerProduct` to be the current value plus one. ```js const cart = new ShoppingCart(); -assert.match(cart.addItem.toString(), /totalCountPerProduct\[\s*dessert\.id\s*\]\s*=\s*totalCountPerProduct\[\s*dessert\.id\s*\]\s*\+\s*1/); +assert.match(cart.addItem.toString(), /totalCountPerProduct\s*\[\s*dessert\.id\s*\]\s*=\s*totalCountPerProduct\s*\[\s*dessert\.id\s*\]\s*\+\s*1/); ``` diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63efe370bbfc4a08d500118e.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63efe370bbfc4a08d500118e.md index ab4e048e846..f210ff3bb8f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63efe370bbfc4a08d500118e.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63efe370bbfc4a08d500118e.md @@ -17,28 +17,28 @@ You should wrap your right-hand `totalCountPerProduct[dessert.id]` in parenthese ```js const cart = new ShoppingCart(); -assert.match(cart.addItem.toString(), /totalCountPerProduct\[\s*dessert\.id\s*\]\s*=\s*\(\s*totalCountPerProduct\[\s*dessert\.id\s*\]/); +assert.match(cart.addItem.toString(), /totalCountPerProduct\s*\[\s*dessert\.id\s*\]\s*=\s*\(\s*totalCountPerProduct\s*\[\s*dessert\.id\s*\]/); ``` You should use the `||` operator. ```js const cart = new ShoppingCart(); -assert.match(cart.addItem.toString(), /totalCountPerProduct\[\s*dessert\.id\s*\]\s*=\s*\(\s*totalCountPerProduct\[\s*dessert\.id\s*\]\s*\|\|\s*/); +assert.match(cart.addItem.toString(), /totalCountPerProduct\s*\[\s*dessert\.id\s*\]\s*=\s*\(\s*totalCountPerProduct\s*\[\s*dessert\.id\s*\]\s*\|\|\s*/); ``` You should use `0` as your fallback value. ```js const cart = new ShoppingCart(); -assert.match(cart.addItem.toString(), /totalCountPerProduct\[\s*dessert\.id\s*\]\s*=\s*\(\s*totalCountPerProduct\[\s*dessert\.id\s*\]\s*\|\|\s*0\s*\)/); +assert.match(cart.addItem.toString(), /totalCountPerProduct\s*\[\s*dessert\.id\s*\]\s*=\s*\(\s*totalCountPerProduct\s*\[\s*dessert\.id\s*\]\s*\|\|\s*0\s*\)/); ``` You should still add `1` to the value. ```js const cart = new ShoppingCart(); -assert.match(cart.addItem.toString(), /totalCountPerProduct\[\s*dessert\.id\s*\]\s*=\s*\(\s*totalCountPerProduct\[\s*dessert\.id\s*\]\s*\|\|\s*0\s*\)\s*\+\s*1/); +assert.match(cart.addItem.toString(), /totalCountPerProduct\s*\[\s*dessert\.id\s*\]\s*=\s*\(\s*totalCountPerProduct\s*\[\s*dessert\.id\s*\]\s*\|\|\s*0\s*\)\s*\+\s*1/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63eff02f00e69a0b2ac10b43.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63eff02f00e69a0b2ac10b43.md index ec1f0bc6540..8cac93ce139 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63eff02f00e69a0b2ac10b43.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63eff02f00e69a0b2ac10b43.md @@ -29,7 +29,7 @@ You should assign the value of `totalCountPerProduct[product.id]` to `currentPro ```js const cart = new ShoppingCart(); -assert.match(cart.addItem.toString(), /currentProductCount\s*=\s*totalCountPerProduct\[product\.id\]/); +assert.match(cart.addItem.toString(), /currentProductCount\s*=\s*totalCountPerProduct\s*\[\s*product\.id\s*\]/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f0284532742c1b26c7a052.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f0284532742c1b26c7a052.md index cfd0b381c59..82367d1abda 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f0284532742c1b26c7a052.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f0284532742c1b26c7a052.md @@ -32,7 +32,7 @@ assert.match(code, /\[\s*\.\.\.addToCartBtns\s*\]\s*\.\s*forEach\s*\(\s*(?:\(\s* You should add an empty callback function to the event listener. Remember to give it an `event` parameter. ```js -assert.match(code, /\[\s*\.\.\.addToCartBtns\s*\]\s*\.\s*forEach\s*\(\s*(?:\(\s*btn\s*\)|btn)\s*=>\s*\{\s*btn\s*\.\s*addEventListener\s*\(\s*('|"|`)click\1\s*,\s*(\(\s*event\s*\)|event)\s*=>\s*\{\s*\}\s*\)\s*\s*\}\s*\)/); +assert.match(code, /\[\s*\.\.\.addToCartBtns\s*\]\s*\.\s*forEach\s*\(\s*(?:\(\s*btn\s*\)|btn)\s*=>\s*\{\s*btn\s*\.\s*addEventListener\s*\(\s*('|"|`)click\1\s*,\s*(\(\s*event\s*\)|event)\s*=>\s*\{\s*\}\s*\)\s*;?\s*\}\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f02a4ef92d711ec1ff618c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f02a4ef92d711ec1ff618c.md index 228d92f0564..e43665a540c 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f02a4ef92d711ec1ff618c.md +++ b/curriculum/challenges/arabic/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*\(total,\s*item\)\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*item\s*\)\s*=>\s*total\s*\+\s*item\.price\s*,\s*0\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f02bdeb9b428208b97eb6b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f02bdeb9b428208b97eb6b.md index 5ff3b64938d..eff305ad7e9 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f02bdeb9b428208b97eb6b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-oop-by-building-a-shopping-cart/63f02bdeb9b428208b97eb6b.md @@ -37,7 +37,6 @@ assert.match(afterCalculateTaxes, /amount\s*\*\s*\(\s*this\s*\.\s*taxRate\s*\/\s Your `calculateTaxes` method should return the value of the `taxRate` (divided by 100, to convert it to a percent) multiplied by the `amount` parameter. ```js -console.log(cart.calculateTaxes(10), (cart.taxRate / 100) * 10); assert.equal(cart.calculateTaxes(10), (cart.taxRate / 100) * 10); ``` diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/652f948489abbb81e6bf5a01.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/652f948489abbb81e6bf5a01.md index b57d7acb9ea..7427f8c2516 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/652f948489abbb81e6bf5a01.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/652f948489abbb81e6bf5a01.md @@ -19,37 +19,37 @@ Start by accessing the `#playlist-songs`, `#play`, and `#pause` elements with th You should use `document.getElementById()` to get the `#playlist-songs` element. ```js -assert.match(code, /document\.getElementById\(\s*('|"|`)playlist\-songs\1\)/); +assert.match(code, /document\.getElementById\(\s*('|"|`)playlist\-songs\1\s*\)/); ``` You should assign the `#playlist-songs` element to the variable `playlistSongs`. Don't forget to use `const` to declare the variable. ```js -assert.match(code, /const\s+playlistSongs\s*\=\s*document\.getElementById\(\s*('|"|`)playlist\-songs\1\)/); +assert.match(code, /const\s+playlistSongs\s*\=\s*document\.getElementById\(\s*('|"|`)playlist\-songs\1\s*\)/); ``` You should use `document.getElementById()` to get the `#play` element. ```js -assert.match(code, /document\.getElementById\(\s*('|"|`)play\1\)/); +assert.match(code, /document\.getElementById\(\s*('|"|`)play\1\s*\)/); ``` You should assign the `#play` element to the variable `playButton`. Don't forget to use `const` to declare the variable. ```js -assert.match(code, /const\s+playButton\s*\=\s*document\.getElementById\(\s*('|"|`)play\1\)/); +assert.match(code, /const\s+playButton\s*\=\s*document\.getElementById\(\s*('|"|`)play\1\s*\)/); ``` You should use `document.getElementById()` to get the `#pause` element. ```js -assert.match(code, /document\.getElementById\(\s*('|"|`)pause\1\)/); +assert.match(code, /document\.getElementById\(\s*('|"|`)pause\1\s*\)/); ``` You should assign the `#pause` element to the variable `pauseButton`. Don't forget to use `const` to declare the variable. ```js -assert.match(code, /const\s+pauseButton\s*\=\s*document\.getElementById\(\s*('|"|`)pause\1\)/); +assert.match(code, /const\s+pauseButton\s*\=\s*document\.getElementById\(\s*('|"|`)pause\1\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/652fa2aee6374ad29b5d49b4.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/652fa2aee6374ad29b5d49b4.md index 652d83b86f2..b9a1f287e74 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/652fa2aee6374ad29b5d49b4.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/652fa2aee6374ad29b5d49b4.md @@ -16,37 +16,37 @@ Assign them to variables named `nextButton`, `previousButton`, and `shuffleButto You should use `document.getElementById()` to get the `#next` element. ```js -assert.match(code, /document\.getElementById\(\s*('|"|`)next\1\)/); +assert.match(code, /document\.getElementById\(\s*('|"|`)next\1\s*\)/); ``` You should assign the `#next` element to the variable `nextButton`. Don't forget to use `const` to declare the variable. ```js -assert.match(code, /const\s+nextButton\s*\=\s*document\.getElementById\(\s*('|"|`)next\1\)/); +assert.match(code, /const\s+nextButton\s*\=\s*document\.getElementById\(\s*('|"|`)next\1\s*\)/); ``` You should use `document.getElementById()` to get the `#previous` element. ```js -assert.match(code, /document\.getElementById\(\s*('|"|`)previous\1\)/); +assert.match(code, /document\.getElementById\(\s*('|"|`)previous\1\s*\)/); ``` You should assign the `#previous` element to the variable `previousButton`. Don't forget to use `const` to declare the variable. ```js -assert.match(code, /const\s+previousButton\s*\=\s*document\.getElementById\(\s*('|"|`)previous\1\)/); +assert.match(code, /const\s+previousButton\s*\=\s*document\.getElementById\(\s*('|"|`)previous\1\s*\)/); ``` You should use `document.getElementById()` to get the `#shuffle` element. ```js -assert.match(code, /document\.getElementById\(\s*('|"|`)shuffle\1\)/); +assert.match(code, /document\.getElementById\(\s*('|"|`)shuffle\1\s*\)/); ``` You should assign the `#shuffle` element to the variable `shuffleButton`. Don't forget to use `const` to declare the variable. ```js -assert.match(code, /const\s+shuffleButton\s*\=\s*document\.getElementById\(\s*('|"|`)shuffle\1\)/); +assert.match(code, /const\s+shuffleButton\s*\=\s*document\.getElementById\(\s*('|"|`)shuffle\1\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65327e9c7ea42e125256b29a.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65327e9c7ea42e125256b29a.md index 267ab907d2c..be9d659e3a5 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65327e9c7ea42e125256b29a.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65327e9c7ea42e125256b29a.md @@ -18,13 +18,13 @@ Use `const` to create a variable named `audio` and set it equal to `new Audio()` You should use the `new` keyword to create an instance of the `Audio` object. ```js -assert.match(code, /new\s+Audio\(\);?/) +assert.match(code, /new\s+Audio\(\s*\);?/) ``` You should assign the `Audio` object to a constant named `audio`. ```js -assert.match(code, /const\s+audio\s*=\s*new\s+Audio\(\);?/) +assert.match(code, /const\s+audio\s*=\s*new\s+Audio\(\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65362bfd67d61d517deef191.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65362bfd67d61d517deef191.md index e6919c82f43..cb947876895 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65362bfd67d61d517deef191.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65362bfd67d61d517deef191.md @@ -34,7 +34,7 @@ assert.match(code, /userData\?\.songs\.find\(/) Your `find` method should have `song` as the parameter of its arrow function callback. ```js -assert.match(code, /userData\?\.songs\.find\(\(?song\)?/) +assert.match(code, /userData\?\.songs\.find\(\s*(\(\s*song\s*\)|song)/) ``` Your `find` method should use strict equality to check if `song.id` is equal to `id`. @@ -46,7 +46,7 @@ assert.match(code, /userData\?\.songs\.find\(\s*(\(\s*song\s*\)|song)\s*=>\s*(so Your `find` method should be assigned to a `song` constant. ```js -assert.match(code, /const\s+song\s*=\s*userData\?\.songs\.find\(\s*(\(\s*song\s*\)|song)\s*=>\s*(song\.id\s*===\s*id|id\s*===\s*song\.id)\);?/) +assert.match(code, /const\s+song\s*=\s*userData\?\.songs\.find\(\s*(\(\s*song\s*\)|song)\s*=>\s*(song\.id\s*===\s*id|id\s*===\s*song\.id)\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653635c731206b718659d3d5.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653635c731206b718659d3d5.md index 529d3d67b01..16563e3d14e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653635c731206b718659d3d5.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653635c731206b718659d3d5.md @@ -13,22 +13,22 @@ Also, set the `audio.title` property equal to `song.title`. This tells the audio # --hints-- -You should not modify the exist `playSong` function and its content. +You should not modify the existing `playSong` function and its content. ```js -assert.match(code, /const\s+playSong\s*=\s*\(id\)\s*=>\s*\{\s*const\s+song\s*=\s*userData\?\.songs\.find\(\(song\)\s=>\s*song\.id\s===\s*id\);?/) +assert.match(code, /const\s+playSong\s*=\s*\(\s*id\s*\)\s*=>\s*\{\s*const\s+song\s*=\s*userData\?\.songs\.find\(\s*\(\s*song\s*\)\s=>\s*song\.id\s===\s*id\s*\);?/) ``` You should set `audio.src` to `song.src`. ```js -assert.match(code, /const\s+playSong\s*=\s*\(id\)\s*=>\s*\{\s*const\s+song\s*=\s*userData\?\.songs\.find\(\(song\)\s=>\s*song\.id\s===\s*id\);?\s*audio\.src\s*=\s*song\.src;?/) +assert.match(code, /const\s+playSong\s*=\s*\(\s*id\s*\)\s*=>\s*\{\s*const\s+song\s*=\s*userData\?\.songs\.find\(\s*\(\s*song\s*\)\s=>\s*song\.id\s===\s*id\s*\);?\s*audio\.src\s*=\s*song\.src;?/) ``` You should set `audio.title` to `song.title`. ```js -assert.match(code, /const\s+playSong\s*=\s*\(id\)\s*=>\s*\{\s*const\s+song\s*=\s*userData\?\.songs\.find\(\(song\)\s=>\s*song\.id\s===\s*id\);?\s*audio\.src\s*=\s*song\.src;?\s*audio\.title\s*=\s*song\.title;?\s*\};?/) +assert.match(code, /const\s+playSong\s*=\s*\(\s*id\s*\)\s*=>\s*\{\s*const\s+song\s*=\s*userData\?\.songs\.find\(\s*\(\s*song\s*\)\s=>\s*song\.id\s===\s*id\s*\);?\s*audio\.src\s*=\s*song\.src;?\s*audio\.title\s*=\s*song\.title;?\s*\};?/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653639d63a45a077333312c8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653639d63a45a077333312c8.md index 6645f7c58db..9fbec0fdd13 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653639d63a45a077333312c8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653639d63a45a077333312c8.md @@ -17,13 +17,13 @@ Add an `if` statement to check whether the `userData?.currentSong` is `null` or You should create an `if` statement with the condition `userData?.currentSong === null || userData?.currentSong.id !== song.id`. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\s*===\s*null\s*\|\|\s*userData\?\.currentSong\.id\s*!==\s*song\.id\)\s*\{\s*/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\|\|\s*userData\?\.currentSong\.id\s*!==\s*song\.id\s*\)\s*\{\s*/) ``` You should set `audio.currentTime` to `0` inside your `if` block. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\s*===\s*null\s*\|\|\s*userData\?\.currentSong\.id\s*!==\s*song\.id\)\s*\{\s*audio\.currentTime\s*=\s*0;?\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\|\|\s*userData\?\.currentSong\.id\s*!==\s*song\.id\s*\)\s*\{\s*audio\.currentTime\s*=\s*0;?\s*\}/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653641509b6e7681a9333245.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653641509b6e7681a9333245.md index 43c2cce5941..93fd224a523 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653641509b6e7681a9333245.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/653641509b6e7681a9333245.md @@ -11,9 +11,11 @@ You need to update the current song being played as well as the appearance of th Start by accessing the `userData` object and its `currentSong` property. Set its value equal to the `song` variable. +*Note*: You should not use the optional chaining operator `?.` in this step because `userData.currentSong` will not be `null` or `undefined` at this point. + # --hints-- -You should set `userData.currentSong` to `song`. +You should assign `song` to `userData.currentSong`. ```js assert.match(code, /userData\.currentSong\s*=\s*song;?/) @@ -614,7 +616,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } --fcc-editable-region-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65364566e84e378837fbaf2a.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65364566e84e378837fbaf2a.md index a09ff2e596a..2e6a527515e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65364566e84e378837fbaf2a.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65364566e84e378837fbaf2a.md @@ -7,9 +7,9 @@ dashedName: step-33 # --description-- -You need to hook up the `playSong` function to a `click` event listener so the songs will start playing when the play button is clicked. +In previous steps you built out the functionality for playing a song. Now you need to add the functionality to the play button so that it will play the current song when it is clicked on. -Add a click event listener to the `playButton` element, then use arrow syntax to pass in a callback with an empty pair of curly braces. +Use the `addEventListener()` method and pass in a `click` event for the first argument and an empty callback function with arrow syntax for the second argument, e.g., `() => {}`. # --hints-- @@ -22,13 +22,13 @@ assert.match(code, /playButton\.addEventListener\(/) Your event listener should listen for a `click` event. ```js -assert.match(code, /playButton\.addEventListener\(('|"|`)click\1/) +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\(('|"|`)click\1,\s*\(\s*\)\s*=>\s*\{\s*\}\);?/) +assert.match(code, /playButton\.addEventListener\(\s*('|"|`)click\1,\s*\(\s*\)\s*=>\s*\{\s*\}\s*\);?/) ``` # --seed-- @@ -626,7 +626,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65420b821b14f25a6b35c3b3.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65420b821b14f25a6b35c3b3.md index 7842726855b..2bd933a89da 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65420b821b14f25a6b35c3b3.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65420b821b14f25a6b35c3b3.md @@ -24,7 +24,7 @@ assert.match(code, /const\s+songsHTML/); You should assign `array.map()` to your `songsHTML`. ```js -assert.match(code, /const\s+songsHTML\s*=\s*array\.map\(\)/); +assert.match(code, /const\s+songsHTML\s*=\s*array\.map\(\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654210a9eda99477f5697a94.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654210a9eda99477f5697a94.md index 324bb5fa749..c28f0c62217 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654210a9eda99477f5697a94.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654210a9eda99477f5697a94.md @@ -32,7 +32,7 @@ assert.match(code, /\s*\s*\$\{song\.title\}\s*<\/span>\s*<\/button>/) +assert.match(code, /\s*\s*\$\{\s*song\.title\s*\}\s*<\/span>\s*<\/button>/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654213f2fad2d48f74d6c239.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654213f2fad2d48f74d6c239.md index 1b58d21847c..6e717d3263d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654213f2fad2d48f74d6c239.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654213f2fad2d48f74d6c239.md @@ -24,7 +24,7 @@ assert.match(code, //) +assert.match(code, //) ``` You should paste in the provided `svg` as the content of your `button` element. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654215fe7b4a899ddceb3b60.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654215fe7b4a899ddceb3b60.md index 812e4ce1a63..ea667115d85 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654215fe7b4a899ddceb3b60.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654215fe7b4a899ddceb3b60.md @@ -24,7 +24,7 @@ Chain the `join()` method to your `map()` method and pass in an empty string for You should add `join("")` to the existing code. ```js -assert.match(code, /\s*\s*\s*\s*<\/svg>\s*<\/button>\s*<\/li>\s*`;?\s*\}\)\s*\.join\(('|")\3\);?/) +assert.match(code, /\s*\s*\s*\s*<\/svg>\s*<\/button>\s*<\/li>\s*`;?\s*\}\s*\)\s*\.join\(\s*('|")\3\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654218753c255fabb81f57ca.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654218753c255fabb81f57ca.md index 0bd650dea97..ed90dcd5788 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654218753c255fabb81f57ca.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/654218753c255fabb81f57ca.md @@ -35,7 +35,7 @@ Call the `renderSongs` function with the `songs` property of `userData`. This wi You should call your `renderSongs` function with `userData?.songs`. ```js -assert.match(code, /renderSongs\(userData\?\.songs\)/) +assert.match(code, /renderSongs\(\s*userData\?\.songs\s*\)/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65422ba173a18b1bedef1bb6.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65422ba173a18b1bedef1bb6.md index fc6a1407734..2aa27493512 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65422ba173a18b1bedef1bb6.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65422ba173a18b1bedef1bb6.md @@ -9,20 +9,20 @@ dashedName: step-34 Within the arrow function of the event listener, add an `if` to check if `userData?.currentSong` is `null`. -Inside the `if` block, call the `playSong()` function with the `id` of the first song in the `userData.songs` array. This will ensure the first song in the playlist is played first. +Inside the `if` block, call the `playSong()` function with the `id` of the first song in the `userData?.songs` array. This will ensure the first song in the playlist is played first. # --hints-- You should create an `if` statement with the condition `userData?.currentSong === null`. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{/) ``` You should call the `playSong` function with `userData?.songs[0].id` inside your `if` block. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{\s*playSong\(userData\?\.songs\[0\]\.id\);?\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{\s*playSong\(\s*userData\?\.songs\s*\[\s*0\s*\]\s*\.id\s*\);?\s*\}/) ``` # --seed-- @@ -620,7 +620,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552127b2576c2fbc5ecc2ea.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552127b2576c2fbc5ecc2ea.md index 995a3f533a3..d33162a405a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552127b2576c2fbc5ecc2ea.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552127b2576c2fbc5ecc2ea.md @@ -16,20 +16,20 @@ This ensures that the currently playing song will continue to play when the play You should not modify the existing `if` statement and its content. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{\s*playSong\(userData\?\.songs\[0\]\.id\);?\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{\s*playSong\(\s*userData\?\.songs\s*\[\s*0\s*\]\s*\.id\s*\);?\s*\}/) ``` You should add an `else` block to your `if` statement. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{\s*playSong\(userData\?\.songs\[0\]\.id\);?\s*\}\s*else\s*\{/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{\s*playSong\(\s*userData\?\.songs\s*\[\s*0\s*\]\s*\.id\s*\);?\s*\}\s*else\s*\{/) ``` You should call the `playSong` function with `userData?.currentSong.id` in the `else` block of your `if` statement. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{\s*playSong\(userData\?\.songs\[0\]\.id\);?\s*\}\s*else\s*\{\s*playSong\(userData\?\.currentSong\.id\);?\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{\s*playSong\(\s*userData\?\.songs\s*\[\s*0\s*\]\s*\.id\s*\);?\s*\}\s*else\s*\{\s*playSong\(\s*userData\?\.currentSong\.id\s*\);?\s*\}/) ``` # --seed-- @@ -627,7 +627,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65521badc7b7470edf952372.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65521badc7b7470edf952372.md index 704f9155cbd..bf543568793 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65521badc7b7470edf952372.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65521badc7b7470edf952372.md @@ -28,13 +28,13 @@ assert.isFunction(pauseSong) Your `pauseSong` function should use an arrow syntax. ```js -assert.match(code, /const\s+pauseSong\s*=\s*\(\)\s*=>\s*/) +assert.match(code, /const\s+pauseSong\s*=\s*\(\s*\)\s*=>\s*/) ``` Your `pauseSong` function should be empty. ```js -assert.match(code, /const\s+pauseSong\s*=\s*\(\)\s*=>\s*\{\n?\s*?\};?/) +assert.match(code, /const\s+pauseSong\s*=\s*\(\s*\)\s*=>\s*\{\n?\s*?\};?/) ``` # --seed-- @@ -632,7 +632,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65521ec3bb117c195c4f6cb5.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65521ec3bb117c195c4f6cb5.md index cfc34734a5f..eba902dc470 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65521ec3bb117c195c4f6cb5.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65521ec3bb117c195c4f6cb5.md @@ -9,15 +9,17 @@ dashedName: step-38 To store the current time of the song when it is paused, set the `songCurrentTime` of the `userData` object to the `currentTime` of the `audio` variable. +*Note*: You should not use optional chaining for this step because `userData.songCurrentTime` will not be `null` or `undefined` at this point. + # --hints-- You should not modify the existing `pauseSong` function and its content. ```js -assert.match(code, /const\s+pauseSong\s*=\s*\(\)\s*=>\s*\{\s*.*\s*\};?/) +assert.match(code, /const\s+pauseSong\s*=\s*\(\s*\)\s*=>\s*\{\s*.*\s*\};?/) ``` -You should set `userData.songCurrentTime` to `audio.currentTime`. +You should assign `audio.currentTime` to `userData.songCurrentTime`. ```js assert.match(code, /userData\.songCurrentTime\s*=\s*audio\.currentTime;?/) @@ -618,7 +620,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655220a3fa5c3c200bc8e938.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655220a3fa5c3c200bc8e938.md index add200cbae0..6665bb41d46 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655220a3fa5c3c200bc8e938.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655220a3fa5c3c200bc8e938.md @@ -16,19 +16,19 @@ To finally pause the song, use the `pause()` method on the `audio` variable. `pa You should not modify the existing `pauseSong` function and its content. ```js -assert.match(code, /const\s+pauseSong\s*=\s*\(\)\s*=>\s*\{\s*userData\.songCurrentTime\s*=\s*audio\.currentTime;?\s*.*\s*.*\s*\};?/) +assert.match(code, /const\s+pauseSong\s*=\s*\(\s*\)\s*=>\s*\{\s*userData\.songCurrentTime\s*=\s*audio\.currentTime;?\s*.*\s*.*\s*\};?/) ``` You should use the `classList` property and the `remove()` method to remove the class `playing` from the `playButton`. ```js -assert.match(code, /playButton\.classList\.remove\(('|")playing\1\);?/) +assert.match(code, /playButton\.classList\.remove\(\s*('|")playing\1\s*\);?/) ``` You should use the `pause()` method on your `audio` variable. ```js -assert.match(code, /audio\.pause\(\)/) +assert.match(code, /audio\.pause\(\s*\)/) ``` # --seed-- @@ -626,7 +626,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552303a9a78704f8ff072e9.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552303a9a78704f8ff072e9.md index 53a0d9c7d0a..ec4c9009e17 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552303a9a78704f8ff072e9.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552303a9a78704f8ff072e9.md @@ -22,13 +22,13 @@ assert.match(code, /pauseButton\.addEventListener\(/) Your event listener should listen for a `click` event. ```js -assert.match(code, /pauseButton\.addEventListener\(('|"|`)click\1/) +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\(('|"|`)click\1,\s*pauseSong\)/) +assert.match(code, /pauseButton\.addEventListener\(\s*('|"|`)click\1,\s*pauseSong\s*\)/) ``` # --seed-- @@ -626,7 +626,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655235c2e607297f00316650.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655235c2e607297f00316650.md index c892d9c9f84..ec7d994bf62 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655235c2e607297f00316650.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655235c2e607297f00316650.md @@ -16,13 +16,13 @@ To finally play the song, use the `play()` method on the `audio` variable. `play You should use the `classList` property and the `add` method to add the class `playing` to `playButton`. ```js -assert.match(code, /playButton\.classList\.add\(("|')playing\1\);?/) +assert.match(code, /playButton\.classList\.add\(\s*("|')playing\1\s*\);?/) ``` You should use the `play()` method on the `audio` variable. ```js -assert.match(code, /audio\.play\(\);?/) +assert.match(code, /audio\.play\(\s*\);?/) ``` # --seed-- @@ -620,7 +620,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552385244ccf89b77d6b332.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552385244ccf89b77d6b332.md index 52e56cc26e0..ced6464aca0 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552385244ccf89b77d6b332.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6552385244ccf89b77d6b332.md @@ -28,13 +28,13 @@ assert.isFunction(playNextSong) Your `playNextSong` function should use an arrow syntax. ```js -assert.match(code, /const\s+playNextSong\s*=\s*\(\)\s*=>\s*/) +assert.match(code, /const\s+playNextSong\s*=\s*\(\s*\)\s*=>\s*/) ``` Your `playNextSong` function should be empty. ```js -assert.match(code, /const\s+playNextSong\s*=\s*\(\)\s*=>\s*\{\n?\s*?\};?/) +assert.match(code, /const\s+playNextSong\s*=\s*\(\s*\)\s*=>\s*\{\n?\s*?\};?/) ``` # --seed-- @@ -632,7 +632,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -673,7 +673,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655243068222c2c1166b90b0.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655243068222c2c1166b90b0.md index 79abfb02ca9..8079fdf35d7 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655243068222c2c1166b90b0.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655243068222c2c1166b90b0.md @@ -9,30 +9,30 @@ dashedName: step-44 Inside the `playNextSong` function, create an `if` statement to check if the `currentSong` of `userData` is strictly equal to `null`. This will check if there's no current song playing in the `userData` object. -If the condition is true, call the `playSong` function with the `id` of the first song in the `userData.songs` array as an argument. +If the condition is true, call the `playSong` function with the `id` of the first song in the `userData?.songs` array as an argument. # --hints-- You should not modify the existing `playNextSong` function and its content. ```js -assert.match(code, /const\s+playNextSong\s*=\s*\(\)\s*=>\s*\{\s*.*\s*.*\s*.*\s*\};?/) +assert.match(code, /const\s+playNextSong\s*=\s*\(\s*\)\s*=>\s*\{\s*.*\s*.*\s*.*\s*\};?/) ``` You should create an `if` statement with the condition `userData?.currentSong === null`. ```js -const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong);') +const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong);') -assert.match(splitter[0], /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{\s*/) +assert.match(splitter[0], /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{\s*/) ``` You should call the `playSong` function with `userData?.songs[0].id` inside the `if` statement. ```js -const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong);') +const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong);') -assert.match(splitter[0], /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{\s*playSong\(userData\?\.songs\[0\]\.id\);?\s*\}/) +assert.match(splitter[0], /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{\s*playSong\(\s*userData\?\.songs\s*\[\s*0\s*\]\s*\.id\s*\);?\s*\}/) ``` # --seed-- @@ -630,7 +630,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -673,7 +673,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655476e1ff522252fdcce5e4.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655476e1ff522252fdcce5e4.md index f216a455e46..e27eb12d0ab 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655476e1ff522252fdcce5e4.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655476e1ff522252fdcce5e4.md @@ -14,25 +14,25 @@ Add an `else` block to the `if` statement. Inside the `else` block, call the `ge You should not modify the existing `if` statement. ```js -const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong);') +const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong);') -assert.match(splitter[0], /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{\s*playSong\(userData\?\.songs\[0\]\.id\);?\s*\}/) +assert.match(splitter[0], /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{\s*playSong\(\s*userData\?\.songs\s*\[\s*0\s*\]\s*\.id\s*\);?\s*\}/) ``` You should add an `else` to the existing `if` statement. ```js -const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong);') +const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong);') -assert.match(splitter[0], /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{\s*playSong\(userData\?\.songs\[0\]\.id\);?\s*\}\s*else\s*\{\s*/) +assert.match(splitter[0], /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{\s*playSong\(\s*userData\?\.songs\s*\[\s*0\s*\]\s*\.id\s*\);?\s*\}\s*else\s*\{\s*/) ``` You should set the `currentSongIndex` constant to `getCurrentSongIndex()` inside the `else` block. ```js -const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong);') +const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong);') -assert.match(splitter[0], /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{\s*playSong\(userData\?\.songs\[0\]\.id\);?\s*\}\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\);?\s*\}/) +assert.match(splitter[0], /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{\s*playSong\(\s*userData\?\.songs\s*\[\s*0\s*\]\s*\.id\s*\);?\s*\}\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\s*\);?\s*\}/) ``` @@ -632,7 +632,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -678,7 +678,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655479aa3e1e0360ae38b7a6.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655479aa3e1e0360ae38b7a6.md index f0592ebeb1b..113aca26638 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655479aa3e1e0360ae38b7a6.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655479aa3e1e0360ae38b7a6.md @@ -18,25 +18,25 @@ Lastly, call the `playSong` function and pass in `nextSong.id` as the argument. You should not modify the existing `if` statement, its `else` block, and content. ```js -const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong);') +const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong);') -assert.match(splitter[0], /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{\s*playSong\(userData\?\.songs\[0\]\.id\);?\s*\}\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\);?\s*/) +assert.match(splitter[0], /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{\s*playSong\(\s*userData\?\.songs\s*\[\s*0\s*\]\s*\.id\s*\);?\s*\}\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\s*\);?\s*/) ``` You should assign `userData?.songs[currentSongIndex + 1]` to a `nextSong` constant. ```js -const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong);') +const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong);') -assert.match(splitter[0], /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{\s*playSong\(userData\?\.songs\[0\]\.id\);?\s*\}\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\);?\s*const\s+nextSong\s*=\s*userData\?\.songs\[currentSongIndex\s*\+\s*1\];?\s*/) +assert.match(splitter[0], /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{\s*playSong\(\s*userData\?\.songs\s*\[\s*0\s*\]\s*\.id\s*\);?\s*\}\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\s*\);?\s*const\s+nextSong\s*=\s*userData\?\.songs\s*\[\s*currentSongIndex\s*\+\s*1\s*\]\s*;?\s*/) ``` You should call the `playSong` function with `nextSong.id`. ```js -const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong);') +const splitter = code.split('const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong);') -assert.match(splitter[0], /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{\s*playSong\(userData\?\.songs\[0\]\.id\);?\s*\}\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\);?\s*const\s+nextSong\s*=\s*userData\?\.songs\[currentSongIndex\s*\+\s*1\];?\s*playSong\(nextSong\.id\);?\s*\}/) +assert.match(splitter[0], /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{\s*playSong\(\s*userData\?\.songs\s*\[\s*0\s*\]\s*\.id\s*\);?\s*\}\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\s*\);?\s*const\s+nextSong\s*=\s*userData\?\.songs\s*\[\s*currentSongIndex\s*\+\s*1\s*\]\s*;?\s*playSong\(\s*nextSong\.id\s*\);?\s*\}/) ``` @@ -635,7 +635,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -683,7 +683,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65547ee197840478a1b95f4b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65547ee197840478a1b95f4b.md index 6a7ee984f9e..59ae77496c3 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65547ee197840478a1b95f4b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65547ee197840478a1b95f4b.md @@ -22,13 +22,13 @@ assert.match(code, /nextButton\.addEventListener\(/) Your event listener should listen for a `click` event. ```js -assert.match(code, /nextButton\.addEventListener\(('|"|`)click\1/) +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\(('|"|`)click\1,\s*playNextSong\)/) +assert.match(code, /nextButton\.addEventListener\(\s*('|"|`)click\1,\s*playNextSong\s*\)/) ``` # --seed-- @@ -626,7 +626,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -675,7 +675,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6554815fe2472f8bfdab7642.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6554815fe2472f8bfdab7642.md index 1463fc025d0..759c9516b8f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6554815fe2472f8bfdab7642.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6554815fe2472f8bfdab7642.md @@ -26,13 +26,13 @@ assert.isFunction(playPreviousSong) Your `playPreviousSong` function should use an arrow syntax. ```js -assert.match(code, /const\s+playPreviousSong\s*=\s*\(\)\s*=>\s*/) +assert.match(code, /const\s+playPreviousSong\s*=\s*\(\s*\)\s*=>\s*/) ``` Your `playPreviousSong` function should be empty. ```js -assert.match(code, /const\s+playPreviousSong\s*=\s*\(\)\s*=>\s*\{\n?\s*?\};?/) +assert.match(code, /const\s+playPreviousSong\s*=\s*\(\s*\)\s*=>\s*\{\n?\s*?\};?/) ``` # --seed-- @@ -630,7 +630,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -683,7 +683,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655482742cc5499726e3f347.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655482742cc5499726e3f347.md index 98c5d823d2c..daf1f48e786 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655482742cc5499726e3f347.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655482742cc5499726e3f347.md @@ -16,31 +16,31 @@ Inside the `else` block, create a constant named `currentSongIndex` and assign i You should not alter the existing `playPreviousSong` function and its content. ```js -assert.match(code, /const\s+playPreviousSong\s*=\s*\(\)\s*=>\s*\{\s*/) +assert.match(code, /const\s+playPreviousSong\s*=\s*\(\s*\)\s*=>\s*\{\s*/) ``` You should have an `if` statement with the condition `userData?.currentSong === null` inside your `playPreviousSong` function. ```js -assert.match(code, /const\s+playPreviousSong\s*=\s*\(\)\s*=>\s*\{\s*if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{?\s*/) +assert.match(code, /const\s+playPreviousSong\s*=\s*\(\s*\)\s*=>\s*\{\s*if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{?\s*/) ``` You should have `return` inside the block of your `if` statement. ```js -assert.match(code, /const\s+playPreviousSong\s*=\s*\(\)\s*=>\s*\{\s*if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{?\s*return;?\s*\}?/) +assert.match(code, /const\s+playPreviousSong\s*=\s*\(\s*\)\s*=>\s*\{\s*if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{?\s*return;?\s*\}?/) ``` Your `if` statement should have an `else` block. ```js -assert.match(code, /const\s+playPreviousSong\s*=\s*\(\)\s*=>\s*\{\s*if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{?\s*return;?\s*\}?\s*else\s*\{\s*/) +assert.match(code, /const\s+playPreviousSong\s*=\s*\(\s*\)\s*=>\s*\{\s*if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{?\s*return;?\s*\}?\s*else\s*\{\s*/) ``` You should call `getCurrentSongIndex` and assign it to `currentSongIndex` inside the `else` block of your `if` statement. ```js -assert.match(code, /const\s+playPreviousSong\s*=\s*\(\)\s*=>\s*\{\s*if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{?\s*return;?\s*\}?\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\);?\s*/) +assert.match(code, /const\s+playPreviousSong\s*=\s*\(\s*\)\s*=>\s*\{\s*if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{?\s*return;?\s*\}?\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\s*\);?\s*/) ``` @@ -640,7 +640,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -695,7 +695,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655483ebf0096ba02b2c3d4c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655483ebf0096ba02b2c3d4c.md index 14df7e411ea..734c4f3c077 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655483ebf0096ba02b2c3d4c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655483ebf0096ba02b2c3d4c.md @@ -14,19 +14,19 @@ To get the previous song, subtract `1` from the `currentSongIndex` of `userData? You should not modify the existing `if` statement and its content. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{?\s*return;?\s*\}?\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\);?\s*/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{?\s*return;?\s*\}?\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\s*\);?\s*/) ``` You should assign `userData?.songs[currentSongIndex - 1]` to a `previousSong` constant. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{?\s*return;?\s*\}?\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\);?\s*const\s+previousSong\s*=\s*userData\?\.songs\[currentSongIndex\s*-\s*1\];?\s*/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{?\s*return;?\s*\}?\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\s*\);?\s*const\s+previousSong\s*=\s*userData\?\.songs\s*\[\s*currentSongIndex\s*-\s*1\s*\]\s*;?\s*/) ``` You should call the `playSong` function with `previousSong.id`. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\s*===\s*null\)\s*\{?\s*return;?\s*\}?\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\);?\s*const\s+previousSong\s*=\s*userData\?\.songs\[currentSongIndex\s*-\s*1\];?\s*playSong\(previousSong\.id\);?\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\)\s*\{?\s*return;?\s*\}?\s*else\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\s*\);?\s*const\s+previousSong\s*=\s*userData\?\.songs\s*\[\s*currentSongIndex\s*-\s*1\s*\]\s*;?\s*playSong\(\s*previousSong\.id\s*\);?\s*\}/) ``` # --seed-- @@ -624,7 +624,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -683,7 +683,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655485321913feabbc5f00f8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655485321913feabbc5f00f8.md index 107dce1e7d2..baf9e938a3e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655485321913feabbc5f00f8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655485321913feabbc5f00f8.md @@ -20,13 +20,13 @@ assert.match(code, /previousButton\.addEventListener\(/) Your event listener should listen for a `click` event. ```js -assert.match(code, /previousButton\.addEventListener\(('|"|`)click\1/) +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\(('|"|`)click\1,\s*playPreviousSong\)/) +assert.match(code, /previousButton\.addEventListener\(\s*('|"|`)click\1,\s*playPreviousSong\s*\)/) ``` # --seed-- @@ -624,7 +624,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -683,7 +683,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6554860ea4dfbab2f4786fc8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6554860ea4dfbab2f4786fc8.md index 0a2e4793576..e14a0b04358 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6554860ea4dfbab2f4786fc8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6554860ea4dfbab2f4786fc8.md @@ -28,19 +28,19 @@ assert.isFunction(highlightCurrentSong) Your `highlightCurrentSong` function should use an arrow syntax. ```js -assert.match(code, /const\s+highlightCurrentSong\s*=\s*\(\)\s*=>\s*{\s*/) +assert.match(code, /const\s+highlightCurrentSong\s*=\s*\(\s*\)\s*=>\s*{\s*/) ``` You should create a `playlistSongElements` constant inside your `highlightCurrentSong` function. ```js -assert.match(code, /const\s+highlightCurrentSong\s*=\s*\(\)\s*=>\s*{\s*const\s+playlistSongElements\s*=\s*/) +assert.match(code, /const\s+highlightCurrentSong\s*=\s*\(\s*\)\s*=>\s*{\s*const\s+playlistSongElements\s*=\s*/) ``` You should use the `querySelectorAll()` method to select the `.playlist-song` element and assign it to the `playlistSongElements` constant. ```js -assert.match(code, /const\s+highlightCurrentSong\s*=\s*\(\)\s*=>\s*{\s*const\s+playlistSongElements\s*=\s*document\.querySelectorAll\(('|")\.playlist-song\1\);?\s*\};?/) +assert.match(code, /const\s+highlightCurrentSong\s*=\s*\(\s*\)\s*=>\s*{\s*const\s+playlistSongElements\s*=\s*document\.querySelectorAll\(\s*('|")\.playlist-song\1\s*\);?\s*\};?/) ``` # --seed-- @@ -638,7 +638,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -700,7 +700,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655487f686aabfc2a10ba887.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655487f686aabfc2a10ba887.md index b071156be07..dda67f7dad7 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655487f686aabfc2a10ba887.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655487f686aabfc2a10ba887.md @@ -22,7 +22,7 @@ assert.isFunction(getCurrentSongIndex); Your `getCurrentSongIndex` function should use arrow syntax. ```js -assert.match(code, /(let|const)\s+getCurrentSongIndex\s*=\s*\(\)\s*=>\s*{\s*}\s*/); +assert.match(code, /(let|const)\s+getCurrentSongIndex\s*=\s*\(\s*\)\s*=>\s*{\s*}\s*/); ``` # --seed-- @@ -620,7 +620,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65548f747a4cdafd186948d1.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65548f747a4cdafd186948d1.md index 2ad17ada2d2..4a48bfe9d26 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65548f747a4cdafd186948d1.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65548f747a4cdafd186948d1.md @@ -16,7 +16,7 @@ Use `getElementById()` to get the `id` of the currently playing song, then use t You should not modify the existing `highlightCurrentSong` function and its content. ```js -assert.match(code, /const\s+highlightCurrentSong\s*=\s*\(\)\s*=>\s*\s{\s*const\s+playlistSongElements\s*=\s*document\.querySelectorAll\(('|")\.playlist-song\1\);?\s*/) +assert.match(code, /const\s+highlightCurrentSong\s*=\s*\(\s*\)\s*=>\s*\s{\s*const\s+playlistSongElements\s*=\s*document\.querySelectorAll\(\s*('|")\.playlist-song\1\s*\);?\s*/) ``` You should use `document.getElementById()` and pass in `` `song-${userData?.currentSong?.id}` ``. @@ -626,7 +626,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -692,7 +692,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655490f55c36900779336988.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655490f55c36900779336988.md index 530936c78ef..e76438d14dd 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655490f55c36900779336988.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655490f55c36900779336988.md @@ -33,13 +33,13 @@ assert.match(code, /playlistSongElements\.forEach\(/) Your `forEach()` method should have a `songEl` parameter and use arrow syntax. ```js -assert.match(code, /playlistSongElements\.forEach\(\(?songEl\)?\s*=>\s*/) +assert.match(code, /playlistSongElements\.forEach\(\s*(\(songEl\s*\)|songEl)\s*=>\s*/) ``` Your `forEach` should have an empty pair of curly braces. ```js -assert.match(code, /playlistSongElements\.forEach\(\(?songEl\)?\s*=>\s*\{\s*\}\);?/) +assert.match(code, /playlistSongElements\.forEach\(\s*(\(songEl\s*\)|songEl)\s*=>\s*\{\s*\}\s*\);?/) ``` # --seed-- @@ -637,7 +637,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -706,7 +706,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655492e6b90c7a198c587943.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655492e6b90c7a198c587943.md index a3da2d8db65..e394ae062e5 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655492e6b90c7a198c587943.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655492e6b90c7a198c587943.md @@ -16,19 +16,19 @@ Create an `if` statement with the condition `songToHighlight`. For the statement You should create an `if` statement with the condition `songToHighlight`. ```js -assert.match(code, /if\s*\(songToHighlight\)\s*\{?\s*/) +assert.match(code, /if\s*\(\s*songToHighlight\s*\)\s*\{?\s*/) ``` You should use the `setAttribute()` method on `songToHighlight` inside your `if` statement. ```js -assert.match(code, /if\s*\(songToHighlight\)\s*\{?\s*songToHighlight\.setAttribute\(/) +assert.match(code, /if\s*\(\s*songToHighlight\s*\)\s*\{?\s*songToHighlight\.setAttribute\(/) ``` You should pass in `"aria-current"` and `"true"` as the first and second argument of your `setAttribute` method. ```js -assert.match(code, /if\s*\(songToHighlight\)\s*\{?\s*songToHighlight\.setAttribute\(\s*('|")aria-current\1\s*,\s*('|")true\2\)\s*;?\s*\}?/) +assert.match(code, /if\s*\(\s*songToHighlight\s*\)\s*\{?\s*songToHighlight\.setAttribute\(\s*('|")aria-current\1\s*,\s*('|")true\2\s*\)\s*;?\s*\}?/) ``` # --seed-- @@ -626,7 +626,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -699,7 +699,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655494d5a15d6a2567e1ea60.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655494d5a15d6a2567e1ea60.md index d098c9d4b56..651fffd5af4 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655494d5a15d6a2567e1ea60.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655494d5a15d6a2567e1ea60.md @@ -16,7 +16,7 @@ After that, play around with the control buttons to see how the `highlightCurren You should call the `highlightCurrentSong` function. ```js -assert.match(code, /highlightCurrentSong\(\)/) +assert.match(code, /highlightCurrentSong\(\s*\)/) ``` # --seed-- @@ -614,7 +614,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -688,7 +688,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655495a6bd96e42bc3baa795.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655495a6bd96e42bc3baa795.md index 2094f5a4ff3..618920dc7b6 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655495a6bd96e42bc3baa795.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655495a6bd96e42bc3baa795.md @@ -26,13 +26,13 @@ assert.isFunction(setPlayerDisplay) Your `setPlayerDisplay` function should use an arrow syntax. ```js -assert.match(code, /const\s+setPlayerDisplay\s*=\s*\(\)\s*=>\s*/) +assert.match(code, /const\s+setPlayerDisplay\s*=\s*\(\s*\)\s*=>\s*/) ``` Your `setPlayerDisplay` function should be empty. ```js -assert.match(code, /const\s+setPlayerDisplay\s*=\s*\(\)\s*=>\s*\{\n?\s*?\};?/) +assert.match(code, /const\s+setPlayerDisplay\s*=\s*\(\s*\)\s*=>\s*\{\n?\s*?\};?/) ``` # --seed-- @@ -630,7 +630,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -706,7 +706,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d17af9ff06a14d399f6d.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d17af9ff06a14d399f6d.md index 7424e6b4a81..95ea0cc54a3 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d17af9ff06a14d399f6d.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d17af9ff06a14d399f6d.md @@ -16,31 +16,31 @@ Access the `#player-song-title` and `#player-song-artist` elements with the `get You should not modify the existing `setPlayerDisplay` function and its content. ```js -assert.match(code, /const\s+setPlayerDisplay\s*=\s*\(\)\s*=>\s*\{\s*.*\s*.*\s*\};?/) +assert.match(code, /const\s+setPlayerDisplay\s*=\s*\(\s*\)\s*=>\s*\{\s*.*\s*.*\s*\};?/) ``` You should use `document.getElementById()` to get the `#player-song-title` element. ```js -assert.match(code, /document\.getElementById\(\s*('|"|`)player\-song\-title\1\);?/); +assert.match(code, /document\.getElementById\(\s*('|"|`)player\-song\-title\1\s*\);?/); ``` You should assign the `#player-song-title` element to the variable `playingSong`. Don't forget to use `const` to declare the variable. ```js -assert.match(code, /const\s+playingSong\s*\=\s*document\.getElementById\(\s*('|"|`)player\-song\-title\1\);?/); +assert.match(code, /const\s+playingSong\s*\=\s*document\.getElementById\(\s*('|"|`)player\-song\-title\1\s*\);?/); ``` You should use `document.getElementById()` to get the `#player-song-artist` element. ```js -assert.match(code, /document\.getElementById\(\s*('|"|`)player\-song\-artist\1\);?/); +assert.match(code, /document\.getElementById\(\s*('|"|`)player\-song\-artist\1\s*\);?/); ``` You should assign the `#player-song-artist` element to the variable `songArtist`. Don't forget to use `const` to declare the variable. ```js -assert.match(code, /const\s+songArtist\s*\=\s*document\.getElementById\(\s*('|"|`)player\-song\-artist\1\);?/); +assert.match(code, /const\s+songArtist\s*\=\s*document\.getElementById\(\s*('|"|`)player\-song\-artist\1\s*\);?/); ``` # --seed-- @@ -638,7 +638,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -716,7 +716,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d458687cb3b357834df9.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d458687cb3b357834df9.md index 891beebaa21..6905e1c51ab 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d458687cb3b357834df9.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d458687cb3b357834df9.md @@ -630,7 +630,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -710,7 +710,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d729c9bfd7c3195f1948.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d729c9bfd7c3195f1948.md index 0a1fba122c5..0803e7974b5 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d729c9bfd7c3195f1948.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d729c9bfd7c3195f1948.md @@ -643,7 +643,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -725,7 +725,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d7e384056dc9c581fadf.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d7e384056dc9c581fadf.md index 44fc1fbc3c0..b848dd1af49 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d7e384056dc9c581fadf.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d7e384056dc9c581fadf.md @@ -16,7 +16,7 @@ Now you should see the song title and the artist show up in the display. You should call the `setPlayerDisplay` function inside your `playSong` function. ```js -assert.match(code, /setPlayerDisplay\(\);?/) +assert.match(code, /setPlayerDisplay\(\s*\);?/) ``` # --seed-- @@ -614,7 +614,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -699,7 +699,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d8faed60b9d3e4a6cefb.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d8faed60b9d3e4a6cefb.md index 1ce23a7ee05..8c1698bd9b4 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d8faed60b9d3e4a6cefb.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555d8faed60b9d3e4a6cefb.md @@ -28,13 +28,13 @@ assert.isFunction(setPlayButtonAccessibleText) Your `setPlayButtonAccessibleText` function should use an arrow syntax. ```js -assert.match(code, /const\s+setPlayButtonAccessibleText\s*=\s*\(\)\s*=>\s*/) +assert.match(code, /const\s+setPlayButtonAccessibleText\s*=\s*\(\s*\)\s*=>\s*/) ``` Your `setPlayButtonAccessibleText` function should be empty. ```js -assert.match(code, /const\s+setPlayButtonAccessibleText\s*=\s*\(\)\s*=>\s*\{\n?\s*?\};?/) +assert.match(code, /const\s+setPlayButtonAccessibleText\s*=\s*\(\s*\)\s*=>\s*\{\n?\s*?\};?/) ``` # --seed-- @@ -632,7 +632,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -719,7 +719,7 @@ const renderSongs = (array) => { --fcc-editable-region-- -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555dd138e70cae6b546966d.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555dd138e70cae6b546966d.md index aece6fa81c3..e4762acc334 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555dd138e70cae6b546966d.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555dd138e70cae6b546966d.md @@ -16,19 +16,19 @@ Don't forget to use optional chaining. You should not modify the existing `setPlayButtonAccessibleText` and its content. ```js -assert.match(code, /const\s+setPlayButtonAccessibleText\s*=\s*\(\)\s*=>\s*\{\s*.*\s*\};?/) +assert.match(code, /const\s+setPlayButtonAccessibleText\s*=\s*\(\s*\)\s*=>\s*\{\s*.*\s*\};?/) ``` You should access `userData?.currentSong` or `userData?.songs[0]`. ```js -assert.match(code, /userData\?\.currentSong\s*\|\|\s*userData\?\.songs\[0\];?/) +assert.match(code, /userData\?\.currentSong\s*\|\|\s*userData\?\.songs\s*\[\s*0\s*\]\s*;?/) ``` You should assign `userData?.currentSong || userData?.songs[0]` to a `song` constant. ```js -assert.match(code, /const\s+song\s*=\s*userData\?\.currentSong\s*\|\|\s*userData\?\.songs\[0\];?/) +assert.match(code, /const\s+song\s*=\s*userData\?\.currentSong\s*\|\|\s*userData\?\.songs\s*\[\s*0\s*\]\s*;?/) ``` # --seed-- @@ -626,7 +626,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -715,7 +715,7 @@ const setPlayButtonAccessibleText = () => { }; --fcc-editable-region-- -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555de565387a2efe90a6ccc.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555de565387a2efe90a6ccc.md index 44f191d6811..04b9a44fb1a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555de565387a2efe90a6ccc.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555de565387a2efe90a6ccc.md @@ -16,7 +16,7 @@ Don't forget you need template interpolation here, so you need to use backticks. You should not modify the existing `setPlayButtonAccessibleText` function and its content. ```js -assert.match(code, /const\s+setPlayButtonAccessibleText\s*=\s*\(\)\s*=>\s*\{\s*const\s+song\s*=\s*userData\?\.currentSong\s*\|\|\s*userData\?\.songs\[0\];?\s*.*\s*.*\s*.*\s*.*\s*\};?/) +assert.match(code, /const\s+setPlayButtonAccessibleText\s*=\s*\(\s*\)\s*=>\s*\{\s*const\s+song\s*=\s*userData\?\.currentSong\s*\|\|\s*userData\?\.songs\s*\[\s*0\s*\]\s*;?\s*.*\s*.*\s*.*\s*.*\s*\};?/) ``` You should use the `setAttribute()` method on `playButton`. @@ -632,7 +632,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -722,7 +722,7 @@ const setPlayButtonAccessibleText = () => { }; --fcc-editable-region-- -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e04aeb225bfbae237344.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e04aeb225bfbae237344.md index f188670fb16..97bbe40f014 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e04aeb225bfbae237344.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e04aeb225bfbae237344.md @@ -14,7 +14,7 @@ Now, call the `setPlayButtonAccessibleText` function inside the `playSong` funct You should call the `setPlayButtonAccessibleText` inside your `playSong` function. ```js -assert.match(code, /setPlayButtonAccessibleText\(\);?/) +assert.match(code, /setPlayButtonAccessibleText\(\s*\);?/) ``` # --seed-- @@ -612,7 +612,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -707,7 +707,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e0bfe4d69904410f7cd3.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e0bfe4d69904410f7cd3.md index 2876ce7e386..911f4ff74b8 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e0bfe4d69904410f7cd3.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e0bfe4d69904410f7cd3.md @@ -28,13 +28,13 @@ assert.isFunction(shuffle) Your `shuffle` function should use an arrow syntax and should not take a parameter. ```js -assert.match(code, /const\s+shuffle\s*=\s*\(\)\s*=>\s*/) +assert.match(code, /const\s+shuffle\s*=\s*\(\s*\)\s*=>\s*/) ``` Your `shuffle` function should be empty. ```js -assert.match(code, /const\s+shuffle\s*=\s*\(\)\s*=>\s*\{\n?\s*?\};?/) +assert.match(code, /const\s+shuffle\s*=\s*\(\s*\)\s*=>\s*\{\n?\s*?\};?/) ``` # --seed-- @@ -632,7 +632,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -729,7 +729,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e39a5f4c6f138c7d9405.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e39a5f4c6f138c7d9405.md index fe8d6f9019b..dbae70d71f5 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e39a5f4c6f138c7d9405.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e39a5f4c6f138c7d9405.md @@ -24,7 +24,7 @@ Use the `sort()` method on the `userData?.songs` array. Pass a callback to the m You should not modify the existing `shuffle` function. ```js -assert.match(code, /const\s+shuffle\s*=\s*\(\)\s*=>\s*{\s*[\s\S]*?\};?/); +assert.match(code, /const\s+shuffle\s*=\s*\(\s*\)\s*=>\s*{\s*[\s\S]*?\};?/); ``` You should use the `sort()` method on `userData?.songs`. @@ -42,7 +42,7 @@ assert.match(code, /userData\?\.songs\.sort\(\s*\(\s*\)\s*=>\s*/) The callback of your `sort()` method should return `Math.random() - 0.5`. ```js -assert.match(code, /userData\?.songs\.sort\s*\(\(\)\s*=>(\s*{\s*return\s+Math\.random\(\)\s*-\s*0\.5\s*;?\s*}\s*)|(\s*Math\.random\(\)\s*-\s*0\.5\s*)\);?/); +assert.match(code, /userData\?.songs\.sort\s*\(\s*\(\s*\)\s*=>(\s*{\s*return\s+Math\.random\(\s*\)\s*-\s*0\.5\s*;?\s*}\s*)|(\s*Math\.random\(\s*\)\s*-\s*0\.5\s*)\s*\);?/); ``` # --seed-- @@ -640,7 +640,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -739,7 +739,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e57d3e6d9d221c4735be.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e57d3e6d9d221c4735be.md index 0b8ff3820ca..1f2ffefc8c0 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e57d3e6d9d221c4735be.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e57d3e6d9d221c4735be.md @@ -11,6 +11,8 @@ When the shuffle button is pressed, you want to set the `currentSong` to nothing Set `userData.currentSong` to `null` and `userData.songCurrentTime` to `0`. +*Note*: You should not use optional chaining for this step because you are explicitly setting the `currentSong` and `songCurrentTime` properties to be `null` and `0` respectively. + # --hints-- You should set `userData.currentSong` to `null`. @@ -620,7 +622,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -720,7 +722,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e6cec786da2aadc11ea0.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e6cec786da2aadc11ea0.md index cce3e3960ef..c8eb8a8c7e1 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e6cec786da2aadc11ea0.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e6cec786da2aadc11ea0.md @@ -16,31 +16,31 @@ Call the `renderSongs` function and pass in `userData?.songs` as an argument. Al You should not modify the existing `shuffle` function and its content. ```js -assert.match(code, /const\s+shuffle\s*=\s*\(\)\s*=>\s*\{\s*userData\?\.songs\.sort\(\(\)\s*=>\s*Math\.random\(\)\s*-\s*0\.5\);?\s*userData\.currentSong\s*=\s*null;\s*userData\.songCurrentTime\s*=\s*0;?\s*.*\s*.*\s*.*\s*.*\s*\};?/) +assert.match(code, /const\s+shuffle\s*=\s*\(\s*\)\s*=>\s*\{\s*userData\?\.songs\.sort\(\s*\(\s*\)\s*=>\s*Math\.random\(\s*\)\s*-\s*0\.5\s*\);?\s*userData\.currentSong\s*=\s*null;\s*userData\.songCurrentTime\s*=\s*0;?\s*.*\s*.*\s*.*\s*.*\s*\};?/) ``` You should call the `renderSongs` function with `userData?.songs`. ```js -assert.match(code, /const\s+shuffle\s*=\s*\(\)\s*=>\s*\{\s*userData\?\.songs\.sort\(\(\)\s*=>\s*Math\.random\(\)\s*-\s*0\.5\);?\s*userData\.currentSong\s*=\s*null;\s*userData\.songCurrentTime\s*=\s*0;?\s*renderSongs\(userData\?\.songs\);?\s*.*\s*.*\s*.*\s*\};?/) +assert.match(code, /const\s+shuffle\s*=\s*\(\s*\)\s*=>\s*\{\s*userData\?\.songs\.sort\(\s*\(\s*\)\s*=>\s*Math\.random\(\s*\)\s*-\s*0\.5\s*\);?\s*userData\.currentSong\s*=\s*null;\s*userData\.songCurrentTime\s*=\s*0;?\s*renderSongs\(\s*userData\?\.songs\s*\);?\s*.*\s*.*\s*.*\s*\};?/) ``` You should call the `pauseSong` function. ```js -assert.match(code, /const\s+shuffle\s*=\s*\(\)\s*=>\s*\{\s*userData\?\.songs\.sort\(\(\)\s*=>\s*Math\.random\(\)\s*-\s*0\.5\);?\s*userData\.currentSong\s*=\s*null;\s*userData\.songCurrentTime\s*=\s*0;?\s*renderSongs\(userData\?\.songs\);?\s*pauseSong\(\);?\s*.*\s*.*\s*\};?/) +assert.match(code, /const\s+shuffle\s*=\s*\(\s*\)\s*=>\s*\{\s*userData\?\.songs\.sort\(\s*\(\s*\)\s*=>\s*Math\.random\(\s*\)\s*-\s*0\.5\s*\);?\s*userData\.currentSong\s*=\s*null;\s*userData\.songCurrentTime\s*=\s*0;?\s*renderSongs\(\s*userData\?\.songs\s*\);?\s*pauseSong\(\s*\);?\s*.*\s*.*\s*\};?/) ``` You should call the `setPlayerDisplay` function. ```js -assert.match(code, /const\s+shuffle\s*=\s*\(\)\s*=>\s*\{\s*userData\?\.songs\.sort\(\(\)\s*=>\s*Math\.random\(\)\s*-\s*0\.5\);?\s*userData\.currentSong\s*=\s*null;\s*userData\.songCurrentTime\s*=\s*0;?\s*renderSongs\(userData\?\.songs\);?\s*pauseSong\(\);?\s*setPlayerDisplay\(\);?\s*.*\s*\};?/) +assert.match(code, /const\s+shuffle\s*=\s*\(\s*\)\s*=>\s*\{\s*userData\?\.songs\.sort\(\s*\(\s*\)\s*=>\s*Math\.random\(\s*\)\s*-\s*0\.5\s*\);?\s*userData\.currentSong\s*=\s*null;\s*userData\.songCurrentTime\s*=\s*0;?\s*renderSongs\(\s*userData\?\.songs\s*\);?\s*pauseSong\(\s*\);?\s*setPlayerDisplay\(\s*\);?\s*.*\s*\};?/) ``` You should call the `setPlayButtonAccessibleText` function. ```js -assert.match(code, /const\s+shuffle\s*=\s*\(\)\s*=>\s*\{\s*userData\?\.songs\.sort\(\(\)\s*=>\s*Math\.random\(\)\s*-\s*0\.5\);?\s*userData\.currentSong\s*=\s*null;\s*userData\.songCurrentTime\s*=\s*0;?\s*renderSongs\(userData\?\.songs\);?\s*pauseSong\(\);?\s*setPlayerDisplay\(\);?\s*setPlayButtonAccessibleText\(\);?\s*\};?/) +assert.match(code, /const\s+shuffle\s*=\s*\(\s*\)\s*=>\s*\{\s*userData\?\.songs\.sort\(\s*\(\s*\)\s*=>\s*Math\.random\(\s*\)\s*-\s*0\.5\s*\);?\s*userData\.currentSong\s*=\s*null;\s*userData\.songCurrentTime\s*=\s*0;?\s*renderSongs\(\s*userData\?\.songs\s*\);?\s*pauseSong\(\s*\);?\s*setPlayerDisplay\(\s*\);?\s*setPlayButtonAccessibleText\(\s*\);?\s*\};?/) ``` # --seed-- @@ -638,7 +638,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -741,7 +741,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e7acdbae972d3e8e0f5b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e7acdbae972d3e8e0f5b.md index bd5bbe173df..d3acfc8a47e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e7acdbae972d3e8e0f5b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e7acdbae972d3e8e0f5b.md @@ -22,13 +22,13 @@ assert.match(code, /shuffleButton\.addEventListener\(/) Your event listener should listen for a `click` event. ```js -assert.match(code, /shuffleButton\.addEventListener\(('|")click\1/) +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\(('|")click\1,\s*shuffle\);?/) +assert.match(code, /shuffleButton\.addEventListener\(\s*('|")click\1,\s*shuffle\s*\);?/) ``` # --seed-- @@ -626,7 +626,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -730,7 +730,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e9197bf1d7416bdd76e0.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e9197bf1d7416bdd76e0.md index d9e66f6ee0c..5ab90ce02a4 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e9197bf1d7416bdd76e0.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555e9197bf1d7416bdd76e0.md @@ -638,7 +638,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -746,7 +746,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555ebf07ec610585a626f72.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555ebf07ec610585a626f72.md index b6ef6eb7436..2c6779735a9 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555ebf07ec610585a626f72.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6555ebf07ec610585a626f72.md @@ -7,7 +7,7 @@ dashedName: step-73 # --description-- -Use the `filter()` method to remove the song object that matches the `id` parameter from the `userData.songs` array. +Use the `filter()` method to remove the song object that matches the `id` parameter from the `userData?.songs` array. The `filter` method keeps only the elements of an array that satisfy the callback function passed to it: @@ -20,12 +20,14 @@ console.log(numsGreaterThanThree) // Output: [10, 8, 4, 5] Use the `filter()` method on `userData?.songs`. Pass in `song` as the parameter of the arrow function callback and use implicit return to check if `song.id` is strictly not equal to `id`. Assign all of that to the `userData.songs`. +*Note*: You should not use optional chaining when you assign the result of `userData?.songs.filter` to `userData.songs` because the `allSongs` array will not be `undefined` or `null` at that point. + # --hints-- You should not modify the existing `deleteSong` function. ```js -assert.match(code, /const\s+deleteSong\s*=\s*\(id\)\s*=>\s*\{\s*.*\s*\};?/) +assert.match(code, /const\s+deleteSong\s*=\s*\(\s*id\s*\)\s*=>\s*\{\s*.*\s*\};?/) ``` You should use the `filter()` method on `userData?.songs`. @@ -647,7 +649,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -757,7 +759,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65571e742fbf4532d8f98e90.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65571e742fbf4532d8f98e90.md index 5b1c0d06652..719bdf58497 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65571e742fbf4532d8f98e90.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65571e742fbf4532d8f98e90.md @@ -18,25 +18,25 @@ After that, call the `highlightCurrentSong` function to highlight the current so You should not modify the existing `deleteSong` function and its content. ```js -assert.match(code, /const\s+deleteSong\s*=\s*\(id\)\s*=>\s*\{\s*userData\.songs\s*=\s*userData\?\.songs\.filter\(\(song\)\s*=>\s*song\.id\s*!==\s*id\);?\s*.*\s*.*\s*.*\s*\};?/) +assert.match(code, /const\s+deleteSong\s*=\s*\(\s*id\s*\)\s*=>\s*\{\s*userData\.songs\s*=\s*userData\?\.songs\.filter\(\s*\(\s*song\s*\)\s*=>\s*song\.id\s*!==\s*id\s*\);?\s*.*\s*.*\s*.*\s*\};?/) ``` You should call the `renderSongs` function with `userData?.songs`. ```js -assert.match(code, /const\s+deleteSong\s*=\s*\(id\)\s*=>\s*\{\s*userData\.songs\s*=\s*userData\?\.songs\.filter\(\(song\)\s*=>\s*song\.id\s*!==\s*id\);?\s*renderSongs\(userData\?\.songs\);?\s*.*\s*.*\s*\};?/) +assert.match(code, /const\s+deleteSong\s*=\s*\(\s*id\s*\)\s*=>\s*\{\s*userData\.songs\s*=\s*userData\?\.songs\.filter\(\s*\(\s*song\s*\)\s*=>\s*song\.id\s*!==\s*id\s*\);?\s*renderSongs\(\s*userData\?\.songs\s*\);?\s*.*\s*.*\s*\};?/) ``` You should call the `highlightCurrentSong` function. ```js -assert.match(code, /const\s+deleteSong\s*=\s*\(id\)\s*=>\s*\{\s*userData\.songs\s*=\s*userData\?\.songs\.filter\(\(song\)\s*=>\s*song\.id\s*!==\s*id\);?\s*renderSongs\(userData\?\.songs\);?\s*highlightCurrentSong\(\);?\s*.*\s*\};?/) +assert.match(code, /const\s+deleteSong\s*=\s*\(\s*id\s*\)\s*=>\s*\{\s*userData\.songs\s*=\s*userData\?\.songs\.filter\(\s*\(\s*song\s*\)\s*=>\s*song\.id\s*!==\s*id\s*\);?\s*renderSongs\(\s*userData\?\.songs\s*\);?\s*highlightCurrentSong\(\s*\);?\s*.*\s*\};?/) ``` You should call the `setPlayButtonAccessibleText` function. ```js -assert.match(code, /const\s+deleteSong\s*=\s*\(id\)\s*=>\s*\{\s*userData\.songs\s*=\s*userData\?\.songs\.filter\(\(song\)\s*=>\s*song\.id\s*!==\s*id\);?\s*renderSongs\(userData\?\.songs\);?\s*highlightCurrentSong\(\);?\s*setPlayButtonAccessibleText\(\);?\s*\};?/) +assert.match(code, /const\s+deleteSong\s*=\s*\(\s*id\s*\)\s*=>\s*\{\s*userData\.songs\s*=\s*userData\?\.songs\.filter\(\s*\(\s*song\s*\)\s*=>\s*song\.id\s*!==\s*id\s*\);?\s*renderSongs\(\s*userData\?\.songs\s*\);?\s*highlightCurrentSong\(\s*\);?\s*setPlayButtonAccessibleText\(\s*\);?\s*\};?/) ``` # --seed-- @@ -634,7 +634,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -745,7 +745,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655720534347cb3f31cdfb3d.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655720534347cb3f31cdfb3d.md index 72dc34a6dc4..974b693f0e5 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655720534347cb3f31cdfb3d.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655720534347cb3f31cdfb3d.md @@ -16,7 +16,7 @@ Use an `if` statement to check if the `userData?.currentSong?.id` is equal to th You should create an empty `if` statement with the condition `userData?.currentSong?.id === id`. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\?\.id\s*===\s*id\)\s*\{\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\?\.id\s*===\s*id\s*\)\s*\{\s*\}/) ``` # --seed-- @@ -614,7 +614,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -730,7 +730,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572399a8e16d50bc2c1ff3.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572399a8e16d50bc2c1ff3.md index a0db51e3247..b99fd08fe67 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572399a8e16d50bc2c1ff3.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572399a8e16d50bc2c1ff3.md @@ -16,31 +16,31 @@ After that, call the `pauseSong()` function to stop the playback and the `setPla You should not modify the existing `if` statement and its content. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\?\.id\s*===\s*id\)\s*\{\s*.*\s*.*\s*.*\s*.*\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\?\.id\s*===\s*id\s*\)\s*\{\s*.*\s*.*\s*.*\s*.*\s*\}/) ``` You should set `userData.currentSong` to `null`. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\?\.id\s*===\s*id\)\s*\{\s*userData\.currentSong\s*=\s*null;?\s*.*\s*.*\s*.*\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\?\.id\s*===\s*id\s*\)\s*\{\s*userData\.currentSong\s*=\s*null;?\s*.*\s*.*\s*.*\s*\}/) ``` You should set `userData.songCurrentTime` to `0`. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\?\.id\s*===\s*id\)\s*\{\s*userData\.currentSong\s*=\s*null;?\s*userData\.songCurrentTime\s*=\s*0;?\s*.*\s*.*\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\?\.id\s*===\s*id\s*\)\s*\{\s*userData\.currentSong\s*=\s*null;?\s*userData\.songCurrentTime\s*=\s*0;?\s*.*\s*.*\s*\}/) ``` You should call the `pauseSong` function. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\?\.id\s*===\s*id\)\s*\{\s*userData\.currentSong\s*=\s*null;?\s*userData\.songCurrentTime\s*=\s*0;?\s*pauseSong\(\);?\s*.*\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\?\.id\s*===\s*id\s*\)\s*\{\s*userData\.currentSong\s*=\s*null;?\s*userData\.songCurrentTime\s*=\s*0;?\s*pauseSong\(\s*\);?\s*.*\s*\}/) ``` You should call the `setPlayerDisplay` function. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\?\.id\s*===\s*id\)\s*\{\s*userData\.currentSong\s*=\s*null;?\s*userData\.songCurrentTime\s*=\s*0;?\s*pauseSong\(\);?\s*setPlayerDisplay\(\);?\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\?\.id\s*===\s*id\s*\)\s*\{\s*userData\.currentSong\s*=\s*null;?\s*userData\.songCurrentTime\s*=\s*0;?\s*pauseSong\(\s*\);?\s*setPlayerDisplay\(\s*\);?\s*\}/) ``` # --seed-- @@ -638,7 +638,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -755,7 +755,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655724bac464795a0ad91082.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655724bac464795a0ad91082.md index b32e306e9ed..b27131aaa23 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655724bac464795a0ad91082.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655724bac464795a0ad91082.md @@ -9,14 +9,14 @@ dashedName: step-78 Next, you need to check if the playlist is empty. If it is, you should reset the `userData` object to its original state. -Use an `if` statement to check if the `userData.songs` has a length of `0`. +Use an `if` statement to check if the `userData?.songs` has a length of `0`. # --hints-- -You should create an empty `if` statement with the condition `userData.songs.length === 0` +You should create an empty `if` statement with the condition `userData?.songs.length === 0`. ```js -assert.match(code, /if\s*\(userData\.songs\.length\s*===\s*0\)\s*\{\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.songs\.length\s*===\s*0\s*\)\s*\{\s*\}/) ``` # --seed-- @@ -614,7 +614,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -738,7 +738,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655727b2e1e49d6adf584442.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655727b2e1e49d6adf584442.md index dad0ddfd188..e1f1afcd856 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655727b2e1e49d6adf584442.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655727b2e1e49d6adf584442.md @@ -33,19 +33,19 @@ Inside your `if` statement, declare a `resetButton` constant, then use `createEl You should not modify the existing `if` statement and its content. ```js -assert.match(code, /if\s*\(userData\.songs\.length\s*===\s*0\)\s*\{\s*.*\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.songs\.length\s*===\s*0\s*\)\s*\{\s*.*\s*\}/) ``` You should use the `createElement` method to create a `button`. ```js -assert.match(code, /document\.createElement\(('|")button\1\);?/) +assert.match(code, /document\.createElement\(\s*('|")button\1\s*\);?/) ``` You should assign your newly created `button` element to a `resetButton` constant. ```js -assert.match(code, /const\s+resetButton\s*=\s*document\.createElement\(('|")button\1\);?/) +assert.match(code, /const\s+resetButton\s*=\s*document\.createElement\(\s*('|")button\1\s*\);?/) ``` # --seed-- @@ -643,7 +643,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -708,7 +708,7 @@ const deleteSong = (id) => { setPlayButtonAccessibleText(); --fcc-editable-region-- - if (userData.songs.length === 0) { + if (userData?.songs.length === 0) { } --fcc-editable-region-- @@ -769,7 +769,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655729e68e49b277a6b448bd.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655729e68e49b277a6b448bd.md index 06b7509ed6a..8aa85dd2cdb 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655729e68e49b277a6b448bd.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655729e68e49b277a6b448bd.md @@ -18,7 +18,7 @@ Set the `id` attribute of `resetButton` to `reset` and its `aria-label` attribut You should not modify the existing `if` statement and its content. ```js -assert.match(code, /if\s*\(userData\.songs\.length\s*===\s*0\)\s*\{\s*const\s+resetButton\s*=\s*document\.createElement\(('|")button\1\);?\s*.*\s*.*\s*.*\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.songs\.length\s*===\s*0\s*\)\s*\{\s*const\s+resetButton\s*=\s*document\.createElement\(\s*('|")button\1\s*\);?\s*.*\s*.*\s*.*\s*\}/) ``` You should use `resetButton.id` to create an `id` attribute named `reset` for the `resetButton`. @@ -628,7 +628,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -693,7 +693,7 @@ const deleteSong = (id) => { setPlayButtonAccessibleText(); --fcc-editable-region-- - if (userData.songs.length === 0) { + if (userData?.songs.length === 0) { const resetButton = document.createElement("button"); const resetText = document.createTextNode("Reset Playlist"); @@ -757,7 +757,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572bb34a7e488224b937fc.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572bb34a7e488224b937fc.md index ee40d9aa338..3ea189e33f2 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572bb34a7e488224b937fc.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572bb34a7e488224b937fc.md @@ -32,7 +32,7 @@ assert.match(code, /resetButton\.appendChild\(/) You should pass in `resetText` as the value of your first `appendChild()`. ```js -assert.match(code, /resetButton\.appendChild\(resetText\);?/) +assert.match(code, /resetButton\.appendChild\(\s*resetText\s*\);?/) ``` You should use the `appendChild()` method on `playlistSongs`. @@ -44,7 +44,7 @@ assert.match(code, /playlistSongs\.appendChild\(/) You should pass in `resetButton` as the value of your second `appendChild()`. ```js -assert.match(code, /playlistSongs\.appendChild\(resetButton\);?/) +assert.match(code, /playlistSongs\.appendChild\(\s*resetButton\s*\);?/) ``` # --seed-- @@ -642,7 +642,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -706,7 +706,7 @@ const deleteSong = (id) => { highlightCurrentSong(); setPlayButtonAccessibleText(); - if (userData.songs.length === 0) { + if (userData?.songs.length === 0) { const resetButton = document.createElement("button"); const resetText = document.createTextNode("Reset Playlist"); @@ -773,7 +773,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572e5aaf022790fb4a81b1.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572e5aaf022790fb4a81b1.md index 8f6b2e34e8d..d56a149fe7b 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572e5aaf022790fb4a81b1.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65572e5aaf022790fb4a81b1.md @@ -22,13 +22,13 @@ assert.match(code, /resetButton\.addEventListener\(/) Your `resetButton` event listener should listen for a `click` event. ```js -assert.match(code, /resetButton\.addEventListener\(('|")click\1/) +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\(('|")click\1,\s*\(\s*\)\s*=>\s*\{\s*\}\);?/) +assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1,\s*\(\s*\)\s*=>\s*\{\s*\}\s*\);?/) ``` # --seed-- @@ -626,7 +626,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -690,7 +690,7 @@ const deleteSong = (id) => { highlightCurrentSong(); setPlayButtonAccessibleText(); - if (userData.songs.length === 0) { + if (userData?.songs.length === 0) { const resetButton = document.createElement("button"); const resetText = document.createTextNode("Reset Playlist"); @@ -760,7 +760,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655737cd004591b0271d6826.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655737cd004591b0271d6826.md index 61b5ff2e425..b9b671125ae 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655737cd004591b0271d6826.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655737cd004591b0271d6826.md @@ -7,22 +7,22 @@ dashedName: step-84 # --description-- -You need to assign the `userData.songs` property to the initial `allSongs` array. This will reset the playlist to its original state. +To reset the playlist to its original state, spread `allSongs` into an array and assign it to `userData.songs`. -Spread `allSongs` into an array and assign it to `userData.songs`. +*Note*: You should not use optional chaining for the `userData.songs` because the song will not be `null` or `undefined` at this point. # --hints-- You should not modify the existing event listener and its content. ```js -assert.match(code, /resetButton\.addEventListener\(('|")click\1,\s*\(\s*\)\s*=>\s*\{\s*.*\s*\}\);?/) +assert.match(code, /resetButton\.addEventListener\(\s*('|")click\1,\s*\(\s*\)\s*=>\s*\{\s*.*\s*\}\s*\);?/) ``` You should assign `[...allSongs]` to `userData.songs`. ```js -assert.match(code, /userData\.songs\s*=\s*\[\.\.\.allSongs\]/) +assert.match(code, /userData\.songs\s*=\s*\[\s*\.\.\.allSongs\s*\]/) ``` # --seed-- @@ -620,7 +620,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -684,7 +684,7 @@ const deleteSong = (id) => { highlightCurrentSong(); setPlayButtonAccessibleText(); - if (userData.songs.length === 0) { + if (userData?.songs.length === 0) { const resetButton = document.createElement("button"); const resetText = document.createTextNode("Reset Playlist"); @@ -757,7 +757,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573a97c59ddbbf028ca95e.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573a97c59ddbbf028ca95e.md index 50523852991..93920f0b724 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573a97c59ddbbf028ca95e.md +++ b/curriculum/challenges/arabic/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\(('|")click\1,\s*\(\)\s*=>\s*\{\s*userData\.songs\s*=\s*\[\.\.\.allSongs\];?\s*.*\s*.*\s*.*\s*\}\);?/) +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*\);?/) ``` You should call the `renderSongs` function with `userData?.songs`. ```js -assert.match(code, /resetButton\.addEventListener\(('|")click\1,\s*\(\)\s*=>\s*\{\s*userData\.songs\s*=\s*\[\.\.\.allSongs\];?\s*renderSongs\(userData\?\.songs\);?\s*.*\s*.*\s*\}\);?/) +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*\);?/) ``` You should call the `setPlayButtonAccessibleText` function. ```js -assert.match(code, /resetButton\.addEventListener\(('|")click\1,\s*\(\)\s*=>\s*\{\s*userData\.songs\s*=\s*\[\.\.\.allSongs\];?\s*renderSongs\(userData\?\.songs\);?\s*setPlayButtonAccessibleText\(\);?\s*.*\s*\}\);?/) +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*\);?/) ``` You should use the `remove()` method to remove the `resetButton` from the DOM. ```js -assert.match(code, /resetButton\.addEventListener\(('|")click\1,\s*\(\)\s*=>\s*\{\s*userData\.songs\s*=\s*\[\.\.\.allSongs\];?\s*renderSongs\(userData\?\.songs\);?\s*setPlayButtonAccessibleText\(\);?\s*resetButton\.remove\(\);?\s*\}\);?/) +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*\);?/) ``` # --seed-- @@ -638,7 +638,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -702,7 +702,7 @@ const deleteSong = (id) => { highlightCurrentSong(); setPlayButtonAccessibleText(); - if (userData.songs.length === 0) { + if (userData?.songs.length === 0) { const resetButton = document.createElement("button"); const resetText = document.createTextNode("Reset Playlist"); @@ -776,7 +776,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573d0abe4d38cd6fa13f44.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573d0abe4d38cd6fa13f44.md index 5cd14a1cbf7..fd465c4bff6 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573d0abe4d38cd6fa13f44.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65573d0abe4d38cd6fa13f44.md @@ -24,13 +24,13 @@ assert.match(code, /audio\.addEventListener\(/) The event listener you used on on your `audio` variable should listen for an `ended` event. ```js -assert.match(code, /audio\.addEventListener\(('|")ended\1/) +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\(('|")ended\1,\s*\(\s*\)\s*=>\s*\{\s*\}\);?/) +assert.match(code, /audio\.addEventListener\(\s*('|")ended\1,\s*\(\s*\)\s*=>\s*\{\s*\}\s*\);?/) ``` @@ -629,7 +629,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -693,7 +693,7 @@ const deleteSong = (id) => { highlightCurrentSong(); setPlayButtonAccessibleText(); - if (userData.songs.length === 0) { + if (userData?.songs.length === 0) { const resetButton = document.createElement("button"); const resetText = document.createTextNode("Reset Playlist"); @@ -768,7 +768,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6557421eb6a7a0f0500e3106.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6557421eb6a7a0f0500e3106.md index ef9cbca1e47..0ab2bbc31be 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6557421eb6a7a0f0500e3106.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/6557421eb6a7a0f0500e3106.md @@ -7,14 +7,14 @@ dashedName: step-77 # --description-- -Within the button element in the `renderSongs` function, add an `onclick` attribute as the first attribute. For the value, call the `deleteSong` function and interpolate `song.id`. +Within the button element in the `renderSongs` function, add an `onclick` attribute. For the value, call the `deleteSong` function and interpolate `song.id`. # --hints-- -You should add an `onclick` attribute as the first attribute of the delete button and pass in `deleteSong(${song.id})`. +You should add an `onclick` attribute to the delete button and pass in `deleteSong(${song.id})`. ```js -assert.match(code, //) +assert.match(code, //) ``` # --seed-- @@ -612,7 +612,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -734,7 +734,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b49333d9f265bc1512152.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b49333d9f265bc1512152.md index 47c836472af..4fda36289b7 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b49333d9f265bc1512152.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b49333d9f265bc1512152.md @@ -7,30 +7,35 @@ dashedName: step-87 # --description-- -Notice that the album art in the HTML and songs in the `allSongs` array have changed. We've swapped out the original songs for shorter ones that you can use to test your app in the upcoming steps. +Notice that the album art in the HTML and songs in the `userData.songs` array have changed. We've swapped out the original songs for shorter ones that you can use to test your app in the upcoming steps. Next, you need to check if there is a next song to play. Retrieve the current song index by calling the `getCurrentSongIndex()` function, and save it in a `currentSongIndex` constant. -After that, create a `nextSongExists` constant that checks if a next song exists. +After that, create a `nextSongExists` constant that contains the boolean value `true` or `false` depending on if the next song exists. # --hints-- You should not modify the existing `ended` event listener and its content. ```js -assert.match(code, /audio\.addEventListener\(('|")ended\1,\s*\(\)\s*=>\s*\{\s*.*\s*.*\s*\}\);?/) +assert.match(code, /audio\.addEventListener\(\s*('|")ended\1,\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\(('|")ended\1,\s*\(\)\s*=>\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\);?\s*.*\s*\}\);?/) +assert.match(code, /audio\.addEventListener\(\s*('|")ended\1,\s*\(\s*\)\s*=>\s*\{\s*const\s+currentSongIndex\s*=\s*getCurrentSongIndex\(\s*\);?\s*.*\s*\}\s*\);?/) ``` -You should check if a next song exists with `userData?.songs[currentSongIndex + 1] !== undefined` and set it to a `nextSongExists` constant. +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. ```js -assert.match(code, /const\s+nextSongExists\s*=\s*userData\?\.songs\[currentSongIndex\s*\+\s*1\]\s*!==\s*undefined;?/) +const secondPart = code.split(`audio.addEventListener("ended", () => {`)[1]; +const middlePart = secondPart.split("});")[0] +const codeOutputFirstTest = eval(middlePart + "\nnextSongExists;"); +assert.strictEqual(codeOutputFirstTest, true); +const codeOutputSecondTest = eval(`\nfunction getCurrentSongIndex() { return 100; };\n` + middlePart + "\nnextSongExists;") +assert.strictEqual(codeOutputSecondTest, false); ``` # --seed-- @@ -593,7 +598,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -657,7 +662,7 @@ const deleteSong = (id) => { highlightCurrentSong(); setPlayButtonAccessibleText(); - if (userData.songs.length === 0) { + if (userData?.songs.length === 0) { const resetButton = document.createElement("button"); const resetText = document.createTextNode("Reset Playlist"); @@ -732,7 +737,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b4bbff1dbf66cb2ed4dac.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b4bbff1dbf66cb2ed4dac.md index 04e46a4ab73..cedafb01fea 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b4bbff1dbf66cb2ed4dac.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b4bbff1dbf66cb2ed4dac.md @@ -14,13 +14,13 @@ Use an `if` statement to check if `nextSongExists` exists, then call the `playNe You should create an `if` statement with the condition `nextSongExists`. ```js -assert.match(code, /if\s*\(nextSongExists\)\s*\{\s*/) +assert.match(code, /if\s*\(\s*nextSongExists\s*\)\s*\{\s*/) ``` You should call the `playNextSong` function inside your `if` statement. ```js -assert.match(code, /if\s*\(nextSongExists\)\s*\{\s*playNextSong\(\);?\s*\}/) +assert.match(code, /if\s*\(\s*nextSongExists\s*\)\s*\{\s*playNextSong\(\s*\);?\s*\}/) ``` # --seed-- @@ -583,7 +583,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -647,7 +647,7 @@ const deleteSong = (id) => { highlightCurrentSong(); setPlayButtonAccessibleText(); - if (userData.songs.length === 0) { + if (userData?.songs.length === 0) { const resetButton = document.createElement("button"); const resetText = document.createTextNode("Reset Playlist"); @@ -722,7 +722,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b4c8f636d9675953a0388.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b4c8f636d9675953a0388.md index d0ea1ef5e85..b83c088cd3f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b4c8f636d9675953a0388.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b4c8f636d9675953a0388.md @@ -14,25 +14,25 @@ If there is no next song in the playlist, use the `else` block to reset the `cur You should not modify the existing `if` statement and its content. ```js -assert.match(code, /if\s*\(nextSongExists\)\s*\{\s*playNextSong\(\);?\s*.*\s*.*\s*.*\s*\};?/) +assert.match(code, /if\s*\(\s*nextSongExists\s*\)\s*\{\s*playNextSong\(\s*\);?\s*.*\s*.*\s*.*\s*\};?/) ``` Your `if` statement should have an `else` block. ```js -assert.match(code, /if\s*\(nextSongExists\)\s*\{\s*playNextSong\(\);?\s*\}\s*else\s*\{\s*.*\s*.*\s*\};?/) +assert.match(code, /if\s*\(\s*nextSongExists\s*\)\s*\{\s*playNextSong\(\s*\);?\s*\}\s*else\s*\{\s*.*\s*.*\s*\};?/) ``` You should use dot notation to set the `currentSong` property of `userData` to `null` in the `else` block of your `if` statement. ```js -assert.match(code, /if\s*\(nextSongExists\)\s*\{\s*playNextSong\(\);?\s*\}\s*else\s*\{\s*userData\.currentSong\s*=\s*null;?\s*.*\s*\};?/) +assert.match(code, /if\s*\(\s*nextSongExists\s*\)\s*\{\s*playNextSong\(\s*\);?\s*\}\s*else\s*\{\s*userData\.currentSong\s*=\s*null;?\s*.*\s*\};?/) ``` You should use dot notation to set the `songCurrentTime` property of `userData` to `0` in the `else` block of your `if`statement. ```js -assert.match(code, /if\s*\(nextSongExists\)\s*\{\s*playNextSong\(\);?\s*\}\s*else\s*\{\s*userData\.currentSong\s*=\s*null;?\s*userData\.songCurrentTime\s*=\s*0;?\s*\};?/) +assert.match(code, /if\s*\(\s*nextSongExists\s*\)\s*\{\s*playNextSong\(\s*\);?\s*\}\s*else\s*\{\s*userData\.currentSong\s*=\s*null;?\s*userData\.songCurrentTime\s*=\s*0;?\s*\};?/) ``` # --seed-- @@ -595,7 +595,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -659,7 +659,7 @@ const deleteSong = (id) => { highlightCurrentSong(); setPlayButtonAccessibleText(); - if (userData.songs.length === 0) { + if (userData?.songs.length === 0) { const resetButton = document.createElement("button"); const resetText = document.createTextNode("Reset Playlist"); @@ -734,7 +734,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b4dad1d38ff7cdd65cbfe.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b4dad1d38ff7cdd65cbfe.md index 0f35a24a07e..d018700ab70 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b4dad1d38ff7cdd65cbfe.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/655b4dad1d38ff7cdd65cbfe.md @@ -17,28 +17,28 @@ You should call the `pauseSong` function. ```js const splitter = code.split('audio.addEventListener("ended", () => {') -assert.match(splitter[1], /pauseSong\(\);?/) +assert.match(splitter[1], /pauseSong\(\s*\);?/) ``` You should call the `setPlayerDisplay` function. ```js const splitter = code.split('audio.addEventListener("ended", () => {') -assert.match(splitter[1], /setPlayerDisplay\(\);?/) +assert.match(splitter[1], /setPlayerDisplay\(\s*\);?/) ``` You should call the `highlightCurrentSong` function. ```js const splitter = code.split('audio.addEventListener("ended", () => {') -assert.match(splitter[1], /highlightCurrentSong\(\);?/) +assert.match(splitter[1], /highlightCurrentSong\(\s*\);?/) ``` You should call the `setPlayButtonAccessibleText` function. ```js const splitter = code.split('audio.addEventListener("ended", () => {') -assert.match(splitter[1], /highlightCurrentSong\(\);?\s*setPlayButtonAccessibleText\(\);?/) +assert.match(splitter[1], /highlightCurrentSong\(\s*\);?\s*setPlayButtonAccessibleText\(\s*\);?/) ``` # --seed-- @@ -636,7 +636,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -700,7 +700,7 @@ const deleteSong = (id) => { highlightCurrentSong(); setPlayButtonAccessibleText(); - if (userData.songs.length === 0) { + if (userData?.songs.length === 0) { const resetButton = document.createElement("button"); const resetText = document.createTextNode("Reset Playlist"); @@ -775,7 +775,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { @@ -1418,7 +1418,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -1482,7 +1482,7 @@ const deleteSong = (id) => { highlightCurrentSong(); setPlayButtonAccessibleText(); - if (userData.songs.length === 0) { + if (userData?.songs.length === 0) { const resetButton = document.createElement("button"); const resetText = document.createTextNode("Reset Playlist"); @@ -1557,7 +1557,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/656071d679089ebd9d5035a0.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/656071d679089ebd9d5035a0.md index 516364530fd..7e400a4ac5e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/656071d679089ebd9d5035a0.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/656071d679089ebd9d5035a0.md @@ -26,7 +26,7 @@ Inside the `userData` object create a `songs` property. For the value, spread `a Your `userData` object should have a `songs` key set to `[...allSongs]`. ```js -assert.match(code, /songs\s*:\s*\[\s*\.\.\.allSongs\s*\],?/); +assert.match(code, /songs\s*:\s*\[\s*\.\.\.allSongs\s*\]\s*,?/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/656073a2b98232c8aca72267.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/656073a2b98232c8aca72267.md index 1b5752392d1..416f571a2ab 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/656073a2b98232c8aca72267.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/656073a2b98232c8aca72267.md @@ -14,7 +14,7 @@ To handle the current song's information and track its playback time, create a ` You should not modify the existing `userData` object and its content. ```js -assert.match(code, /let\s+userData\s*=\s*\{\s*songs:\s*\[\.\.\.allSongs\],?\s*/); +assert.match(code, /let\s+userData\s*=\s*\{\s*songs:\s*\[\s*\.\.\.allSongs\s*\]\s*,?\s*/); ``` Your `userData` object should have a `currentSong` key set to `null`. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/656472ed8f552d2f2b3f7883.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/656472ed8f552d2f2b3f7883.md index eaea549b26b..67c923e2b3a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/656472ed8f552d2f2b3f7883.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/656472ed8f552d2f2b3f7883.md @@ -9,26 +9,26 @@ dashedName: step-30 Add an `else` block to handle the current song's position in the playlist. -Within the `else` block, set the `currentTime` property of the `audio` object to the value stored in `userData.songCurrentTime`. +Within the `else` block, set the `currentTime` property of the `audio` object to the value stored in `userData?.songCurrentTime`. # --hints-- You should not modify the existing `if` statement and its content. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\s*===\s*null\s*\|\|\s*userData\?\.currentSong\.id\s*!==\s*song\.id\)\s*\{\s*audio\.currentTime\s*=\s*0;?\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\|\|\s*userData\?\.currentSong\.id\s*!==\s*song\.id\s*\)\s*\{\s*audio\.currentTime\s*=\s*0;?\s*\}/) ``` You should add an `else` block to the existing `if` block. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\s*===\s*null\s*\|\|\s*userData\?\.currentSong\.id\s*!==\s*song\.id\)\s*\{\s*audio\.currentTime\s*=\s*0;?\s*\}\s*else\s*{/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\|\|\s*userData\?\.currentSong\.id\s*!==\s*song\.id\s*\)\s*\{\s*audio\.currentTime\s*=\s*0;?\s*\}\s*else\s*{/) ``` -You should set `audio.currentTime` to `userData.songCurrentTime` inside the `else` block of your `if` statement. +You should set `audio.currentTime` to `userData?.songCurrentTime` inside the `else` block of your `if` statement. ```js -assert.match(code, /if\s*\(userData\?\.currentSong\s*===\s*null\s*\|\|\s*userData\?\.currentSong\.id\s*!==\s*song\.id\)\s*\{\s*audio\.currentTime\s*=\s*0;?\s*\}\s*else\s*{\s*audio\.currentTime\s*=\s*userData\.songCurrentTime;?\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.currentSong\s*===\s*null\s*\|\|\s*userData\?\.currentSong\.id\s*!==\s*song\.id\s*\)\s*\{\s*audio\.currentTime\s*=\s*0;?\s*\}\s*else\s*{\s*audio\.currentTime\s*=\s*userData\?\.songCurrentTime;?\s*\}/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65671421254eeb489875cdd8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65671421254eeb489875cdd8.md index 6a91762f22a..70a21266b3f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65671421254eeb489875cdd8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65671421254eeb489875cdd8.md @@ -20,7 +20,7 @@ assert.match(code, /playlistSongElements\.forEach\(\s*(\(\s*songEl\s*\)|songEl)\ You should use the `removeAttribute()` method on `songEl` and pass in `"aria-current"`. ```js -assert.match(code, /playlistSongElements\.forEach\(\s*(?:\(\s*songEl\s*\)|songEl)\s*=>\s*\{\s*songEl\.removeAttribute\(('|")aria-current\1\);?\s*\}\);?/) +assert.match(code, /playlistSongElements\.forEach\(\s*(?:\(\s*songEl\s*\)|songEl)\s*=>\s*\{\s*songEl\.removeAttribute\(\s*('|")aria-current\1\s*\);?\s*\}\s*\);?/) ``` @@ -620,7 +620,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -691,7 +691,7 @@ const renderSongs = (array) => { playlistSongs.innerHTML = songsHTML; }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65672136535209761a5cf02b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65672136535209761a5cf02b.md index 2bec12d38e9..4a0c4cdd59c 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65672136535209761a5cf02b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65672136535209761a5cf02b.md @@ -13,10 +13,10 @@ Don't forget you need to interpolate with the dollar sign here. # --hints-- -You should add an `onclick` with the value `playSong(${song.id})` as the second attribute and value of the `button` element. +You should add an `onclick` attribute with the value `playSong(${song.id})` to the `button` element. ```js -assert.match(code, /\s*\$\{song\.title\}<\/span>\s*\$\{song\.artist\}<\/span>\s*\$\{song\.duration\}<\/span>\s*<\/button>/) +assert.match(code, //) ``` # --seed-- @@ -614,7 +614,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65672adafbaa37a6cef886f7.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65672adafbaa37a6cef886f7.md index d256784f421..f5248c514c8 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65672adafbaa37a6cef886f7.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65672adafbaa37a6cef886f7.md @@ -28,19 +28,19 @@ Use the `createTextNode()` method to create a `Reset Playlist` text, then assign You should not modify the existing `if` statement and its content. ```js -assert.match(code, /if\s*\(userData\.songs\.length\s*===\s*0\)\s*\{\s*const\s+resetButton\s*=\s*document\.createElement\(('|")button\1\);?\s*.*\s*\}/) +assert.match(code, /if\s*\(\s*userData\?\.songs\.length\s*===\s*0\s*\)\s*\{\s*const\s+resetButton\s*=\s*document\.createElement\(\s*('|")button\1\s*\);?\s*.*\s*\}/) ``` You should use `document.createTextNode()` to create a `Reset Playlist` text. ```js -assert.match(code, /document\.createTextNode\(('|")Reset\s+Playlist\1\);?/) +assert.match(code, /document\.createTextNode\(\s*('|")Reset\s+Playlist\1\s*\);?/) ``` You should assign your created text node to a `resetText` constant. ```js -assert.match(code, /const\s+resetText\s*=\s*document\.createTextNode\(('|")Reset\s+Playlist\1\);?/) +assert.match(code, /const\s+resetText\s*=\s*document\.createTextNode\(\s*('|")Reset\s+Playlist\1\s*\);?/) ``` # --seed-- @@ -638,7 +638,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); @@ -703,7 +703,7 @@ const deleteSong = (id) => { setPlayButtonAccessibleText(); --fcc-editable-region-- - if (userData.songs.length === 0) { + if (userData?.songs.length === 0) { const resetButton = document.createElement("button"); @@ -766,7 +766,7 @@ const setPlayButtonAccessibleText = () => { ); }; -const getCurrentSongIndex = () => userData?.songs.indexOf(userData.currentSong); +const getCurrentSongIndex = () => userData?.songs.indexOf(userData?.currentSong); playButton.addEventListener("click", () => { if (userData?.currentSong === null) { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/657b2b0b6a48071a6db28e7a.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/657b2b0b6a48071a6db28e7a.md index 9e16b40c370..caf8f60883a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/657b2b0b6a48071a6db28e7a.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/657b2b0b6a48071a6db28e7a.md @@ -23,13 +23,13 @@ Pass in a callback function to the `map()` method. The callback function should The callback function of your `map()` method should use arrow function syntax. ```js -assert.match(code, /const\s+songsHTML\s*=\s*array\.map\(\(?.*\)?\s*=>\s*\{\s*\}\)/) +assert.match(code, /const\s+songsHTML\s*=\s*array\.map\(\s*(\(.*\)|[^()]+)\s*=>\s*\{\s*\}\s*\)/) ``` Your `map()` method should have a `song` parameter in it's callback function. ```js -assert.match(code, /const\s+songsHTML\s*=\s*array\.map\(\(?song\)?/) +assert.match(code, /const\s+songsHTML\s*=\s*array\.map\(\s*(\(\s*song\s*\)|song)/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/659b0093d7db5a1a1122b7bd.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/659b0093d7db5a1a1122b7bd.md index 5a14d8d1720..196cdfe1c37 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/659b0093d7db5a1a1122b7bd.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/659b0093d7db5a1a1122b7bd.md @@ -14,20 +14,20 @@ const animals = ["dog", "cat", "horse"]; animals.indexOf("cat") // 1 ``` -Inside your `getCurrentSongIndex` function, return `userData?.songs.indexOf()`. For the `indexOf()` argument, set it to `userData.currentSong`. +Inside your `getCurrentSongIndex` function, return `userData?.songs.indexOf()`. For the `indexOf()` argument, set it to `userData?.currentSong`. # --hints-- You should return `userData?.songs.indexOf()` inside your `getCurrentSongIndex` function. ```js -assert.match(code, /const\s+getCurrentSongIndex\s*=\s*\(\)\s*=>(\s*userData\?\.songs\.indexOf\()|(\s*{\s*return?\s+userData\?\.songs\.indexOf\()/) +assert.match(code, /const\s+getCurrentSongIndex\s*=\s*\(\s*\)\s*=>(\s*userData\?\.songs\.indexOf\(|\s*{\s*return?\s+userData\?\.songs\.indexOf\()/) ``` -You should pass in `userData.currentSong` into the `indexOf()` method. +You should pass in `userData?.currentSong` into the `indexOf()` method. ```js -assert.match(code, /const\s+getCurrentSongIndex\s*=\s*\(\)\s*=>(\s*userData\?\.songs\.indexOf\(userData\.currentSong\);?)|(\s*{\s*return\s+userData\?\.songs\.indexOf\(userData\.currentSong\);?)/) +assert.match(code, /const\s+getCurrentSongIndex\s*=\s*\(\s*\)\s*=>(\s*userData\?\.songs\.indexOf\(\s*userData\?\.currentSong\s*\);?|\s*{\s*return\s+userData\?\.songs\.indexOf\(\s*userData\?\.currentSong\s*\);?\s*})/) ``` # --seed-- @@ -625,7 +625,7 @@ const playSong = (id) => { if (userData?.currentSong === null || userData?.currentSong.id !== song.id) { audio.currentTime = 0; } else { - audio.currentTime = userData.songCurrentTime; + audio.currentTime = userData?.songCurrentTime; } userData.currentSong = song; playButton.classList.add("playing"); diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65a608b7e7c75a04ccf0c23c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65a608b7e7c75a04ccf0c23c.md index 99c3211b3e4..8bc181eee8f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65a608b7e7c75a04ccf0c23c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-basic-string-and-array-methods-by-building-a-music-player/65a608b7e7c75a04ccf0c23c.md @@ -23,7 +23,7 @@ Add the `sort()` method to `userData?.songs`. You should add the `sort()` method to `userData?.songs`. ```js -assert.match(code, /userData\?\.songs\.sort\(*.\);?/); +assert.match(code, /userData\?\.songs\.sort\(.*\);?/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641d9a19bff38d34d5a5edb8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641d9a19bff38d34d5a5edb8.md index 4ccdc2bea8f..4176be9ab8c 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641d9a19bff38d34d5a5edb8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641d9a19bff38d34d5a5edb8.md @@ -18,25 +18,25 @@ The variables will not change, so use `const` to declare them. You should use `document.getElementById()` to get the `#author-container` element. ```js -assert.match(code, /document\.getElementById\(\s*('|"|`)author\-container\1\)/); +assert.match(code, /document\.getElementById\(\s*('|"|`)author\-container\1\s*\)/); ``` You should assign the `#author-container` element to the variable `authorContainer`. Don't forget to use `const` to declare the variable. ```js -assert.match(code, /const\s+authorContainer\s*\=\s*document\.getElementById\(\s*('|"|`)author\-container\1\)/); +assert.match(code, /const\s+authorContainer\s*\=\s*document\.getElementById\(\s*('|"|`)author\-container\1\s*\)/); ``` You should use `document.getElementById()` to get the `#load-more-btn` element. ```js -assert.match(code, /document\.getElementById\(\s*('|"|`)load\-more\-btn\1\)/); +assert.match(code, /document\.getElementById\(\s*('|"|`)load\-more\-btn\1\s*\)/); ``` You should assign the `#load-more-btn` element to the variable `loadMoreBtn`. Don't forget to use `const` to declare the variable. ```js -assert.match(code, /const\s+loadMoreBtn\s*\=\s*document\.getElementById\(\s*('|"|`)load\-more\-btn\1\)/); +assert.match(code, /const\s+loadMoreBtn\s*\=\s*document\.getElementById\(\s*('|"|`)load\-more\-btn\1\s*\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da3c6b6fbd742bff6ee40.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da3c6b6fbd742bff6ee40.md index 20135439ad3..46796895689 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da3c6b6fbd742bff6ee40.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da3c6b6fbd742bff6ee40.md @@ -22,13 +22,13 @@ Make a `GET` request to this URL: `https://cdn.freecodecamp.org/curriculum/news- You should use the `fetch()` method to make a `GET` request to `https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json`. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)/) ``` You should not have a semi-colon after your `fetch` call. ```js -assert.notMatch(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\);/) +assert.notMatch(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\);/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da42481d90c4314c99e94.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da42481d90c4314c99e94.md index 57cd10d207f..107bde51d14 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da42481d90c4314c99e94.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da42481d90c4314c99e94.md @@ -27,37 +27,37 @@ Again, don't terminate the code with a semi-colon yet. You should use the `fetch()` method to make a `GET` request to `https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json`. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)/) ``` You should chain the `.then()` method to your `fetch()` syntax ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(/) ``` You should add a `res` parameter to your `.then()` method. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)/) ``` Your `.then()` method should use arrow function syntax. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*/) ``` You should log the `res` parameter to the console so you can see the `Response` object. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*console\.log\(\s*res\s*\)\s*\)/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*console\.log\(\s*res\s*\)\s*\)/) ``` You should not have a semi-colon after your `.then()`. ```js -assert.notMatch(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*console\.log\(\s*res\s*\)\s*\);/) +assert.notMatch(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*console\.log\(\s*res\s*\)\s*\);/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da465273051435d332b15.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da465273051435d332b15.md index 9478c4fc591..1b489fa7d3a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da465273051435d332b15.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da465273051435d332b15.md @@ -16,19 +16,19 @@ Remove `console.log(res)` and implicitly return `res.json()` instead. You should remove the `console.log(res)`. ```js -assert.notMatch(code, /\.then\(\(?res\)?\s*=>\s*console\.log\(res\)\)/) +assert.notMatch(code, /\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*console\.log\(\s*res\s*\)\s*\)/) ``` You should implicitly return `res.json()` in your `.then()`. ```js -assert.match(code, /\.then\(\(?res\)?\s*=>\s*res\.json\(\)\)/) +assert.match(code, /\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)/) ``` You should not have a semi-colon after your `.then()`. ```js -assert.notMatch(code, /\.then\(\(?res\)?\s*=>\s*res\.json\(\)\);/) +assert.notMatch(code, /\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\);/) ``` diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da4b16937be43ba24c63d.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da4b16937be43ba24c63d.md index affb0846705..f24a8374aaf 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da4b16937be43ba24c63d.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da4b16937be43ba24c63d.md @@ -17,7 +17,7 @@ Chain another `.then()` to the existing `.then()` method. This time, pass in `da You should use the `fetch()` method to make a `GET` request to `https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json`. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)/) ``` Your first `.then()` should not have a semi-colon. @@ -29,37 +29,37 @@ assert.notMatch(code, /\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s* You should chain another `.then()` to the existing `.then()`. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(/) ``` You should add a `data` parameter to your second `.then()` method. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)/) ``` Your second `.then()` method should use arrow function syntax. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*/) ``` Your second `.then()` method should have curly braces. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*/) ``` Your second `.then()` method should log `data` to the console. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\)\s*;?\s*\}\s*\)/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\)\s*;?\s*\}\s*\)/) ``` Your second `.then()` should not not have semi-colon after it. ```js -assert.notMatch(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\)\s*;?\s*\}\s*\)\s*;/) +assert.notMatch(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\)\s*;?\s*\}\s*\)\s*;/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da51a9810e74411262fcc.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da51a9810e74411262fcc.md index ec3195fee80..e4db931f0b6 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da51a9810e74411262fcc.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da51a9810e74411262fcc.md @@ -18,67 +18,67 @@ Chain `.catch()` to the last `.then()`. Pass in a callback function with `err` a You should use the `fetch()` method to make a `GET` request to `https://cdn.freecodecamp.org/curriculum/news-author-page/authors.json`. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)/) ``` You should chain another `.then()` to the existing `.then()`. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(/) ``` You should add a `data` parameter to your second `.then()` method. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)/) ``` Your second `.then()` method should use arrow function syntax. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*/) ``` Your second `.then()` method should have curly braces. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*/) ``` Your second `.then()` method should log `data` to the console. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\);?\n?\s*\}\)/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\);?\n?\s*\}\s*\)/) ``` Your second `.then()` should not have a semicolon. ```js -assert.notMatch(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\);?\n?\s*\}\);/) +assert.notMatch(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\);?\n?\s*\}\s*\);/) ``` You should chain the `.catch()` method to the second `.then()` you already have. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\);?\n?\s*\}\s*\)\n?\s*\.catch\(/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\);?\n?\s*\}\s*\)\n?\s*\.catch\(/) ``` You should add an `err` parameter to your `.catch()` method. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\);?\n?\s*\}\s*\)\n?\s*\.catch\(\s*(\(\s*err\s*\)|err)/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\);?\n?\s*\}\s*\)\n?\s*\.catch\(\s*(\(\s*err\s*\)|err)/) ``` Your `.catch()` method should have an arrow function syntax. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\);?\n?\s*\}\s*\)\n?\s*\.catch\(\s*(\(\s*err\s*\)|err)\s*=>\s*\{?/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\);?\n?\s*\}\s*\)\n?\s*\.catch\(\s*(\(\s*err\s*\)|err)\s*=>\s*\{?/) ``` Your `.catch()` method should use `console.error()` to log `err` to the console with the text `` `There was an error: ${err}` ``. Don't forget to use backticks. ```js -assert.match(code, /fetch\(('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\);?\n?\s*\}\s*\)\n?\s*\.catch\(\s*(\(\s*err\s*\)|err)\s*=>\s*\{?\n?(\s*)?console\.error\(\s*`There\swas\san\serror:\s?\$\{\s*err\s*\}`\s*\);?\n?(\s*)?\}?\)\s*;?/) +assert.match(code, /fetch\(\s*('|"|`)https:\/\/cdn\.freecodecamp\.org\/curriculum\/news\-author\-page\/authors\.json\1\s*\)\s*\.then\(\s*(\(\s*res\s*\)|res)\s*=>\s*res\.json\(\s*\)\s*\)\s*\.then\(\s*(\(\s*data\s*\)|data)\s*=>\s*\{\s*\n?\s*?console\.log\(\s*data\s*\);?\n?\s*\}\s*\)\n?\s*\.catch\(\s*(\(\s*err\s*\)|err)\s*=>\s*\{?\n?(\s*)?console\.error\(\s*`There\swas\san\serror:\s?\$\{\s*err\s*\}`\s*\);?\n?(\s*)?\}?\s*\)\s*;?/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da5462576784453146ec2.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da5462576784453146ec2.md index 5f3bb70e4d0..d4b42bf8366 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da5462576784453146ec2.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da5462576784453146ec2.md @@ -48,7 +48,7 @@ assert.match(code, /let\s+authorDataArr/) You should set your `authorDataArr` variable to an empty array (`[]`). ```js -assert.match(code, /let\s+authorDataArr\s*=\s*\[\];?/) +assert.match(code, /let\s+authorDataArr\s*=\s*\[\s*\]\s*;?/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da5dd6cd6db44f58b7787.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da5dd6cd6db44f58b7787.md index 30578e45792..e08ebf405a6 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da5dd6cd6db44f58b7787.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da5dd6cd6db44f58b7787.md @@ -14,7 +14,7 @@ Inside your `displayAuthors` function, chain `.forEach()` to `authors`. You should chain `.forEach()` to `authors`. ```js -assert.match(code, /authors\.forEach\(\)/) +assert.match(code, /authors\.forEach\(\s*\)/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da615af82bf454215a992.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da615af82bf454215a992.md index 709b3dc54b8..f59b5d4178b 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da615af82bf454215a992.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da615af82bf454215a992.md @@ -34,7 +34,7 @@ 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*\);?/) +assert.match(code, /authors\.forEach\(\s*\(\s*\{.*\}\s*\,\s*index\s*\)\s*=>\s*\{\s*\}\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da73b09e7f046c758e0ed.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da73b09e7f046c758e0ed.md index daceebdc03b..7db103dc2ab 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da73b09e7f046c758e0ed.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da73b09e7f046c758e0ed.md @@ -16,7 +16,7 @@ First, remove your `console.log()` statement. Then, assign `data` to the `author You should remove the console log showing the `data`. ```js -assert.notMatch(code, /console\.log\(data\);/) +assert.notMatch(code, /console\.log\(\s*data\s*\);/) ``` You should assign `data` to the `authorDataArr` variable diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da791d0c34a472b8d15b6.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da791d0c34a472b8d15b6.md index 14b6b569e33..5c83368077c 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da791d0c34a472b8d15b6.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da791d0c34a472b8d15b6.md @@ -22,19 +22,19 @@ assert.match(code, /authorDataArr\s*=\s*data;?/) You should have a console log with the text `Author Data Array:`. ```js -assert.match(code, /console\.log\(("|'|`)Author\s+Data\s+Array:\s*\1/) +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\(("|'|`)Author\s+Data\s+Array:\s*\1\,/) +assert.match(code, /console\.log\(\s*("|'|`)Author\s+Data\s+Array:\s*\1\,/) ``` `authorDataArr` should be the second argument of your console log statement. ```js -assert.match(code, /console\.log\(("|'|`)Author\s+Data\s+Array:\s*\1\,\s*authorDataArr\);?/) +assert.match(code, /console\.log\(\s*("|'|`)Author\s+Data\s+Array:\s*\1\,\s*authorDataArr\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da7bfbc7f0f477438ad8a.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da7bfbc7f0f477438ad8a.md index dfd34dfcd3f..a056ab9e88b 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da7bfbc7f0f477438ad8a.md +++ b/curriculum/challenges/arabic/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\(("|'|`)Author\s+Data\s+Array:\s*\1\,\s*authorDataArr\);?/) +assert.notMatch(code, /console\.log\(\s*("|'|`)Author\s+Data\s+Array:\s*\1\,\s*authorDataArr\s*\);?/) ``` You should call your `displayAuthors` function. @@ -34,19 +34,19 @@ assert.match(code, /displayAuthors\(/) You should call your `displayAuthors` function and pass in an argument of `authorDataArr.slice()`. ```js -assert.match(code, /displayAuthors\(authorDataArr\.slice\(/) +assert.match(code, /displayAuthors\(\s*authorDataArr\.slice\(/) ``` The first parameter of your `slice()` method should be `startingIndex`. ```js -assert.match(code, /displayAuthors\(authorDataArr\.slice\(startingIndex/) +assert.match(code, /displayAuthors\(\s*authorDataArr\.slice\(\s*startingIndex/) ``` The second parameter of your `slice()` method should be `endingIndex`. ```js -assert.match(code, /displayAuthors\(authorDataArr\.slice\(startingIndex\,\s*endingIndex\)\);?/) +assert.match(code, /displayAuthors\(\s*authorDataArr\.slice\(\s*startingIndex\,\s*endingIndex\s*\)\s*\);?/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da895fb7ec648a5bdf19c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da895fb7ec648a5bdf19c.md index 539dddae56d..5fe3273bef9 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da895fb7ec648a5bdf19c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da895fb7ec648a5bdf19c.md @@ -34,13 +34,13 @@ assert.match(code, /const\s+fetchMoreAuthors\s*=\s*\(\s*\)\s*/) Your `fetchMoreAuthors` function should use arrow syntax. ```js -assert.match(code, /const\s+fetchMoreAuthors\s*=\s*\(\)\s*=>\s*/) +assert.match(code, /const\s+fetchMoreAuthors\s*=\s*\(\s*\)\s*=>\s*/) ``` Your `fetchMoreAuthors` function should be empty. ```js -assert.match(code, /const\s+fetchMoreAuthors\s*=\s*\(\)\s*=>\s*\{\s*\}/) +assert.match(code, /const\s+fetchMoreAuthors\s*=\s*\(\s*\)\s*=>\s*\{\s*\}/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da97c987a514959ada414.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da97c987a514959ada414.md index 1aef7aee16f..da58d46f375 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da97c987a514959ada414.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da97c987a514959ada414.md @@ -24,21 +24,21 @@ You should call your `displayAuthors` function and pass in an argument of `autho ```js const afterAdd = code.split("endingIndex += 8;")[1]; -assert.match(afterAdd, /displayAuthors\(authorDataArr\.slice\(/) +assert.match(afterAdd, /displayAuthors\(\s*authorDataArr\.slice\(/) ``` The first argument of your `slice()` method should be `startingIndex`. ```js const afterAdd = code.split("endingIndex += 8;")[1]; -assert.match(afterAdd, /displayAuthors\(authorDataArr\.slice\(startingIndex/) +assert.match(afterAdd, /displayAuthors\(\s*authorDataArr\.slice\(\s*startingIndex/) ``` The second argument of your `slice()` method should be `endingIndex`. ```js const afterAdd = code.split("endingIndex += 8;")[1]; -assert.match(afterAdd, /displayAuthors\(authorDataArr\.slice\(startingIndex\,\s*endingIndex\)\)/) +assert.match(afterAdd, /displayAuthors\(\s*authorDataArr\.slice\(\s*startingIndex\,\s*endingIndex\s*\)\s*\)/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da9aceb788e49a73ebcc9.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da9aceb788e49a73ebcc9.md index cd1b89a5d52..62af8988c34 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da9aceb788e49a73ebcc9.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da9aceb788e49a73ebcc9.md @@ -24,13 +24,13 @@ assert.match(code, /loadMoreBtn\.addEventListener\(/) Your event listener should listen for a `click` event. ```js -assert.match(code, /loadMoreBtn\.addEventListener\(('|"|`)click\1/) +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\(('|"|`)click\1,\s*fetchMoreAuthors\);?/) +assert.match(code, /loadMoreBtn\.addEventListener\(\s*('|"|`)click\1,\s*fetchMoreAuthors\s*\);?/) ``` diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da9ea9b847a49fe6ee9b6.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da9ea9b847a49fe6ee9b6.md index e67706dd455..4af629fa52f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da9ea9b847a49fe6ee9b6.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641da9ea9b847a49fe6ee9b6.md @@ -24,13 +24,13 @@ assert.match(code, /if\s*\(/) Your `if` statement should take in `authorDataArr.length <= endingIndex` as its condition. ```js -assert.match(code, /if\s*\(authorDataArr\.length\s*<=\s*endingIndex\)\s*/) +assert.match(code, /if\s*\(\s*authorDataArr\.length\s*<=\s*endingIndex\s*\)\s*/) ``` Your `if` statement should be empty. ```js -assert.match(code, /if\s*\(authorDataArr\.length\s*<=\s*endingIndex\)\s*\{\s*\}/) +assert.match(code, /if\s*\(\s*authorDataArr\.length\s*<=\s*endingIndex\s*\)\s*\{\s*\}/) ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641daabed8d0584b1150c953.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641daabed8d0584b1150c953.md index 1fcd651875b..7ae78883b69 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641daabed8d0584b1150c953.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641daabed8d0584b1150c953.md @@ -28,22 +28,21 @@ assert.match(code, //); You should check if the length of the `bio` text is greater than `50`. ```js -assert.match(code, /\$\{\s*bio\.length\s*>\s*50/) +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*bio\.length\s*>\s*50\s*\?\s*bio\.slice\(\s*0\,\s*50\s*\)\s*\+\s*("|')\.\.\.\2\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*bio\.length\s*>\s*50\s*\?\s*bio\.slice\(\s*0\,\s*50\s*\)\s*\+\s*("|')\.\.\.\2\s*\:\s*bio\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-- ## --seed-contents-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641daae5e18eae4b562633e4.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641daae5e18eae4b562633e4.md index 85a07e050ac..b599faf9dba 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641daae5e18eae4b562633e4.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-fetch-and-promises-by-building-an-fcc-authors-page/641daae5e18eae4b562633e4.md @@ -16,7 +16,7 @@ Inside the `.catch()`, remove the `console.error()` and set the `innerHTML` of t You should remove your `console.error` and its text. ```js -assert.notMatch(code, /console\.error\(`There\s+was\s+an\s+error:\s+\$\{err\}`\);/) +assert.notMatch(code, /console\.error\(\s*`There\s+was\s+an\s+error:\s+\$\{err\}`\s*\);/) ``` You should access the `innerHTML` of `authorContainer` and set it to a `p` element. Don't forget to surround the `p` element with a template literal. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/5ddb965c65d27e1512d44d9a.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/5ddb965c65d27e1512d44d9a.md index d46b72eef06..ab2a64fa36e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/5ddb965c65d27e1512d44d9a.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/5ddb965c65d27e1512d44d9a.md @@ -96,19 +96,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b606f09a14cc1781aea1fb.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b606f09a14cc1781aea1fb.md index c916b6560a9..0bdc020ebb1 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b606f09a14cc1781aea1fb.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b606f09a14cc1781aea1fb.md @@ -120,19 +120,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b6075a62883218d282504c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b6075a62883218d282504c.md index e2da6210edc..6a86840c8b0 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b6075a62883218d282504c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b6075a62883218d282504c.md @@ -111,19 +111,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b607af6fcdb119aae9b16a.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b607af6fcdb119aae9b16a.md index aca559e2685..f2ec6af6883 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b607af6fcdb119aae9b16a.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b607af6fcdb119aae9b16a.md @@ -142,19 +142,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60821c855d01b1eda3c0b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60821c855d01b1eda3c0b.md index 44a8b1f9484..883d8442462 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60821c855d01b1eda3c0b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60821c855d01b1eda3c0b.md @@ -7,8 +7,9 @@ dashedName: step-5 # --description-- -Now create a `fieldset` with an `id` set to `lunch`, and a corresponding `legend` and `div` element. +Next, create a `fieldset` element with the `id` set to `lunch`. +Within that element, create a `legend` element with the text `Lunch`, and an empty `div` with the `class` set to `input-container`. # --hints-- You should create a second `fieldset` element in your `form`. @@ -138,19 +139,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b6088bb56e2d1cac364043.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b6088bb56e2d1cac364043.md index f06d01dea76..31badb8641f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b6088bb56e2d1cac364043.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b6088bb56e2d1cac364043.md @@ -142,19 +142,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b608ebf40c871d960fc004.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b608ebf40c871d960fc004.md index 625a2bf144d..5c2124823a5 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b608ebf40c871d960fc004.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b608ebf40c871d960fc004.md @@ -188,19 +188,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60a140bf5a321d50a7315.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60a140bf5a321d50a7315.md index ab8effcb65d..c1b9840a972 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60a140bf5a321d50a7315.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60a140bf5a321d50a7315.md @@ -137,19 +137,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60aaaa65f8922bfce6b7e.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60aaaa65f8922bfce6b7e.md index c56b01054a2..d2cb106292d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60aaaa65f8922bfce6b7e.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60aaaa65f8922bfce6b7e.md @@ -190,19 +190,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60af1a0b9f7238a9dd294.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60af1a0b9f7238a9dd294.md index ff2b9c6099d..5c2219236e9 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60af1a0b9f7238a9dd294.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60af1a0b9f7238a9dd294.md @@ -196,19 +196,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60c09c5039f25a3b2dda9.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60c09c5039f25a3b2dda9.md index 17aa0aa3373..e0d3624d199 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60c09c5039f25a3b2dda9.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60c09c5039f25a3b2dda9.md @@ -176,19 +176,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60ca38c897f2721b27959.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60ca38c897f2721b27959.md index a983cc10cb5..e53383a0385 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60ca38c897f2721b27959.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60ca38c897f2721b27959.md @@ -156,19 +156,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60cfaca25bb27edd40f62.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60cfaca25bb27edd40f62.md index cf3138c43b5..b14177abd70 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60cfaca25bb27edd40f62.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60cfaca25bb27edd40f62.md @@ -144,19 +144,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60d3c5048302906962231.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60d3c5048302906962231.md index 7c8277739f3..d5b38622c93 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60d3c5048302906962231.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b60d3c5048302906962231.md @@ -29,13 +29,13 @@ You should create a variable called `calorieCounter`. assert.isDefined(calorieCounter); ``` -You should use `document.getElementById()` to get the `#calorie-counter` element. +You should have `document.getElementById('calorie-counter')` in your code. ```js assert.match(code, /document\.getElementById\(\s*('|")calorie-counter\1\s*\)/g); ``` -You should store the `#calorie-counter` element in a variable called `calorieCounter`. +You should assign `document.getElementById('calorie-counter')` to your `calorieCounter` variable. ```js assert.equal(calorieCounter, document.getElementById('calorie-counter')); @@ -160,19 +160,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b613f367584d2a5d041b7d.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b613f367584d2a5d041b7d.md index 524c1bc4a2d..32b17665615 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b613f367584d2a5d041b7d.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b613f367584d2a5d041b7d.md @@ -166,19 +166,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b61490e633a22b4593e62f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b61490e633a22b4593e62f.md index 45e822c22e6..85bed6adf07 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b61490e633a22b4593e62f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b61490e633a22b4593e62f.md @@ -184,19 +184,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b614e6a1f7fe2cef6312dc.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b614e6a1f7fe2cef6312dc.md index 62a09073b64..aeefc6fcb10 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b614e6a1f7fe2cef6312dc.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b614e6a1f7fe2cef6312dc.md @@ -7,6 +7,13 @@ dashedName: step-17 # --description-- +In programming, it is standard practice to prefix a variable with `is` or `has` to indicate that the variable is a boolean. + +```js +let isRunning = true; +let hasCompleted = false; +``` + Declare an `isError` variable and set it to `false`, but use `let` so you can reassign it later. # --hints-- @@ -148,19 +155,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b6152e6aff882db819fc1e.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b6152e6aff882db819fc1e.md index 325ec763650..ee673c303b4 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b6152e6aff882db819fc1e.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b6152e6aff882db819fc1e.md @@ -28,7 +28,7 @@ assert.isFunction(cleanInputString); Your `cleanInputString` function should take a `str` parameter. ```js -assert.match(cleanInputString?.toString(), /\(str\)/); +assert.match(cleanInputString?.toString(), /\(\s*str\s*\)/); ``` `cleanInputString` should be an empty function. @@ -156,19 +156,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b61584def8fa2ebcc259e0.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b61584def8fa2ebcc259e0.md index f19a6ef8c93..dc38ad5b3e5 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b61584def8fa2ebcc259e0.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63b61584def8fa2ebcc259e0.md @@ -154,19 +154,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf43be3f969d24d4ed233c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf43be3f969d24d4ed233c.md index 757d484bf1a..5097ab76260 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf43be3f969d24d4ed233c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf43be3f969d24d4ed233c.md @@ -142,19 +142,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf446945d34d25e6db6e4f.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf446945d34d25e6db6e4f.md index 11b787c6c36..79cf7300e4e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf446945d34d25e6db6e4f.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf446945d34d25e6db6e4f.md @@ -154,19 +154,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf45ce0dc8d4270760c6d0.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf45ce0dc8d4270760c6d0.md index eeb163f249a..816a58fdca2 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf45ce0dc8d4270760c6d0.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf45ce0dc8d4270760c6d0.md @@ -7,24 +7,26 @@ dashedName: step-22 # --description-- -Within your loop, you need to check if the character in `strArray` at index `i` is not a `+`, `-`, or a space. If it is not, `push` it to the `cleanStrArray`. - You will need to check if the array `["+", "-", " "]` does not include the current character. You can use a combination of the includes() method and the ! operator to do this. The `.includes()` method returns `true` if the array contains the character, and `false` if not. The logical NOT operator (`!`) will return the opposite of the value of the `.includes()` method. -Here is an example: +Here is an example checking if the current character is not in the vowels array. If it is not, that current character is pushed into the `consonantArray`: ```js -const numbersArray = [1, 2, 3, 4, 5] -const number = 6 +const inputString = "Hello World"; +const charArray = inputString.split(''); +const consonantArray = []; -if (!numbersArray.includes(number)) { - console.log("The number is not in the array.") +for (let i = 0; i < charArray.length; i++) { + if (!['a', 'e', 'i', 'o', 'u'].includes(charArray[i])) { + consonantArray.push(charArray[i]); + } } - ``` +Within your loop, you need to check if the character in `strArray` at index `i` is not a `+`, `-`, or a space. If it is not, `push` it to the `cleanStrArray`. + # --hints-- Your `for` loop should have an `if` statement. @@ -37,19 +39,19 @@ Your `for` loop should use `!["+", "-", " "].includes()`. ```js // the loop protection injects code so we have to look at the raw code directly -assert.match(code, /for\s*\(\s*(let|var)\s+i\s*=\s*0\s*;\s*i\s*<\s*strArray\.length\s*;\s*i\s*\+\+\s*\)\s*\{\s*if\s*\(!\[("|')\+\2\s*,\s*("|')-\3\s*,\s*("|')\s\4\s*\]\.includes\(/); +assert.match(code, /for\s*\(\s*(let|var)\s+i\s*=\s*0\s*;\s*i\s*<\s*strArray\.length\s*;\s*i\s*\+\+\s*\)\s*\{\s*if\s*\(\s*!\s*\[\s*("|')\+\2\s*,\s*("|')-\3\s*,\s*("|')\s\4\s*\]\s*\.includes\(/); ``` -Your `for` loop should see if `strArray[i]` is found in `["+", "-", " "]`. +Your `for` loop should see if `!["+", "-", " "].includes(strArray[i])`. ```js -assert.match(code, /for\s*\(\s*(let|var)\s+i\s*=\s*0\s*;\s*i\s*<\s*strArray\.length\s*;\s*i\s*\+\+\s*\)\s*\{\s*if\s*\(!\[("|')\+\2\s*,\s*("|')-\3\s*,\s*("|')\s\4\s*\]\.includes\(\s*strArray\[i\]\s*\)\)(\s*\{)?/); +assert.match(code, /for\s*\(\s*(let|var)\s+i\s*=\s*0\s*;\s*i\s*<\s*strArray\.length\s*;\s*i\s*\+\+\s*\)\s*\{\s*if\s*\(\s*!\s*\[\s*("|')\+\2\s*,\s*("|')-\3\s*,\s*("|')\s\4\s*\]\s*\.includes\(\s*strArray\s*\[\s*i\s*\]\s*\)\s*\)(\s*\{)?/); ``` Your `for` loop should `push` `strArray[i]` to `cleanStrArray`. ```js -assert.match(code, /for\s*\(\s*(let|var)\s+i\s*=\s*0\s*;\s*i\s*<\s*strArray\.length\s*;\s*i\s*\+\+\s*\)\s*\{\s*if\s*\(!\[("|')\+\2\s*,\s*("|')-\3\s*,\s*("|')\s\4\s*\]\.includes\(\s*strArray\[i\]\s*\)\)(\s*\{)?\s*cleanStrArray\.push\(\s*strArray\[i\]\s*\)\s*;?\s*(\s*\})?/); +assert.match(code, /for\s*\(\s*(let|var)\s+i\s*=\s*0\s*;\s*i\s*<\s*strArray\.length\s*;\s*i\s*\+\+\s*\)\s*\{\s*if\s*\(\s*!\s*\[\s*("|')\+\2\s*,\s*("|')-\3\s*,\s*("|')\s\4\s*\]\s*\.includes\(\s*strArray\s*\[\s*i\s*\]\s*\)\s*\)(\s*\{)?\s*cleanStrArray\.push\(\s*strArray\s*\[\s*i\s*\]\s*\)\s*;?\s*(\s*\})?/); ``` # --seed-- @@ -171,19 +173,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf461011fca327d3b60fa8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf461011fca327d3b60fa8.md index 52175b70f3f..b81c6bfe4b7 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf461011fca327d3b60fa8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf461011fca327d3b60fa8.md @@ -168,19 +168,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf47fd40599f29827f484d.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf47fd40599f29827f484d.md index 1c2cae7b722..74185fed0e7 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf47fd40599f29827f484d.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf47fd40599f29827f484d.md @@ -138,19 +138,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf492b6dfb292a79f0e675.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf492b6dfb292a79f0e675.md index 65bac0d2b15..d4cba89ec19 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf492b6dfb292a79f0e675.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf492b6dfb292a79f0e675.md @@ -136,19 +136,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf4bfe9de3852be51c8f86.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf4bfe9de3852be51c8f86.md index 440a8abbffd..4664f92a77f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf4bfe9de3852be51c8f86.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf4bfe9de3852be51c8f86.md @@ -150,19 +150,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf4d351e06432ce9bf3627.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf4d351e06432ce9bf3627.md index 3c32c02f341..201ca7d8e50 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf4d351e06432ce9bf3627.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf4d351e06432ce9bf3627.md @@ -142,19 +142,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf511b85b6082e54dc1573.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf511b85b6082e54dc1573.md index eb1d0a0d264..58e5555420c 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf511b85b6082e54dc1573.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf511b85b6082e54dc1573.md @@ -160,19 +160,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5230bccd1c2f5c13e1ce.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5230bccd1c2f5c13e1ce.md index b5ef4da5762..71438117edf 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5230bccd1c2f5c13e1ce.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5230bccd1c2f5c13e1ce.md @@ -150,19 +150,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf598a4c807930a13a1a27.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf598a4c807930a13a1a27.md index 0be1d0c4fd6..2af798c1874 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf598a4c807930a13a1a27.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf598a4c807930a13a1a27.md @@ -142,19 +142,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5a518d54f63181ab639a.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5a518d54f63181ab639a.md index 1b74024e42b..8742424ca3f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5a518d54f63181ab639a.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5a518d54f63181ab639a.md @@ -136,19 +136,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5a92fd148d3264d5322b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5a92fd148d3264d5322b.md index 0f332671811..65267a15d86 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5a92fd148d3264d5322b.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5a92fd148d3264d5322b.md @@ -144,19 +144,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5adfe2981b332eb007b6.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5adfe2981b332eb007b6.md index ce1d83ce399..06b80a334b0 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5adfe2981b332eb007b6.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5adfe2981b332eb007b6.md @@ -142,19 +142,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5bcfebff0734593fad19.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5bcfebff0734593fad19.md index bf764b0c888..3f6c0d5b3d2 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5bcfebff0734593fad19.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5bcfebff0734593fad19.md @@ -142,19 +142,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5c438f523a359769106c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5c438f523a359769106c.md index cc518396b16..a1e4484dd21 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5c438f523a359769106c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5c438f523a359769106c.md @@ -6,8 +6,13 @@ dashedName: step-35 --- # --description-- +Strings have a .match() method, which takes a regex argument. `.match()` will return an array of match results – containing either the first match, or all matches if the global flag is used. -Strings have a `.match()` method, which takes a regex argument. `.match()` will return an array of match results – containing either the first match, or all matches if the global flag is used. +```js +const str = 'example string'; +const regex = /example/; +const result = str.match(regex); // Returns ['example'] +``` Return the result of calling the `.match()` method on `str` and passing your `regex` variable as the argument. You'll use this match result later on. @@ -150,19 +155,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5cf03b50bf36cfbe94ea.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5cf03b50bf36cfbe94ea.md index ca7457aca4d..03fe9be499a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5cf03b50bf36cfbe94ea.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63bf5cf03b50bf36cfbe94ea.md @@ -148,19 +148,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1dfbd56c71e278800010c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1dfbd56c71e278800010c.md index b3e0b8996c2..faaf9df1da3 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1dfbd56c71e278800010c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1dfbd56c71e278800010c.md @@ -153,19 +153,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e0af28078f2dfad9eb3e.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e0af28078f2dfad9eb3e.md index 58651e00653..80df517e1b4 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e0af28078f2dfad9eb3e.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e0af28078f2dfad9eb3e.md @@ -154,19 +154,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e1965a898d302e0af4e3.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e1965a898d302e0af4e3.md index 325d63c5284..9d31d1b3fd2 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e1965a898d302e0af4e3.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e1965a898d302e0af4e3.md @@ -26,13 +26,13 @@ Replace your concatenated string in the `querySelector` with a template literal You should use a template literal in your `querySelector` method. ```js -assert.match(code, /const\s+targetInputContainer\s*=\s*document\.querySelector\(`.*`\)/); +assert.match(code, /const\s+targetInputContainer\s*=\s*document\.querySelector\(\s*`.*`\s*\)/); ``` Your template literal should have the value `{targetId} .input-container`. ```js -assert.match(code, /const\s+targetInputContainer\s*=\s*document\.querySelector\(`\$\{targetId\}\s\.input-container`\s*\)/); +assert.match(code, /const\s+targetInputContainer\s*=\s*document\.querySelector\(\s*`\$\{targetId\}\s\.input-container`\s*\)/); ``` # --seed-- @@ -154,19 +154,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e5b4b3c8a031def3bd65.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e5b4b3c8a031def3bd65.md index adec2b9c64a..8ab04dec869 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e5b4b3c8a031def3bd65.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e5b4b3c8a031def3bd65.md @@ -20,13 +20,13 @@ assert.notMatch(addEntry.toString(), /targetId\s*=/); You should replace the `targetId` reference in your template literal with `entryDropdown.value`. ```js -assert.match(code, /const\s+targetInputContainer\s*=\s*document\.querySelector\(`#?\$\{entryDropdown\.value\}\s\.input-container`\s*\)/); +assert.match(code, /const\s+targetInputContainer\s*=\s*document\.querySelector\(\s*`#?\$\{entryDropdown\.value\}\s\.input-container`\s*\)/); ``` You should add `#` at the beginning of your template literal. ```js -assert.match(code, /const\s+targetInputContainer\s*=\s*document\.querySelector\(`#\$\{entryDropdown\.value\}\s\.input-container`\s*\)/); +assert.match(code, /const\s+targetInputContainer\s*=\s*document\.querySelector\(\s*`#\$\{entryDropdown\.value\}\s\.input-container`\s*\)/); ``` # --seed-- @@ -148,19 +148,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e704ee12703347625900.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e704ee12703347625900.md index 419988c03a0..485fc7c59aa 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e704ee12703347625900.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c1e704ee12703347625900.md @@ -152,19 +152,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c2164c0df38a382062c4af.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c2164c0df38a382062c4af.md index c87ec2f3862..0ae4e1e1bb8 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c2164c0df38a382062c4af.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c2164c0df38a382062c4af.md @@ -24,13 +24,13 @@ assert.match(addEntry.toString(), /entryNumber\s*=\s*targetInputContainer\.query You should access the `length` property of your `querySelectorAll()`. ```js -assert.match(addEntry.toString(), /\.querySelectorAll\(\s*'\s*input\s*\[\s*type\s*=\s*"text"\s*]\s*'\)\.length/) +assert.match(addEntry.toString(), /\.querySelectorAll\(\s*'\s*input\s*\[\s*type\s*=\s*"text"\s*]\s*'\s*\)\.length/) ``` Your `entryNumber` variable should be the `length` of the `querySelectorAll`. ```js -assert.match(addEntry.toString(), /entryNumber\s*=\s*targetInputContainer\.querySelectorAll\(\s*'\s*input\s*\[\s*type\s*=\s*"text"\s*]\s*'\)\.length/) +assert.match(addEntry.toString(), /entryNumber\s*=\s*targetInputContainer\.querySelectorAll\(\s*'\s*input\s*\[\s*type\s*=\s*"text"\s*]\s*'\s*\)\.length/) ``` # --seed-- @@ -152,19 +152,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c216da562fbb3957b9cb2c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c216da562fbb3957b9cb2c.md index 921e430a0b7..82ace3a451a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c216da562fbb3957b9cb2c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c216da562fbb3957b9cb2c.md @@ -142,19 +142,12 @@ legend { } button { - outline: none; cursor: pointer; text-decoration: none; background-color: var(--light-yellow); border: 2px solid var(--dark-yellow); } -.clear { - background-color: var(--light-pink); - color: var(--dark-red); - border-color: var(--dark-red); -} - button, input, select { diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c2171c1e5b6e3aa51768d0.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c2171c1e5b6e3aa51768d0.md index cbe89d13ff2..6629c807dfe 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c2171c1e5b6e3aa51768d0.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-form-validation-by-building-a-calorie-counter/63c2171c1e5b6e3aa51768d0.md @@ -20,7 +20,7 @@ assert.match(code, /HTMLString\s*=\s*`\n\s*