diff --git a/curriculum/challenges/_meta/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/meta.json b/curriculum/challenges/_meta/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/meta.json index b1c55b06941..1e33280b160 100644 --- a/curriculum/challenges/_meta/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/meta.json +++ b/curriculum/challenges/_meta/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/meta.json @@ -345,11 +345,11 @@ "title": "Step 83" }, { - "id": "657e2ecee9f60092c89338d9", + "id": "657e30e116d50c946b189925", "title": "Step 84" }, { - "id": "657e30e116d50c946b189925", + "id": "657e2ecee9f60092c89338d9", "title": "Step 85" }, { @@ -362,4 +362,4 @@ } ], "helpCategory": "JavaScript" -} \ No newline at end of file +} diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e2ecee9f60092c89338d9.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e2ecee9f60092c89338d9.md index b5beda91ab1..bc00353e482 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e2ecee9f60092c89338d9.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e2ecee9f60092c89338d9.md @@ -1,28 +1,33 @@ --- id: 657e2ecee9f60092c89338d9 -title: Step 84 +title: Step 85 challengeType: 0 -dashedName: step-84 +dashedName: step-85 --- # --description-- -If the user rolls a small straight, then the `Small straight` radio button option should be enabled with a score of `30` points. +If the user rolls a small straight, then the `Small straight` radio button option should be enabled with a score of `30` points. A small straight consists of four separate dice rolls arranged in numerical order. -Start by creating an `if` statement to check if `uniqueNumbersStr` is included in the `smallStraightsArr`. If so, call the `updateRadioOption` with `3` and `30` for the arguments. +To get started, iterate through `smallStraightsArr` using any loop you prefer. If using a higher-order function like `forEach` or `some`, the callback function should take an argument of `straight`. If using `for...of`, the loop variable should also be `straight`. + +Inside the loop, if `uniqueNumbersStr` has a combination that matches a small straight, call the `updateRadioOption` with `3` and `30` as the arguments. # --hints-- -You should use the `includes` method to check if `uniqueNumbersStr` is included in the `smallStraightsArr`. +You should use the `includes` method to check if `straight` is included in the `uniqueNumbersStr`. ```js -assert.match(code, /if\s*\(\s*smallStraightsArr\.includes\(\s*uniqueNumbersStr\s*\)\s*\)\s*{?/); +assert.match(code, /\s*i?f?\(?\s*uniqueNumbersStr\.includes\(\s*(straight|smallStraightsArr\[i\])\s*\)\)\s*\)?\s*\{/) ``` You should call your `updateRadioOption` with `3` and `30` for the arguments. ```js -assert.match(code, /if\s*\(\s*smallStraightsArr\.includes\(\s*uniqueNumbersStr\s*\)\s*\)\s*{?\s*updateRadioOption\s*\(\s*3\s*,\s*30\s*\)\s*;?\s*}?/); +checkForStraights(["1","2","3","4","6"]); +assert.isFalse(scoreInputs[3].disabled); +assert.equal(scoreInputs[3].value,30); +assert.equal(scoreSpans[3].textContent,', score = 30'); ``` # --seed-- @@ -374,10 +379,15 @@ const checkForStraights = (arr) => { const smallStraightsArr = ["1234", "2345", "3456"]; const largeStraightsArr = ["12345", "23456"]; + --fcc-editable-region-- + --fcc-editable-region-- - --fcc-editable-region-- + if (largeStraightsArr.includes(uniqueNumbersStr)) { + updateRadioOption(4, 40); + } + }; const resetRadioOption = () => { diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e30e116d50c946b189925.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e30e116d50c946b189925.md index 71935eceef8..bdfc9d8bfd8 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e30e116d50c946b189925.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e30e116d50c946b189925.md @@ -1,8 +1,8 @@ --- id: 657e30e116d50c946b189925 -title: Step 85 +title: Step 84 challengeType: 0 -dashedName: step-85 +dashedName: step-84 --- # --description-- @@ -374,11 +374,7 @@ const checkForStraights = (arr) => { const smallStraightsArr = ["1234", "2345", "3456"]; const largeStraightsArr = ["12345", "23456"]; - - if (smallStraightsArr.includes(uniqueNumbersStr)) { - updateRadioOption(3, 30); - } - + --fcc-editable-region-- --fcc-editable-region-- diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e37e29b45c39a98482860.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e37e29b45c39a98482860.md index 8c38830642f..2a2828b07cd 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e37e29b45c39a98482860.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e37e29b45c39a98482860.md @@ -367,7 +367,7 @@ const checkForStraights = (arr) => { const smallStraightsArr = ["1234", "2345", "3456"]; const largeStraightsArr = ["12345", "23456"]; - if (smallStraightsArr.includes(uniqueNumbersStr)) { + if (smallStraightsArr.some(straight => uniqueNumbersStr.includes(straight))) { updateRadioOption(3, 30); } diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e390964da9f9bff8f3625.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e390964da9f9bff8f3625.md index 96f8e623475..483dfa8edec 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e390964da9f9bff8f3625.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-intermediate-algorithmic-thinking-by-building-a-dice-game/657e390964da9f9bff8f3625.md @@ -369,7 +369,7 @@ const checkForStraights = (arr) => { const smallStraightsArr = ["1234", "2345", "3456"]; const largeStraightsArr = ["12345", "23456"]; - if (smallStraightsArr.includes(uniqueNumbersStr)) { + if (smallStraightsArr.some(straight => uniqueNumbersStr.includes(straight))) { updateRadioOption(3, 30); } @@ -817,7 +817,7 @@ const checkForStraights = (arr) => { const smallStraightsArr = ["1234", "2345", "3456"]; const largeStraightsArr = ["12345", "23456"]; - if (smallStraightsArr.includes(uniqueNumbersStr)) { + if (smallStraightsArr.some(straight => uniqueNumbersStr.includes(straight))) { updateRadioOption(3, 30); }