diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b1b54dda895..f5b7aaf7c32 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -39,7 +39,13 @@ Your `idToText` function should have an `id` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>/); ``` -You should assign `idToText` the result of calling the `.find()` method on your `cells` array. +Your `idToText` function should return the result of calling the `.find()` method on your `cells` array. Your callback function should use an implicit return. + +```js +assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); +``` + +Your `idToText` function should use an implicit return. ```js assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(/); @@ -57,12 +63,6 @@ Your callback function should have a `cell` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>/); ``` -Your callback function should use an implicit return. - -```js -assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); -``` - Your callback function should return whether `cell.id` is strictly equal to `id`. ```js diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md index 6ea58bc46e0..59e5ad6294e 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md @@ -11,72 +11,48 @@ In your `highPrecedence` function, declare a `regex` variable. Assign it a regul Each number, and the operator, should be in separate capture groups. +Incorporate the regular expression you've defined into your `highPrecedence` function to test if the provided string `str` matches the pattern. Use the `test()` method on your `regex` variable and return the result. + # --hints-- + You should declare a `regex` variable in your `highPrecedence` function. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*(?:const|let|var)\s+regex/); + ``` You should use `const` to declare your `regex` variable. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex/); + ``` Your `regex` variable should be a regular expression. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\//); + ``` -Your `regex` should use a capture group. +Your highPrecedence should return `regex.test(str);` ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(/); +assert.match(code, /return\s+regex\.test\(str\);?/); + ``` -Your first capture group should use a character class. +Please enter a properly functioning regex. ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[/); -``` -Your first capture group should match any digit or a period. Use the special `\d` character class. +assert.strictEqual(highPrecedence("5*3"), true); -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]/); -``` - -Your first capture group should match the character class one or more times. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)/); -``` - -Your `regex` should use a second capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(/); -``` - -Your second capture group should match a `*` or `/` operator. Use a character class in the capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)/); -``` - -Your `regex` should use a third capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(/); -``` - -Your third capture group should be the same as your first capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)/); ``` # --seed-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md index 6311798060f..3ba875ffb40 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md @@ -1,8 +1,8 @@ --- id: 646d40c543943ec250039682 -title: Step 75 +title: Step 77 challengeType: 0 -dashedName: step-75 +dashedName: step-77 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md index 3a66e0d1799..04c2e896ab3 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md @@ -1,8 +1,8 @@ --- id: 646d40fe4b7b50c30c2b4cd8 -title: Step 76 +title: Step 78 challengeType: 0 -dashedName: step-76 +dashedName: step-78 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md index 9e4657a50f7..356e13ac467 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md @@ -1,8 +1,8 @@ --- id: 646d41e23b583fc3b8cc4579 -title: Step 77 +title: Step 79 challengeType: 0 -dashedName: step-77 +dashedName: step-79 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md index 14138e9ca93..fbdf249ccbe 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md @@ -1,8 +1,8 @@ --- id: 646d423fade4a9c4636acd13 -title: Step 78 +title: Step 80 challengeType: 0 -dashedName: step-78 +dashedName: step-80 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md index 78368ca5d37..7b929decac2 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md @@ -1,8 +1,8 @@ --- id: 646d42f58deb2fc52adc6611 -title: Step 79 +title: Step 81 challengeType: 0 -dashedName: step-79 +dashedName: step-81 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md index 7c817f3c473..6c03c828f8d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md @@ -1,8 +1,8 @@ --- id: 646d43587d926bc5b6cb2e50 -title: Step 80 +title: Step 82 challengeType: 0 -dashedName: step-80 +dashedName: step-82 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md index e61b9a38b4a..ebfac0b9aeb 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md @@ -1,8 +1,8 @@ --- id: 646d448479c8fdc8dcec868c -title: Step 81 +title: Step 83 challengeType: 0 -dashedName: step-81 +dashedName: step-83 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md index 558cef71b0f..aa83fe34555 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md @@ -1,8 +1,8 @@ --- id: 646d44da986f2bc9b72f5fe2 -title: Step 82 +title: Step 84 challengeType: 0 -dashedName: step-82 +dashedName: step-84 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md index da034ff8cd9..21d28405f26 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md @@ -1,8 +1,8 @@ --- id: 646d451c2e44afca71b67818 -title: Step 83 +title: Step 85 challengeType: 0 -dashedName: step-83 +dashedName: step-85 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md index 11e1632f84c..b8629fc2e12 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md @@ -1,8 +1,8 @@ --- id: 646d4554721d43cb19a68bc4 -title: Step 84 +title: Step 86 challengeType: 0 -dashedName: step-84 +dashedName: step-86 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md index 773d9dff52b..53a0f3b823b 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md @@ -1,8 +1,8 @@ --- id: 646d45b739da5ecbf830c108 -title: Step 85 +title: Step 87 challengeType: 0 -dashedName: step-85 +dashedName: step-87 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md index 99952a5bece..19849ef8c79 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md @@ -1,8 +1,8 @@ --- id: 646d45ee725632cca2555146 -title: Step 86 +title: Step 88 challengeType: 0 -dashedName: step-86 +dashedName: step-88 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md index 5eb843c3164..21236e19958 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md @@ -1,8 +1,8 @@ --- id: 646d4626420eeecd51f241c2 -title: Step 87 +title: Step 89 challengeType: 0 -dashedName: step-87 +dashedName: step-89 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md index 3ec60146d03..9277356624f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md @@ -1,8 +1,8 @@ --- id: 646d467c6994f4ce0dc416a4 -title: Step 88 +title: Step 90 challengeType: 0 -dashedName: step-88 +dashedName: step-90 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md index 0144779f15e..43808a1fe26 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md @@ -1,8 +1,8 @@ --- id: 646d46c03e7d02cecb30f021 -title: Step 89 +title: Step 91 challengeType: 0 -dashedName: step-89 +dashedName: step-91 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md index de7fb664c3a..7926b0aa4e5 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md @@ -1,8 +1,8 @@ --- id: 646d4717a689e1cfa232e357 -title: Step 90 +title: Step 92 challengeType: 0 -dashedName: step-90 +dashedName: step-92 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md index 469bf574f9e..2c9733e01b0 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md @@ -1,8 +1,8 @@ --- id: 646d4769ba65f1d05ef6b634 -title: Step 91 +title: Step 93 challengeType: 0 -dashedName: step-91 +dashedName: step-93 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md index 124a786dab9..fd91e878fcd 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md @@ -1,8 +1,8 @@ --- id: 646d47c8f58107d10f1e5106 -title: Step 92 +title: Step 94 challengeType: 0 -dashedName: step-92 +dashedName: step-94 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md index dc4c70b62ac..db2a4e90437 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md @@ -1,8 +1,8 @@ --- id: 646d4813c17b37d1e261a566 -title: Step 93 +title: Step 95 challengeType: 0 -dashedName: step-93 +dashedName: step-95 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md index 449e0054421..7d8e9aa3122 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md @@ -1,8 +1,8 @@ --- id: 646d486aec20f7d2a581cc36 -title: Step 94 +title: Step 96 challengeType: 0 -dashedName: step-94 +dashedName: step-96 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md index 519590a84fa..96a39c72c8f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md @@ -1,8 +1,8 @@ --- id: 646d48b936802fd34c3f05af -title: Step 95 +title: Step 97 challengeType: 0 -dashedName: step-95 +dashedName: step-97 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md index cc8b97da8c6..fd91d70e425 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md @@ -1,8 +1,8 @@ --- id: 646d498c8ebc31d3f753b22e -title: Step 96 +title: Step 98 challengeType: 0 -dashedName: step-96 +dashedName: step-98 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md index 0a62d2e9cc6..537acec2ad8 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md @@ -1,8 +1,8 @@ --- id: 646d49bfff9079d4b38df115 -title: Step 97 +title: Step 99 challengeType: 0 -dashedName: step-97 +dashedName: step-99 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md index 5efd22ab0b7..200c2e16ac6 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md @@ -1,8 +1,8 @@ --- id: 646d4a07a8fb14d55cd70e09 -title: Step 98 +title: Step 100 challengeType: 0 -dashedName: step-98 +dashedName: step-100 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md index ee241dee98e..51707a2bd52 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md @@ -1,8 +1,8 @@ --- id: 646d4a5b32a1cad6165df286 -title: Step 100 +title: Step 102 challengeType: 0 -dashedName: step-100 +dashedName: step-102 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md index 93ee83dcf49..8abcf6505fb 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md @@ -1,8 +1,8 @@ --- id: 646d4a8dbc04c6d6bb0001f8 -title: Step 101 +title: Step 103 challengeType: 0 -dashedName: step-101 +dashedName: step-103 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md index c380ecd405a..8093cab4152 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md @@ -1,8 +1,8 @@ --- id: 646d4ab9b3b4c5d74fdd2154 -title: Step 102 +title: Step 104 challengeType: 0 -dashedName: step-102 +dashedName: step-104 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md index 5457abbb3fd..4ec6876419d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md @@ -1,8 +1,8 @@ --- id: 646d4b3d80ea98d824c8a4f9 -title: Step 103 +title: Step 105 challengeType: 0 -dashedName: step-103 +dashedName: step-105 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md index 41696356307..a2a6cc9edf4 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md @@ -1,8 +1,8 @@ --- id: 6491d38f5b09a021c4b5d5fe -title: Step 99 +title: Step 101 challengeType: 0 -dashedName: step-99 +dashedName: step-101 --- # --description-- diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md new file mode 100644 index 00000000000..7c2489b5b09 --- /dev/null +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md @@ -0,0 +1,159 @@ +--- +id: 661f48f412d7631a1d9c30e6 +title: Step 75 +challengeType: 0 +dashedName: step-75 +--- + +# --description-- + +You should use `console.log()` to print the result of calling the `highPrecedence` function with the string `"5*3"`. + +# --hints-- + +You should call `console.log()`. + +```js + +assert.match(code, /console\.log\(/); + +``` + +You should call your `highPrecedence` function. + +```js + +assert.match(code, /console\.log\(highPrecedence\(/); + + +``` + +Pass `5*3` as the argument + +```js + +assert.match(code, /console\.log\(highPrecedence\(["']5\*3["']\)\);?/); + +``` + + + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} + +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md new file mode 100644 index 00000000000..a36def51c9b --- /dev/null +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md @@ -0,0 +1,148 @@ +--- +id: 661f49650572031c6ebdb8e3 +title: Step 76 +challengeType: 0 +dashedName: step-76 +--- + +# --description-- + +Remove both the `console.log()` with your `highPrecedence` call, and the `return` statement from your `highPrecedence` function. + +# --hints-- + +Your code should not log the result of `highPrecedence("5*3")`. + +```js + +assert.notMatch(code, /console\.log\(highPrecedence\("5\*3"\)\)/); + +``` + +Your `highPrecedence` function should not return a value. + +```js + +assert.isUndefined(highPrecedence("5*3")); + +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} +console.log(highPrecedence("5*3")); +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md index 035126503c4..e90506c129f 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md @@ -14,6 +14,7 @@ For example, this code would assign the number `25` to the second element in the ```js let array = [1, 2, 3]; array[1] = 25; +console.log(array); // prints [1, 25, 3] ``` Update the **third** element of your `rows` array to be the number `10`. Then print the `rows` array to your console. diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md index 08b283f65e4..47b58025670 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md @@ -7,7 +7,7 @@ dashedName: step-25 # --description-- -Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `"Title:"`. +Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `Title:`. # --hints-- @@ -29,7 +29,7 @@ You should create a `strong` element after the opening tag of your `p` element. assert.match(code, /

/) ``` -Your `strong` element should have the text `"Title:"`. +Your `strong` element should have the text `Title:`. ```js assert.match(code, /

Title:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md index 6f104a6b68d..4535f1a4330 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md @@ -7,7 +7,7 @@ dashedName: step-26 # --description-- -Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `"Date:"`. +Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `Date:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element and interpolate `${date}` as the text. assert.match(code, /

.*\$\{date\}<\/p>/) ``` -You should create a `strong` element with the text `"Date:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Date:` after the opening tag of your `p` element. ```js assert.match(code, /

Date:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md index 03cba96db5c..1f8aa88d063 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md @@ -9,7 +9,7 @@ dashedName: step-28 To allow for task management, you need to include both a delete and an edit button for each task. -Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `"Edit"` and the text of the second button to `"Delete"`. +Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `Edit` and the text of the second button to `Delete`. # --hints-- @@ -19,7 +19,7 @@ You should create a `button` element of type `button`, a class `btn` and `"Edit" assert.match(code, /Edit<\/button/) ``` -You should create a `button` element of type `button` a class `btn` and `"Delete"` as the text, in that order. +You should create a `button` element of type `button` a class `btn` and `Delete` as the text, in that order. ```js assert.match(code, /Delete<\/button/) diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md index fd1945e43d0..1bca79335e1 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md @@ -1,8 +1,8 @@ --- id: 64fb1c4dc0feb219149a7c7d -title: Step 53 +title: Step 52 challengeType: 0 -dashedName: step-53 +dashedName: step-52 --- # --description-- @@ -307,7 +307,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md index 0c5aef4f9a2..cb787162942 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md @@ -1,8 +1,8 @@ --- id: 64fb285637fa1e1c222033e3 -title: Step 54 +title: Step 53 challengeType: 0 -dashedName: step-54 +dashedName: step-53 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md index 27538cc5ecf..53c055a2e6d 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md @@ -1,8 +1,8 @@ --- id: 64fb29348a60361ccd45c1e2 -title: Step 55 +title: Step 54 challengeType: 0 -dashedName: step-55 +dashedName: step-54 --- # --description-- @@ -304,7 +304,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md index 42de45bd160..349a1226355 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md @@ -1,8 +1,8 @@ --- id: 64fefebad99209211ec30537 -title: Step 56 +title: Step 55 challengeType: 0 -dashedName: step-56 +dashedName: step-55 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md index 42d6ed6ae2d..8c8c80db659 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md @@ -1,8 +1,8 @@ --- id: 64ff0313700dad264d19dfe4 -title: Step 57 +title: Step 56 challengeType: 0 -dashedName: step-57 +dashedName: step-56 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md index 1ca2784a3cc..89f8f555a63 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md @@ -1,8 +1,8 @@ --- id: 64ff04cc33779427a6412449 -title: Step 58 +title: Step 57 challengeType: 0 -dashedName: step-58 +dashedName: step-57 --- # --description-- @@ -296,7 +296,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md index 49f4240707d..ae847c9b4ab 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md @@ -1,8 +1,8 @@ --- id: 64ff068e0426eb288874ed79 -title: Step 59 +title: Step 58 challengeType: 0 -dashedName: step-59 +dashedName: step-58 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md index df55f88ac55..a69e6d3f98a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md @@ -1,8 +1,8 @@ --- id: 64ff23daf176a92de95f24dc -title: Step 60 +title: Step 59 challengeType: 0 -dashedName: step-60 +dashedName: step-59 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md index 8f51f137e15..2d43ea0abaf 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md @@ -1,8 +1,8 @@ --- id: 64ff24b80431f62ec6b93f65 -title: Step 61 +title: Step 60 challengeType: 0 -dashedName: step-61 +dashedName: step-60 --- # --description-- @@ -286,7 +286,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md index 651b7fef4e1..defd194933a 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md @@ -1,8 +1,8 @@ --- id: 65003986d17d1e1865b269c0 -title: Step 62 +title: Step 61 challengeType: 0 -dashedName: step-62 +dashedName: step-61 --- # --description-- @@ -302,7 +302,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md index a0508d09fd1..1504db737a7 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md @@ -1,8 +1,8 @@ --- id: 650046832f92c01a35834bca -title: Step 63 +title: Step 62 challengeType: 0 -dashedName: step-63 +dashedName: step-62 --- # --description-- @@ -303,7 +303,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md index 0103dc8d732..2759f899e93 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md @@ -1,8 +1,8 @@ --- id: 650048b0764f9c1b798200e2 -title: Step 64 +title: Step 63 challengeType: 0 -dashedName: step-64 +dashedName: step-63 --- # --description-- @@ -290,7 +290,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md index a4b34f17043..304cbb31463 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md @@ -1,8 +1,8 @@ --- id: 65004ba581d03d1d5628b41c -title: Step 65 +title: Step 64 challengeType: 0 -dashedName: step-65 +dashedName: step-64 --- # --description-- @@ -23,8 +23,6 @@ In that example, if `arr` has a length greater than `0`, the code inside the `if Check if there's a task inside `taskData`, then call the `updateTaskContainer()` inside the `if` statement block. -With that, you've completed this project. - # --hints-- You should create an `if` statement with `(taskData.length)` as the condition. As a reminder, `0` is a falsy value. @@ -308,7 +306,6 @@ const taskData = JSON.parse(localStorage.getItem("data")) || []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, @@ -413,377 +410,3 @@ taskForm.addEventListener("submit", (e) => { addOrUpdateTask(); }); ``` - -# --solutions-- - -```html - - - - - - - - Learn localStorage by Building a Todo App - - - - -

-

Todo App

-
- - - -
-

Discard unsaved changes?

-
- - -
-
-
-
-
-
- - - - -``` - -```css -:root { - --white: #fff; - --light-grey: #f5f6f7; - --dark-grey: #0a0a23; - --yellow: #f1be32; - --golden-yellow: #feac32; -} - -*, -*::before, -*::after { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - background-color: var(--dark-grey); -} - -main { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -h1 { - color: var(--light-grey); - margin: 20px 0 40px 0; -} - -.todo-app { - background-color: var(--white); - width: 300px; - height: 350px; - border: 5px solid var(--yellow); - border-radius: 8px; - padding: 15px; - position: relative; - display: flex; - flex-direction: column; - gap: 10px; -} - -.btn { - cursor: pointer; - width: 100px; - margin: 10px; - color: var(--dark-grey); - background-color: var(--golden-yellow); - background-image: linear-gradient(#fecc4c, #ffac33); - border-color: var(--golden-yellow); - border-width: 3px; -} - -.btn:hover { - background-image: linear-gradient(#ffcc4c, #f89808); -} - -.large-btn { - width: 80%; - font-size: 1.2rem; - align-self: center; - justify-self: center; -} - -.close-task-form-btn { - background: none; - border: none; - cursor: pointer; -} - -.close-icon { - width: 20px; - height: 20px; -} - -.task-form { - display: flex; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - background-color: var(--white); - border-radius: 5px; - padding: 15px; - width: 300px; - height: 350px; - flex-direction: column; - justify-content: space-between; - overflow: auto; -} - -.task-form-header { - display: flex; - justify-content: flex-end; -} - -.task-form-body { - display: flex; - flex-direction: column; - justify-content: space-around; -} - -.task-form-footer { - display: flex; - justify-content: center; -} - -.task-form-label, -#title-input, -#date-input, -#description-input { - display: block; -} - -.task-form-label { - margin-bottom: 5px; - font-size: 1.3rem; - font-weight: bold; -} - -#title-input, -#date-input, -#description-input { - width: 100%; - margin-bottom: 10px; - padding: 2px; -} - -#confirm-close-dialog { - padding: 10px; - margin: 10px auto; - border-radius: 15px; -} - -.confirm-close-dialog-btn-container { - display: flex; - justify-content: center; - margin-top: 10px; -} - -.discard-message-text { - font-weight: bold; - font-size: 1.5rem; -} - -#tasks-container { - height: 100%; - overflow-y: auto; -} - -.task { - margin: 5px 0; -} - -.hidden { - display: none; -} - -@media (min-width: 576px) { - .todo-app, - .task-form { - width: 400px; - height: 450px; - } - - .task-form-label { - font-size: 1.5rem; - } - - #title-input, - #date-input { - height: 2rem; - } - - #title-input, - #date-input, - #description-input { - padding: 5px; - margin-bottom: 20px; - } -} -``` - -```js -const taskForm = document.getElementById("task-form"); -const confirmCloseDialog = document.getElementById("confirm-close-dialog"); -const openTaskFormBtn = document.getElementById("open-task-form-btn"); -const closeTaskFormBtn = document.getElementById("close-task-form-btn"); -const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); -const cancelBtn = document.getElementById("cancel-btn"); -const discardBtn = document.getElementById("discard-btn"); -const tasksContainer = document.getElementById("tasks-container"); -const titleInput = document.getElementById("title-input"); -const dateInput = document.getElementById("date-input"); -const descriptionInput = document.getElementById("description-input"); - -const taskData = JSON.parse(localStorage.getItem("data")) || []; -let currentTask = {}; - -const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; - const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); - const taskObj = { - id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, - title: titleInput.value, - date: dateInput.value, - description: descriptionInput.value, - }; - - if (dataArrIndex === -1) { - taskData.unshift(taskObj); - } else { - taskData[dataArrIndex] = taskObj; - } - - localStorage.setItem("data", JSON.stringify(taskData)); - updateTaskContainer() - reset() -}; - -const updateTaskContainer = () => { - tasksContainer.innerHTML = ""; - - taskData.forEach( - ({ id, title, date, description }) => { - (tasksContainer.innerHTML += ` -
-

Title: ${title}

-

Date: ${date}

-

Description: ${description}

- - -
- `) - } - ); -}; - - -const deleteTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - buttonEl.parentElement.remove(); - taskData.splice(dataArrIndex, 1); - localStorage.setItem("data", JSON.stringify(taskData)); -} - -const editTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - currentTask = taskData[dataArrIndex]; - - titleInput.value = currentTask.title; - dateInput.value = currentTask.date; - descriptionInput.value = currentTask.description; - - addOrUpdateTaskBtn.innerText = "Update Task"; - - - taskForm.classList.toggle("hidden"); -} - -const reset = () => { - titleInput.value = ""; - dateInput.value = ""; - descriptionInput.value = ""; - taskForm.classList.toggle("hidden"); - currentTask = {}; -} - -if (taskData.length) { - updateTaskContainer(); -} - -openTaskFormBtn.addEventListener("click", () => - taskForm.classList.toggle("hidden") -); - -closeTaskFormBtn.addEventListener("click", () => { - const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; - const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; - - if (formInputsContainValues && formInputValuesUpdated) { - confirmCloseDialog.showModal(); - } else { - reset(); - } -}); - -cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); - -discardBtn.addEventListener("click", () => { - confirmCloseDialog.close(); - reset() -}); - -taskForm.addEventListener("submit", (e) => { - e.preventDefault(); - - addOrUpdateTask(); -}); -``` diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md index 8a982fe77be..e1223fd9b03 100644 --- a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md @@ -7,7 +7,7 @@ dashedName: step-27 # --description-- -Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `"Description:"`. +Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `Description:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element with `${description}` as the text. assert.match(code, /

.*\$\{description\}<\/p>/) ``` -You should create a `strong` element with the text `"Description:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Description:` after the opening tag of your `p` element. ```js assert.match(code, /

Description:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md new file mode 100644 index 00000000000..8f2a57bf4e0 --- /dev/null +++ b/curriculum/challenges/arabic/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md @@ -0,0 +1,774 @@ +--- +id: 6632420f81f3cc554a5e540b +title: Step 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +If you try to add a new task, edit that task, and then click on the `Add New Task` button, you will notice a bug. + +The form button will display the incorrect text of `"Update Task"` instead of `"Add Task"`. To fix this, you will need to assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText` inside your `reset` function. + +With that, you've completed this project. + +# --hints-- + +You should assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText`. + +```js +assert.match(code, /addOrUpdateTaskBtn\.innerText\s*=\s*('|")Add Task\1\s*/) +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +

+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + --fcc-editable-region-- + + --fcc-editable-region-- + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` + + +# --solutions-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +
+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + addOrUpdateTaskBtn.innerText = "Add Task"; + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` diff --git a/curriculum/challenges/arabic/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md b/curriculum/challenges/arabic/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md new file mode 100644 index 00000000000..1e918708d4c --- /dev/null +++ b/curriculum/challenges/arabic/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md @@ -0,0 +1,61 @@ +--- +id: 6619240f46cec8e04d77e03a +title: Basic Functions Exercise A +challengeType: 1 +dashedName: top-basic-functions-exercise-a +--- + +# --description-- + +Create a function that takes in an integer. This function should return the given `integer + 7` if the integer is less than `10`. If the integer is greater than or equal to `10`, it should return the given `integer - 3`. + +The name of the function should be `addOrSubtract`. + +# --hints-- + +You should have a function called `addOrSubtract`. + +```js +assert.isFunction(addOrSubtract); +``` + +Your function should take in an integer as an argument. + +```js +assert.match(addOrSubtract.toString(), /\s*addOrSubtract\(\s*\w+\s*\)/); +``` + +You should return the given integer + 7 if the integer is less than 10. + +```js +assert.strictEqual(addOrSubtract(5), 12); +``` + +You should return the given integer - 3 if the integer is greater than or equal to 10. + +```js +assert.strictEqual(addOrSubtract(10), 7); +``` + + + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function addOrSubtract(num) { + if (num < 10) { + return num + 7; + } else { + return num - 3; + } +} +``` diff --git a/curriculum/challenges/arabic/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md b/curriculum/challenges/arabic/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md new file mode 100644 index 00000000000..4dbba976428 --- /dev/null +++ b/curriculum/challenges/arabic/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md @@ -0,0 +1,47 @@ +--- +id: 661e131f068359c3ccf2f4d6 +title: Basic Functions Exercise B +challengeType: 1 +dashedName: top-basic-functions-exercise-b +--- + +# --description-- + +Write a function, named `multiply`, that takes two parameters and returns their product. + +# --hints-- + +You should have a function named `multiply`. + +```js +assert.isFunction(multiply); +``` + +Your function should take in two integers as arguments. + +```js +assert.match(multiply.toString(), /\s*multiply\(\s*\w+\s*,\s*\w+\s*\)/); +``` + +You should return the product of the two integers. + +```js +assert.strictEqual(multiply(10, 10), 100); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function multiply(a, b) { + return a * b; +} +``` diff --git a/curriculum/challenges/arabic/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md b/curriculum/challenges/arabic/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md new file mode 100644 index 00000000000..0c0640ae277 --- /dev/null +++ b/curriculum/challenges/arabic/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md @@ -0,0 +1,47 @@ +--- +id: 661e151f068359c3ccf2f4d7 +title: Basic Functions Exercise C +challengeType: 1 +dashedName: top-basic-functions-exercise-c +--- + +# --description-- + +Write a function, named `capitalize`, that takes a string as an parameter and returns a new string with the first letter capitalized. + +# --hints-- + +You should have a function named `capitalize`. + +```js +assert.isFunction(capitalize); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(capitalize.toString(), /\s*capitalize\(\s*\w+\s*\)/); +``` + +Your function should return a new string with the first letter capitalized. + +```js +assert.strictEqual(capitalize('sem'), 'Sem'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function capitalize(str) { + return str[0].toUpperCase() + str.slice(1); +} +``` diff --git a/curriculum/challenges/arabic/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md b/curriculum/challenges/arabic/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md new file mode 100644 index 00000000000..79d9031b2d9 --- /dev/null +++ b/curriculum/challenges/arabic/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md @@ -0,0 +1,47 @@ +--- +id: 661e17c6068359c3ccf2f4d8 +title: Basic Functions Exercise D +challengeType: 1 +dashedName: top-basic-functions-exercise-d +--- + +# --description-- + +Write a function, named `lastLetter`, that takes a string as a parameter and returns the last letter of the string. + +# --hints-- + +You should have a function named `lastLetter`. + +```js +assert.isFunction(lastLetter); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(lastLetter.toString(), /\s*lastLetter\(\s*\w+\s*\)/); +``` + +You should return the last letter of the string. + +```js +assert.strictEqual(lastLetter('Sem'), 'm'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function lastLetter(str) { + return str[str.length - 1]; +} +``` diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b1b54dda895..f5b7aaf7c32 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -39,7 +39,13 @@ Your `idToText` function should have an `id` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>/); ``` -You should assign `idToText` the result of calling the `.find()` method on your `cells` array. +Your `idToText` function should return the result of calling the `.find()` method on your `cells` array. Your callback function should use an implicit return. + +```js +assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); +``` + +Your `idToText` function should use an implicit return. ```js assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(/); @@ -57,12 +63,6 @@ Your callback function should have a `cell` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>/); ``` -Your callback function should use an implicit return. - -```js -assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); -``` - Your callback function should return whether `cell.id` is strictly equal to `id`. ```js diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md index 6ea58bc46e0..59e5ad6294e 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md @@ -11,72 +11,48 @@ In your `highPrecedence` function, declare a `regex` variable. Assign it a regul Each number, and the operator, should be in separate capture groups. +Incorporate the regular expression you've defined into your `highPrecedence` function to test if the provided string `str` matches the pattern. Use the `test()` method on your `regex` variable and return the result. + # --hints-- + You should declare a `regex` variable in your `highPrecedence` function. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*(?:const|let|var)\s+regex/); + ``` You should use `const` to declare your `regex` variable. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex/); + ``` Your `regex` variable should be a regular expression. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\//); + ``` -Your `regex` should use a capture group. +Your highPrecedence should return `regex.test(str);` ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(/); +assert.match(code, /return\s+regex\.test\(str\);?/); + ``` -Your first capture group should use a character class. +Please enter a properly functioning regex. ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[/); -``` -Your first capture group should match any digit or a period. Use the special `\d` character class. +assert.strictEqual(highPrecedence("5*3"), true); -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]/); -``` - -Your first capture group should match the character class one or more times. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)/); -``` - -Your `regex` should use a second capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(/); -``` - -Your second capture group should match a `*` or `/` operator. Use a character class in the capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)/); -``` - -Your `regex` should use a third capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(/); -``` - -Your third capture group should be the same as your first capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)/); ``` # --seed-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md index 6311798060f..3ba875ffb40 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md @@ -1,8 +1,8 @@ --- id: 646d40c543943ec250039682 -title: Step 75 +title: Step 77 challengeType: 0 -dashedName: step-75 +dashedName: step-77 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md index 3a66e0d1799..04c2e896ab3 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md @@ -1,8 +1,8 @@ --- id: 646d40fe4b7b50c30c2b4cd8 -title: Step 76 +title: Step 78 challengeType: 0 -dashedName: step-76 +dashedName: step-78 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md index 9e4657a50f7..356e13ac467 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md @@ -1,8 +1,8 @@ --- id: 646d41e23b583fc3b8cc4579 -title: Step 77 +title: Step 79 challengeType: 0 -dashedName: step-77 +dashedName: step-79 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md index 14138e9ca93..fbdf249ccbe 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md @@ -1,8 +1,8 @@ --- id: 646d423fade4a9c4636acd13 -title: Step 78 +title: Step 80 challengeType: 0 -dashedName: step-78 +dashedName: step-80 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md index 78368ca5d37..7b929decac2 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md @@ -1,8 +1,8 @@ --- id: 646d42f58deb2fc52adc6611 -title: Step 79 +title: Step 81 challengeType: 0 -dashedName: step-79 +dashedName: step-81 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md index 7c817f3c473..6c03c828f8d 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md @@ -1,8 +1,8 @@ --- id: 646d43587d926bc5b6cb2e50 -title: Step 80 +title: Step 82 challengeType: 0 -dashedName: step-80 +dashedName: step-82 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md index e61b9a38b4a..ebfac0b9aeb 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md @@ -1,8 +1,8 @@ --- id: 646d448479c8fdc8dcec868c -title: Step 81 +title: Step 83 challengeType: 0 -dashedName: step-81 +dashedName: step-83 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md index 558cef71b0f..aa83fe34555 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md @@ -1,8 +1,8 @@ --- id: 646d44da986f2bc9b72f5fe2 -title: Step 82 +title: Step 84 challengeType: 0 -dashedName: step-82 +dashedName: step-84 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md index da034ff8cd9..21d28405f26 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md @@ -1,8 +1,8 @@ --- id: 646d451c2e44afca71b67818 -title: Step 83 +title: Step 85 challengeType: 0 -dashedName: step-83 +dashedName: step-85 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md index 11e1632f84c..b8629fc2e12 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md @@ -1,8 +1,8 @@ --- id: 646d4554721d43cb19a68bc4 -title: Step 84 +title: Step 86 challengeType: 0 -dashedName: step-84 +dashedName: step-86 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md index 773d9dff52b..53a0f3b823b 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md @@ -1,8 +1,8 @@ --- id: 646d45b739da5ecbf830c108 -title: Step 85 +title: Step 87 challengeType: 0 -dashedName: step-85 +dashedName: step-87 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md index 99952a5bece..19849ef8c79 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md @@ -1,8 +1,8 @@ --- id: 646d45ee725632cca2555146 -title: Step 86 +title: Step 88 challengeType: 0 -dashedName: step-86 +dashedName: step-88 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md index 5eb843c3164..21236e19958 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md @@ -1,8 +1,8 @@ --- id: 646d4626420eeecd51f241c2 -title: Step 87 +title: Step 89 challengeType: 0 -dashedName: step-87 +dashedName: step-89 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md index 3ec60146d03..9277356624f 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md @@ -1,8 +1,8 @@ --- id: 646d467c6994f4ce0dc416a4 -title: Step 88 +title: Step 90 challengeType: 0 -dashedName: step-88 +dashedName: step-90 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md index 0144779f15e..43808a1fe26 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md @@ -1,8 +1,8 @@ --- id: 646d46c03e7d02cecb30f021 -title: Step 89 +title: Step 91 challengeType: 0 -dashedName: step-89 +dashedName: step-91 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md index de7fb664c3a..7926b0aa4e5 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md @@ -1,8 +1,8 @@ --- id: 646d4717a689e1cfa232e357 -title: Step 90 +title: Step 92 challengeType: 0 -dashedName: step-90 +dashedName: step-92 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md index 469bf574f9e..2c9733e01b0 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md @@ -1,8 +1,8 @@ --- id: 646d4769ba65f1d05ef6b634 -title: Step 91 +title: Step 93 challengeType: 0 -dashedName: step-91 +dashedName: step-93 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md index 124a786dab9..fd91e878fcd 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md @@ -1,8 +1,8 @@ --- id: 646d47c8f58107d10f1e5106 -title: Step 92 +title: Step 94 challengeType: 0 -dashedName: step-92 +dashedName: step-94 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md index dc4c70b62ac..db2a4e90437 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md @@ -1,8 +1,8 @@ --- id: 646d4813c17b37d1e261a566 -title: Step 93 +title: Step 95 challengeType: 0 -dashedName: step-93 +dashedName: step-95 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md index 449e0054421..7d8e9aa3122 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md @@ -1,8 +1,8 @@ --- id: 646d486aec20f7d2a581cc36 -title: Step 94 +title: Step 96 challengeType: 0 -dashedName: step-94 +dashedName: step-96 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md index 519590a84fa..96a39c72c8f 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md @@ -1,8 +1,8 @@ --- id: 646d48b936802fd34c3f05af -title: Step 95 +title: Step 97 challengeType: 0 -dashedName: step-95 +dashedName: step-97 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md index cc8b97da8c6..fd91d70e425 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md @@ -1,8 +1,8 @@ --- id: 646d498c8ebc31d3f753b22e -title: Step 96 +title: Step 98 challengeType: 0 -dashedName: step-96 +dashedName: step-98 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md index 0a62d2e9cc6..537acec2ad8 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md @@ -1,8 +1,8 @@ --- id: 646d49bfff9079d4b38df115 -title: Step 97 +title: Step 99 challengeType: 0 -dashedName: step-97 +dashedName: step-99 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md index 5efd22ab0b7..200c2e16ac6 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md @@ -1,8 +1,8 @@ --- id: 646d4a07a8fb14d55cd70e09 -title: Step 98 +title: Step 100 challengeType: 0 -dashedName: step-98 +dashedName: step-100 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md index ee241dee98e..51707a2bd52 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md @@ -1,8 +1,8 @@ --- id: 646d4a5b32a1cad6165df286 -title: Step 100 +title: Step 102 challengeType: 0 -dashedName: step-100 +dashedName: step-102 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md index 93ee83dcf49..8abcf6505fb 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md @@ -1,8 +1,8 @@ --- id: 646d4a8dbc04c6d6bb0001f8 -title: Step 101 +title: Step 103 challengeType: 0 -dashedName: step-101 +dashedName: step-103 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md index c380ecd405a..8093cab4152 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md @@ -1,8 +1,8 @@ --- id: 646d4ab9b3b4c5d74fdd2154 -title: Step 102 +title: Step 104 challengeType: 0 -dashedName: step-102 +dashedName: step-104 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md index 5457abbb3fd..4ec6876419d 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md @@ -1,8 +1,8 @@ --- id: 646d4b3d80ea98d824c8a4f9 -title: Step 103 +title: Step 105 challengeType: 0 -dashedName: step-103 +dashedName: step-105 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md index 41696356307..a2a6cc9edf4 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md @@ -1,8 +1,8 @@ --- id: 6491d38f5b09a021c4b5d5fe -title: Step 99 +title: Step 101 challengeType: 0 -dashedName: step-99 +dashedName: step-101 --- # --description-- diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md new file mode 100644 index 00000000000..7c2489b5b09 --- /dev/null +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md @@ -0,0 +1,159 @@ +--- +id: 661f48f412d7631a1d9c30e6 +title: Step 75 +challengeType: 0 +dashedName: step-75 +--- + +# --description-- + +You should use `console.log()` to print the result of calling the `highPrecedence` function with the string `"5*3"`. + +# --hints-- + +You should call `console.log()`. + +```js + +assert.match(code, /console\.log\(/); + +``` + +You should call your `highPrecedence` function. + +```js + +assert.match(code, /console\.log\(highPrecedence\(/); + + +``` + +Pass `5*3` as the argument + +```js + +assert.match(code, /console\.log\(highPrecedence\(["']5\*3["']\)\);?/); + +``` + + + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} + +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md new file mode 100644 index 00000000000..a36def51c9b --- /dev/null +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md @@ -0,0 +1,148 @@ +--- +id: 661f49650572031c6ebdb8e3 +title: Step 76 +challengeType: 0 +dashedName: step-76 +--- + +# --description-- + +Remove both the `console.log()` with your `highPrecedence` call, and the `return` statement from your `highPrecedence` function. + +# --hints-- + +Your code should not log the result of `highPrecedence("5*3")`. + +```js + +assert.notMatch(code, /console\.log\(highPrecedence\("5\*3"\)\)/); + +``` + +Your `highPrecedence` function should not return a value. + +```js + +assert.isUndefined(highPrecedence("5*3")); + +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} +console.log(highPrecedence("5*3")); +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md index 035126503c4..e90506c129f 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md @@ -14,6 +14,7 @@ For example, this code would assign the number `25` to the second element in the ```js let array = [1, 2, 3]; array[1] = 25; +console.log(array); // prints [1, 25, 3] ``` Update the **third** element of your `rows` array to be the number `10`. Then print the `rows` array to your console. diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md index 08b283f65e4..47b58025670 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md @@ -7,7 +7,7 @@ dashedName: step-25 # --description-- -Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `"Title:"`. +Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `Title:`. # --hints-- @@ -29,7 +29,7 @@ You should create a `strong` element after the opening tag of your `p` element. assert.match(code, /

/) ``` -Your `strong` element should have the text `"Title:"`. +Your `strong` element should have the text `Title:`. ```js assert.match(code, /

Title:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md index 6f104a6b68d..4535f1a4330 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md @@ -7,7 +7,7 @@ dashedName: step-26 # --description-- -Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `"Date:"`. +Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `Date:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element and interpolate `${date}` as the text. assert.match(code, /

.*\$\{date\}<\/p>/) ``` -You should create a `strong` element with the text `"Date:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Date:` after the opening tag of your `p` element. ```js assert.match(code, /

Date:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md index 03cba96db5c..1f8aa88d063 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md @@ -9,7 +9,7 @@ dashedName: step-28 To allow for task management, you need to include both a delete and an edit button for each task. -Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `"Edit"` and the text of the second button to `"Delete"`. +Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `Edit` and the text of the second button to `Delete`. # --hints-- @@ -19,7 +19,7 @@ You should create a `button` element of type `button`, a class `btn` and `"Edit" assert.match(code, /Edit<\/button/) ``` -You should create a `button` element of type `button` a class `btn` and `"Delete"` as the text, in that order. +You should create a `button` element of type `button` a class `btn` and `Delete` as the text, in that order. ```js assert.match(code, /Delete<\/button/) diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md index fd1945e43d0..1bca79335e1 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md @@ -1,8 +1,8 @@ --- id: 64fb1c4dc0feb219149a7c7d -title: Step 53 +title: Step 52 challengeType: 0 -dashedName: step-53 +dashedName: step-52 --- # --description-- @@ -307,7 +307,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md index 0c5aef4f9a2..cb787162942 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md @@ -1,8 +1,8 @@ --- id: 64fb285637fa1e1c222033e3 -title: Step 54 +title: Step 53 challengeType: 0 -dashedName: step-54 +dashedName: step-53 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md index 27538cc5ecf..53c055a2e6d 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md @@ -1,8 +1,8 @@ --- id: 64fb29348a60361ccd45c1e2 -title: Step 55 +title: Step 54 challengeType: 0 -dashedName: step-55 +dashedName: step-54 --- # --description-- @@ -304,7 +304,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md index 42de45bd160..349a1226355 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md @@ -1,8 +1,8 @@ --- id: 64fefebad99209211ec30537 -title: Step 56 +title: Step 55 challengeType: 0 -dashedName: step-56 +dashedName: step-55 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md index 42d6ed6ae2d..8c8c80db659 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md @@ -1,8 +1,8 @@ --- id: 64ff0313700dad264d19dfe4 -title: Step 57 +title: Step 56 challengeType: 0 -dashedName: step-57 +dashedName: step-56 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md index 1ca2784a3cc..89f8f555a63 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md @@ -1,8 +1,8 @@ --- id: 64ff04cc33779427a6412449 -title: Step 58 +title: Step 57 challengeType: 0 -dashedName: step-58 +dashedName: step-57 --- # --description-- @@ -296,7 +296,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md index 49f4240707d..ae847c9b4ab 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md @@ -1,8 +1,8 @@ --- id: 64ff068e0426eb288874ed79 -title: Step 59 +title: Step 58 challengeType: 0 -dashedName: step-59 +dashedName: step-58 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md index df55f88ac55..a69e6d3f98a 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md @@ -1,8 +1,8 @@ --- id: 64ff23daf176a92de95f24dc -title: Step 60 +title: Step 59 challengeType: 0 -dashedName: step-60 +dashedName: step-59 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md index 8f51f137e15..2d43ea0abaf 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md @@ -1,8 +1,8 @@ --- id: 64ff24b80431f62ec6b93f65 -title: Step 61 +title: Step 60 challengeType: 0 -dashedName: step-61 +dashedName: step-60 --- # --description-- @@ -286,7 +286,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md index 651b7fef4e1..defd194933a 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md @@ -1,8 +1,8 @@ --- id: 65003986d17d1e1865b269c0 -title: Step 62 +title: Step 61 challengeType: 0 -dashedName: step-62 +dashedName: step-61 --- # --description-- @@ -302,7 +302,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md index a0508d09fd1..1504db737a7 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md @@ -1,8 +1,8 @@ --- id: 650046832f92c01a35834bca -title: Step 63 +title: Step 62 challengeType: 0 -dashedName: step-63 +dashedName: step-62 --- # --description-- @@ -303,7 +303,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md index 0103dc8d732..2759f899e93 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md @@ -1,8 +1,8 @@ --- id: 650048b0764f9c1b798200e2 -title: Step 64 +title: Step 63 challengeType: 0 -dashedName: step-64 +dashedName: step-63 --- # --description-- @@ -290,7 +290,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md index a4b34f17043..304cbb31463 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md @@ -1,8 +1,8 @@ --- id: 65004ba581d03d1d5628b41c -title: Step 65 +title: Step 64 challengeType: 0 -dashedName: step-65 +dashedName: step-64 --- # --description-- @@ -23,8 +23,6 @@ In that example, if `arr` has a length greater than `0`, the code inside the `if Check if there's a task inside `taskData`, then call the `updateTaskContainer()` inside the `if` statement block. -With that, you've completed this project. - # --hints-- You should create an `if` statement with `(taskData.length)` as the condition. As a reminder, `0` is a falsy value. @@ -308,7 +306,6 @@ const taskData = JSON.parse(localStorage.getItem("data")) || []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, @@ -413,377 +410,3 @@ taskForm.addEventListener("submit", (e) => { addOrUpdateTask(); }); ``` - -# --solutions-- - -```html - - - - - - - - Learn localStorage by Building a Todo App - - - - -

-

Todo App

-
- - - -
-

Discard unsaved changes?

-
- - -
-
-
-
-
-
- - - - -``` - -```css -:root { - --white: #fff; - --light-grey: #f5f6f7; - --dark-grey: #0a0a23; - --yellow: #f1be32; - --golden-yellow: #feac32; -} - -*, -*::before, -*::after { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - background-color: var(--dark-grey); -} - -main { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -h1 { - color: var(--light-grey); - margin: 20px 0 40px 0; -} - -.todo-app { - background-color: var(--white); - width: 300px; - height: 350px; - border: 5px solid var(--yellow); - border-radius: 8px; - padding: 15px; - position: relative; - display: flex; - flex-direction: column; - gap: 10px; -} - -.btn { - cursor: pointer; - width: 100px; - margin: 10px; - color: var(--dark-grey); - background-color: var(--golden-yellow); - background-image: linear-gradient(#fecc4c, #ffac33); - border-color: var(--golden-yellow); - border-width: 3px; -} - -.btn:hover { - background-image: linear-gradient(#ffcc4c, #f89808); -} - -.large-btn { - width: 80%; - font-size: 1.2rem; - align-self: center; - justify-self: center; -} - -.close-task-form-btn { - background: none; - border: none; - cursor: pointer; -} - -.close-icon { - width: 20px; - height: 20px; -} - -.task-form { - display: flex; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - background-color: var(--white); - border-radius: 5px; - padding: 15px; - width: 300px; - height: 350px; - flex-direction: column; - justify-content: space-between; - overflow: auto; -} - -.task-form-header { - display: flex; - justify-content: flex-end; -} - -.task-form-body { - display: flex; - flex-direction: column; - justify-content: space-around; -} - -.task-form-footer { - display: flex; - justify-content: center; -} - -.task-form-label, -#title-input, -#date-input, -#description-input { - display: block; -} - -.task-form-label { - margin-bottom: 5px; - font-size: 1.3rem; - font-weight: bold; -} - -#title-input, -#date-input, -#description-input { - width: 100%; - margin-bottom: 10px; - padding: 2px; -} - -#confirm-close-dialog { - padding: 10px; - margin: 10px auto; - border-radius: 15px; -} - -.confirm-close-dialog-btn-container { - display: flex; - justify-content: center; - margin-top: 10px; -} - -.discard-message-text { - font-weight: bold; - font-size: 1.5rem; -} - -#tasks-container { - height: 100%; - overflow-y: auto; -} - -.task { - margin: 5px 0; -} - -.hidden { - display: none; -} - -@media (min-width: 576px) { - .todo-app, - .task-form { - width: 400px; - height: 450px; - } - - .task-form-label { - font-size: 1.5rem; - } - - #title-input, - #date-input { - height: 2rem; - } - - #title-input, - #date-input, - #description-input { - padding: 5px; - margin-bottom: 20px; - } -} -``` - -```js -const taskForm = document.getElementById("task-form"); -const confirmCloseDialog = document.getElementById("confirm-close-dialog"); -const openTaskFormBtn = document.getElementById("open-task-form-btn"); -const closeTaskFormBtn = document.getElementById("close-task-form-btn"); -const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); -const cancelBtn = document.getElementById("cancel-btn"); -const discardBtn = document.getElementById("discard-btn"); -const tasksContainer = document.getElementById("tasks-container"); -const titleInput = document.getElementById("title-input"); -const dateInput = document.getElementById("date-input"); -const descriptionInput = document.getElementById("description-input"); - -const taskData = JSON.parse(localStorage.getItem("data")) || []; -let currentTask = {}; - -const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; - const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); - const taskObj = { - id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, - title: titleInput.value, - date: dateInput.value, - description: descriptionInput.value, - }; - - if (dataArrIndex === -1) { - taskData.unshift(taskObj); - } else { - taskData[dataArrIndex] = taskObj; - } - - localStorage.setItem("data", JSON.stringify(taskData)); - updateTaskContainer() - reset() -}; - -const updateTaskContainer = () => { - tasksContainer.innerHTML = ""; - - taskData.forEach( - ({ id, title, date, description }) => { - (tasksContainer.innerHTML += ` -
-

Title: ${title}

-

Date: ${date}

-

Description: ${description}

- - -
- `) - } - ); -}; - - -const deleteTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - buttonEl.parentElement.remove(); - taskData.splice(dataArrIndex, 1); - localStorage.setItem("data", JSON.stringify(taskData)); -} - -const editTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - currentTask = taskData[dataArrIndex]; - - titleInput.value = currentTask.title; - dateInput.value = currentTask.date; - descriptionInput.value = currentTask.description; - - addOrUpdateTaskBtn.innerText = "Update Task"; - - - taskForm.classList.toggle("hidden"); -} - -const reset = () => { - titleInput.value = ""; - dateInput.value = ""; - descriptionInput.value = ""; - taskForm.classList.toggle("hidden"); - currentTask = {}; -} - -if (taskData.length) { - updateTaskContainer(); -} - -openTaskFormBtn.addEventListener("click", () => - taskForm.classList.toggle("hidden") -); - -closeTaskFormBtn.addEventListener("click", () => { - const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; - const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; - - if (formInputsContainValues && formInputValuesUpdated) { - confirmCloseDialog.showModal(); - } else { - reset(); - } -}); - -cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); - -discardBtn.addEventListener("click", () => { - confirmCloseDialog.close(); - reset() -}); - -taskForm.addEventListener("submit", (e) => { - e.preventDefault(); - - addOrUpdateTask(); -}); -``` diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md index 8a982fe77be..e1223fd9b03 100644 --- a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md @@ -7,7 +7,7 @@ dashedName: step-27 # --description-- -Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `"Description:"`. +Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `Description:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element with `${description}` as the text. assert.match(code, /

.*\$\{description\}<\/p>/) ``` -You should create a `strong` element with the text `"Description:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Description:` after the opening tag of your `p` element. ```js assert.match(code, /

Description:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md new file mode 100644 index 00000000000..8f2a57bf4e0 --- /dev/null +++ b/curriculum/challenges/chinese-traditional/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md @@ -0,0 +1,774 @@ +--- +id: 6632420f81f3cc554a5e540b +title: Step 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +If you try to add a new task, edit that task, and then click on the `Add New Task` button, you will notice a bug. + +The form button will display the incorrect text of `"Update Task"` instead of `"Add Task"`. To fix this, you will need to assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText` inside your `reset` function. + +With that, you've completed this project. + +# --hints-- + +You should assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText`. + +```js +assert.match(code, /addOrUpdateTaskBtn\.innerText\s*=\s*('|")Add Task\1\s*/) +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +

+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + --fcc-editable-region-- + + --fcc-editable-region-- + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` + + +# --solutions-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +
+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + addOrUpdateTaskBtn.innerText = "Add Task"; + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` diff --git a/curriculum/challenges/chinese-traditional/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md b/curriculum/challenges/chinese-traditional/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md new file mode 100644 index 00000000000..1e918708d4c --- /dev/null +++ b/curriculum/challenges/chinese-traditional/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md @@ -0,0 +1,61 @@ +--- +id: 6619240f46cec8e04d77e03a +title: Basic Functions Exercise A +challengeType: 1 +dashedName: top-basic-functions-exercise-a +--- + +# --description-- + +Create a function that takes in an integer. This function should return the given `integer + 7` if the integer is less than `10`. If the integer is greater than or equal to `10`, it should return the given `integer - 3`. + +The name of the function should be `addOrSubtract`. + +# --hints-- + +You should have a function called `addOrSubtract`. + +```js +assert.isFunction(addOrSubtract); +``` + +Your function should take in an integer as an argument. + +```js +assert.match(addOrSubtract.toString(), /\s*addOrSubtract\(\s*\w+\s*\)/); +``` + +You should return the given integer + 7 if the integer is less than 10. + +```js +assert.strictEqual(addOrSubtract(5), 12); +``` + +You should return the given integer - 3 if the integer is greater than or equal to 10. + +```js +assert.strictEqual(addOrSubtract(10), 7); +``` + + + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function addOrSubtract(num) { + if (num < 10) { + return num + 7; + } else { + return num - 3; + } +} +``` diff --git a/curriculum/challenges/chinese-traditional/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md b/curriculum/challenges/chinese-traditional/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md new file mode 100644 index 00000000000..4dbba976428 --- /dev/null +++ b/curriculum/challenges/chinese-traditional/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md @@ -0,0 +1,47 @@ +--- +id: 661e131f068359c3ccf2f4d6 +title: Basic Functions Exercise B +challengeType: 1 +dashedName: top-basic-functions-exercise-b +--- + +# --description-- + +Write a function, named `multiply`, that takes two parameters and returns their product. + +# --hints-- + +You should have a function named `multiply`. + +```js +assert.isFunction(multiply); +``` + +Your function should take in two integers as arguments. + +```js +assert.match(multiply.toString(), /\s*multiply\(\s*\w+\s*,\s*\w+\s*\)/); +``` + +You should return the product of the two integers. + +```js +assert.strictEqual(multiply(10, 10), 100); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function multiply(a, b) { + return a * b; +} +``` diff --git a/curriculum/challenges/chinese-traditional/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md b/curriculum/challenges/chinese-traditional/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md new file mode 100644 index 00000000000..0c0640ae277 --- /dev/null +++ b/curriculum/challenges/chinese-traditional/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md @@ -0,0 +1,47 @@ +--- +id: 661e151f068359c3ccf2f4d7 +title: Basic Functions Exercise C +challengeType: 1 +dashedName: top-basic-functions-exercise-c +--- + +# --description-- + +Write a function, named `capitalize`, that takes a string as an parameter and returns a new string with the first letter capitalized. + +# --hints-- + +You should have a function named `capitalize`. + +```js +assert.isFunction(capitalize); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(capitalize.toString(), /\s*capitalize\(\s*\w+\s*\)/); +``` + +Your function should return a new string with the first letter capitalized. + +```js +assert.strictEqual(capitalize('sem'), 'Sem'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function capitalize(str) { + return str[0].toUpperCase() + str.slice(1); +} +``` diff --git a/curriculum/challenges/chinese-traditional/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md b/curriculum/challenges/chinese-traditional/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md new file mode 100644 index 00000000000..79d9031b2d9 --- /dev/null +++ b/curriculum/challenges/chinese-traditional/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md @@ -0,0 +1,47 @@ +--- +id: 661e17c6068359c3ccf2f4d8 +title: Basic Functions Exercise D +challengeType: 1 +dashedName: top-basic-functions-exercise-d +--- + +# --description-- + +Write a function, named `lastLetter`, that takes a string as a parameter and returns the last letter of the string. + +# --hints-- + +You should have a function named `lastLetter`. + +```js +assert.isFunction(lastLetter); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(lastLetter.toString(), /\s*lastLetter\(\s*\w+\s*\)/); +``` + +You should return the last letter of the string. + +```js +assert.strictEqual(lastLetter('Sem'), 'm'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function lastLetter(str) { + return str[str.length - 1]; +} +``` diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b1b54dda895..f5b7aaf7c32 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -39,7 +39,13 @@ Your `idToText` function should have an `id` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>/); ``` -You should assign `idToText` the result of calling the `.find()` method on your `cells` array. +Your `idToText` function should return the result of calling the `.find()` method on your `cells` array. Your callback function should use an implicit return. + +```js +assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); +``` + +Your `idToText` function should use an implicit return. ```js assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(/); @@ -57,12 +63,6 @@ Your callback function should have a `cell` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>/); ``` -Your callback function should use an implicit return. - -```js -assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); -``` - Your callback function should return whether `cell.id` is strictly equal to `id`. ```js diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md index 6ea58bc46e0..59e5ad6294e 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md @@ -11,72 +11,48 @@ In your `highPrecedence` function, declare a `regex` variable. Assign it a regul Each number, and the operator, should be in separate capture groups. +Incorporate the regular expression you've defined into your `highPrecedence` function to test if the provided string `str` matches the pattern. Use the `test()` method on your `regex` variable and return the result. + # --hints-- + You should declare a `regex` variable in your `highPrecedence` function. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*(?:const|let|var)\s+regex/); + ``` You should use `const` to declare your `regex` variable. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex/); + ``` Your `regex` variable should be a regular expression. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\//); + ``` -Your `regex` should use a capture group. +Your highPrecedence should return `regex.test(str);` ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(/); +assert.match(code, /return\s+regex\.test\(str\);?/); + ``` -Your first capture group should use a character class. +Please enter a properly functioning regex. ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[/); -``` -Your first capture group should match any digit or a period. Use the special `\d` character class. +assert.strictEqual(highPrecedence("5*3"), true); -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]/); -``` - -Your first capture group should match the character class one or more times. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)/); -``` - -Your `regex` should use a second capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(/); -``` - -Your second capture group should match a `*` or `/` operator. Use a character class in the capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)/); -``` - -Your `regex` should use a third capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(/); -``` - -Your third capture group should be the same as your first capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)/); ``` # --seed-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md index 6311798060f..3ba875ffb40 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md @@ -1,8 +1,8 @@ --- id: 646d40c543943ec250039682 -title: Step 75 +title: Step 77 challengeType: 0 -dashedName: step-75 +dashedName: step-77 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md index 3a66e0d1799..04c2e896ab3 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md @@ -1,8 +1,8 @@ --- id: 646d40fe4b7b50c30c2b4cd8 -title: Step 76 +title: Step 78 challengeType: 0 -dashedName: step-76 +dashedName: step-78 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md index 9e4657a50f7..356e13ac467 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md @@ -1,8 +1,8 @@ --- id: 646d41e23b583fc3b8cc4579 -title: Step 77 +title: Step 79 challengeType: 0 -dashedName: step-77 +dashedName: step-79 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md index 14138e9ca93..fbdf249ccbe 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md @@ -1,8 +1,8 @@ --- id: 646d423fade4a9c4636acd13 -title: Step 78 +title: Step 80 challengeType: 0 -dashedName: step-78 +dashedName: step-80 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md index 78368ca5d37..7b929decac2 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md @@ -1,8 +1,8 @@ --- id: 646d42f58deb2fc52adc6611 -title: Step 79 +title: Step 81 challengeType: 0 -dashedName: step-79 +dashedName: step-81 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md index 7c817f3c473..6c03c828f8d 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md @@ -1,8 +1,8 @@ --- id: 646d43587d926bc5b6cb2e50 -title: Step 80 +title: Step 82 challengeType: 0 -dashedName: step-80 +dashedName: step-82 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md index e61b9a38b4a..ebfac0b9aeb 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md @@ -1,8 +1,8 @@ --- id: 646d448479c8fdc8dcec868c -title: Step 81 +title: Step 83 challengeType: 0 -dashedName: step-81 +dashedName: step-83 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md index 558cef71b0f..aa83fe34555 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md @@ -1,8 +1,8 @@ --- id: 646d44da986f2bc9b72f5fe2 -title: Step 82 +title: Step 84 challengeType: 0 -dashedName: step-82 +dashedName: step-84 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md index da034ff8cd9..21d28405f26 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md @@ -1,8 +1,8 @@ --- id: 646d451c2e44afca71b67818 -title: Step 83 +title: Step 85 challengeType: 0 -dashedName: step-83 +dashedName: step-85 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md index 11e1632f84c..b8629fc2e12 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md @@ -1,8 +1,8 @@ --- id: 646d4554721d43cb19a68bc4 -title: Step 84 +title: Step 86 challengeType: 0 -dashedName: step-84 +dashedName: step-86 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md index 773d9dff52b..53a0f3b823b 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md @@ -1,8 +1,8 @@ --- id: 646d45b739da5ecbf830c108 -title: Step 85 +title: Step 87 challengeType: 0 -dashedName: step-85 +dashedName: step-87 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md index 99952a5bece..19849ef8c79 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md @@ -1,8 +1,8 @@ --- id: 646d45ee725632cca2555146 -title: Step 86 +title: Step 88 challengeType: 0 -dashedName: step-86 +dashedName: step-88 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md index 5eb843c3164..21236e19958 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md @@ -1,8 +1,8 @@ --- id: 646d4626420eeecd51f241c2 -title: Step 87 +title: Step 89 challengeType: 0 -dashedName: step-87 +dashedName: step-89 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md index 3ec60146d03..9277356624f 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md @@ -1,8 +1,8 @@ --- id: 646d467c6994f4ce0dc416a4 -title: Step 88 +title: Step 90 challengeType: 0 -dashedName: step-88 +dashedName: step-90 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md index 0144779f15e..43808a1fe26 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md @@ -1,8 +1,8 @@ --- id: 646d46c03e7d02cecb30f021 -title: Step 89 +title: Step 91 challengeType: 0 -dashedName: step-89 +dashedName: step-91 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md index de7fb664c3a..7926b0aa4e5 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md @@ -1,8 +1,8 @@ --- id: 646d4717a689e1cfa232e357 -title: Step 90 +title: Step 92 challengeType: 0 -dashedName: step-90 +dashedName: step-92 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md index 469bf574f9e..2c9733e01b0 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md @@ -1,8 +1,8 @@ --- id: 646d4769ba65f1d05ef6b634 -title: Step 91 +title: Step 93 challengeType: 0 -dashedName: step-91 +dashedName: step-93 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md index 124a786dab9..fd91e878fcd 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md @@ -1,8 +1,8 @@ --- id: 646d47c8f58107d10f1e5106 -title: Step 92 +title: Step 94 challengeType: 0 -dashedName: step-92 +dashedName: step-94 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md index dc4c70b62ac..db2a4e90437 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md @@ -1,8 +1,8 @@ --- id: 646d4813c17b37d1e261a566 -title: Step 93 +title: Step 95 challengeType: 0 -dashedName: step-93 +dashedName: step-95 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md index 449e0054421..7d8e9aa3122 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md @@ -1,8 +1,8 @@ --- id: 646d486aec20f7d2a581cc36 -title: Step 94 +title: Step 96 challengeType: 0 -dashedName: step-94 +dashedName: step-96 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md index 519590a84fa..96a39c72c8f 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md @@ -1,8 +1,8 @@ --- id: 646d48b936802fd34c3f05af -title: Step 95 +title: Step 97 challengeType: 0 -dashedName: step-95 +dashedName: step-97 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md index cc8b97da8c6..fd91d70e425 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md @@ -1,8 +1,8 @@ --- id: 646d498c8ebc31d3f753b22e -title: Step 96 +title: Step 98 challengeType: 0 -dashedName: step-96 +dashedName: step-98 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md index 0a62d2e9cc6..537acec2ad8 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md @@ -1,8 +1,8 @@ --- id: 646d49bfff9079d4b38df115 -title: Step 97 +title: Step 99 challengeType: 0 -dashedName: step-97 +dashedName: step-99 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md index 5efd22ab0b7..200c2e16ac6 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md @@ -1,8 +1,8 @@ --- id: 646d4a07a8fb14d55cd70e09 -title: Step 98 +title: Step 100 challengeType: 0 -dashedName: step-98 +dashedName: step-100 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md index ee241dee98e..51707a2bd52 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md @@ -1,8 +1,8 @@ --- id: 646d4a5b32a1cad6165df286 -title: Step 100 +title: Step 102 challengeType: 0 -dashedName: step-100 +dashedName: step-102 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md index 93ee83dcf49..8abcf6505fb 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md @@ -1,8 +1,8 @@ --- id: 646d4a8dbc04c6d6bb0001f8 -title: Step 101 +title: Step 103 challengeType: 0 -dashedName: step-101 +dashedName: step-103 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md index c380ecd405a..8093cab4152 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md @@ -1,8 +1,8 @@ --- id: 646d4ab9b3b4c5d74fdd2154 -title: Step 102 +title: Step 104 challengeType: 0 -dashedName: step-102 +dashedName: step-104 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md index 5457abbb3fd..4ec6876419d 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md @@ -1,8 +1,8 @@ --- id: 646d4b3d80ea98d824c8a4f9 -title: Step 103 +title: Step 105 challengeType: 0 -dashedName: step-103 +dashedName: step-105 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md index 41696356307..a2a6cc9edf4 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md @@ -1,8 +1,8 @@ --- id: 6491d38f5b09a021c4b5d5fe -title: Step 99 +title: Step 101 challengeType: 0 -dashedName: step-99 +dashedName: step-101 --- # --description-- diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md new file mode 100644 index 00000000000..7c2489b5b09 --- /dev/null +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md @@ -0,0 +1,159 @@ +--- +id: 661f48f412d7631a1d9c30e6 +title: Step 75 +challengeType: 0 +dashedName: step-75 +--- + +# --description-- + +You should use `console.log()` to print the result of calling the `highPrecedence` function with the string `"5*3"`. + +# --hints-- + +You should call `console.log()`. + +```js + +assert.match(code, /console\.log\(/); + +``` + +You should call your `highPrecedence` function. + +```js + +assert.match(code, /console\.log\(highPrecedence\(/); + + +``` + +Pass `5*3` as the argument + +```js + +assert.match(code, /console\.log\(highPrecedence\(["']5\*3["']\)\);?/); + +``` + + + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} + +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md new file mode 100644 index 00000000000..a36def51c9b --- /dev/null +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md @@ -0,0 +1,148 @@ +--- +id: 661f49650572031c6ebdb8e3 +title: Step 76 +challengeType: 0 +dashedName: step-76 +--- + +# --description-- + +Remove both the `console.log()` with your `highPrecedence` call, and the `return` statement from your `highPrecedence` function. + +# --hints-- + +Your code should not log the result of `highPrecedence("5*3")`. + +```js + +assert.notMatch(code, /console\.log\(highPrecedence\("5\*3"\)\)/); + +``` + +Your `highPrecedence` function should not return a value. + +```js + +assert.isUndefined(highPrecedence("5*3")); + +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} +console.log(highPrecedence("5*3")); +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md index 035126503c4..e90506c129f 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md @@ -14,6 +14,7 @@ For example, this code would assign the number `25` to the second element in the ```js let array = [1, 2, 3]; array[1] = 25; +console.log(array); // prints [1, 25, 3] ``` Update the **third** element of your `rows` array to be the number `10`. Then print the `rows` array to your console. diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md index 08b283f65e4..47b58025670 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md @@ -7,7 +7,7 @@ dashedName: step-25 # --description-- -Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `"Title:"`. +Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `Title:`. # --hints-- @@ -29,7 +29,7 @@ You should create a `strong` element after the opening tag of your `p` element. assert.match(code, /

/) ``` -Your `strong` element should have the text `"Title:"`. +Your `strong` element should have the text `Title:`. ```js assert.match(code, /

Title:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md index 6f104a6b68d..4535f1a4330 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md @@ -7,7 +7,7 @@ dashedName: step-26 # --description-- -Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `"Date:"`. +Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `Date:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element and interpolate `${date}` as the text. assert.match(code, /

.*\$\{date\}<\/p>/) ``` -You should create a `strong` element with the text `"Date:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Date:` after the opening tag of your `p` element. ```js assert.match(code, /

Date:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md index 03cba96db5c..1f8aa88d063 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md @@ -9,7 +9,7 @@ dashedName: step-28 To allow for task management, you need to include both a delete and an edit button for each task. -Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `"Edit"` and the text of the second button to `"Delete"`. +Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `Edit` and the text of the second button to `Delete`. # --hints-- @@ -19,7 +19,7 @@ You should create a `button` element of type `button`, a class `btn` and `"Edit" assert.match(code, /Edit<\/button/) ``` -You should create a `button` element of type `button` a class `btn` and `"Delete"` as the text, in that order. +You should create a `button` element of type `button` a class `btn` and `Delete` as the text, in that order. ```js assert.match(code, /Delete<\/button/) diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md index fd1945e43d0..1bca79335e1 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md @@ -1,8 +1,8 @@ --- id: 64fb1c4dc0feb219149a7c7d -title: Step 53 +title: Step 52 challengeType: 0 -dashedName: step-53 +dashedName: step-52 --- # --description-- @@ -307,7 +307,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md index 0c5aef4f9a2..cb787162942 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md @@ -1,8 +1,8 @@ --- id: 64fb285637fa1e1c222033e3 -title: Step 54 +title: Step 53 challengeType: 0 -dashedName: step-54 +dashedName: step-53 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md index 27538cc5ecf..53c055a2e6d 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md @@ -1,8 +1,8 @@ --- id: 64fb29348a60361ccd45c1e2 -title: Step 55 +title: Step 54 challengeType: 0 -dashedName: step-55 +dashedName: step-54 --- # --description-- @@ -304,7 +304,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md index 42de45bd160..349a1226355 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md @@ -1,8 +1,8 @@ --- id: 64fefebad99209211ec30537 -title: Step 56 +title: Step 55 challengeType: 0 -dashedName: step-56 +dashedName: step-55 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md index 42d6ed6ae2d..8c8c80db659 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md @@ -1,8 +1,8 @@ --- id: 64ff0313700dad264d19dfe4 -title: Step 57 +title: Step 56 challengeType: 0 -dashedName: step-57 +dashedName: step-56 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md index 1ca2784a3cc..89f8f555a63 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md @@ -1,8 +1,8 @@ --- id: 64ff04cc33779427a6412449 -title: Step 58 +title: Step 57 challengeType: 0 -dashedName: step-58 +dashedName: step-57 --- # --description-- @@ -296,7 +296,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md index 49f4240707d..ae847c9b4ab 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md @@ -1,8 +1,8 @@ --- id: 64ff068e0426eb288874ed79 -title: Step 59 +title: Step 58 challengeType: 0 -dashedName: step-59 +dashedName: step-58 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md index df55f88ac55..a69e6d3f98a 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md @@ -1,8 +1,8 @@ --- id: 64ff23daf176a92de95f24dc -title: Step 60 +title: Step 59 challengeType: 0 -dashedName: step-60 +dashedName: step-59 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md index 8f51f137e15..2d43ea0abaf 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md @@ -1,8 +1,8 @@ --- id: 64ff24b80431f62ec6b93f65 -title: Step 61 +title: Step 60 challengeType: 0 -dashedName: step-61 +dashedName: step-60 --- # --description-- @@ -286,7 +286,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md index 651b7fef4e1..defd194933a 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md @@ -1,8 +1,8 @@ --- id: 65003986d17d1e1865b269c0 -title: Step 62 +title: Step 61 challengeType: 0 -dashedName: step-62 +dashedName: step-61 --- # --description-- @@ -302,7 +302,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md index a0508d09fd1..1504db737a7 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md @@ -1,8 +1,8 @@ --- id: 650046832f92c01a35834bca -title: Step 63 +title: Step 62 challengeType: 0 -dashedName: step-63 +dashedName: step-62 --- # --description-- @@ -303,7 +303,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md index 0103dc8d732..2759f899e93 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md @@ -1,8 +1,8 @@ --- id: 650048b0764f9c1b798200e2 -title: Step 64 +title: Step 63 challengeType: 0 -dashedName: step-64 +dashedName: step-63 --- # --description-- @@ -290,7 +290,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md index a4b34f17043..304cbb31463 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md @@ -1,8 +1,8 @@ --- id: 65004ba581d03d1d5628b41c -title: Step 65 +title: Step 64 challengeType: 0 -dashedName: step-65 +dashedName: step-64 --- # --description-- @@ -23,8 +23,6 @@ In that example, if `arr` has a length greater than `0`, the code inside the `if Check if there's a task inside `taskData`, then call the `updateTaskContainer()` inside the `if` statement block. -With that, you've completed this project. - # --hints-- You should create an `if` statement with `(taskData.length)` as the condition. As a reminder, `0` is a falsy value. @@ -308,7 +306,6 @@ const taskData = JSON.parse(localStorage.getItem("data")) || []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, @@ -413,377 +410,3 @@ taskForm.addEventListener("submit", (e) => { addOrUpdateTask(); }); ``` - -# --solutions-- - -```html - - - - - - - - Learn localStorage by Building a Todo App - - - - -

-

Todo App

-
- - - -
-

Discard unsaved changes?

-
- - -
-
-
-
-
-
- - - - -``` - -```css -:root { - --white: #fff; - --light-grey: #f5f6f7; - --dark-grey: #0a0a23; - --yellow: #f1be32; - --golden-yellow: #feac32; -} - -*, -*::before, -*::after { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - background-color: var(--dark-grey); -} - -main { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -h1 { - color: var(--light-grey); - margin: 20px 0 40px 0; -} - -.todo-app { - background-color: var(--white); - width: 300px; - height: 350px; - border: 5px solid var(--yellow); - border-radius: 8px; - padding: 15px; - position: relative; - display: flex; - flex-direction: column; - gap: 10px; -} - -.btn { - cursor: pointer; - width: 100px; - margin: 10px; - color: var(--dark-grey); - background-color: var(--golden-yellow); - background-image: linear-gradient(#fecc4c, #ffac33); - border-color: var(--golden-yellow); - border-width: 3px; -} - -.btn:hover { - background-image: linear-gradient(#ffcc4c, #f89808); -} - -.large-btn { - width: 80%; - font-size: 1.2rem; - align-self: center; - justify-self: center; -} - -.close-task-form-btn { - background: none; - border: none; - cursor: pointer; -} - -.close-icon { - width: 20px; - height: 20px; -} - -.task-form { - display: flex; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - background-color: var(--white); - border-radius: 5px; - padding: 15px; - width: 300px; - height: 350px; - flex-direction: column; - justify-content: space-between; - overflow: auto; -} - -.task-form-header { - display: flex; - justify-content: flex-end; -} - -.task-form-body { - display: flex; - flex-direction: column; - justify-content: space-around; -} - -.task-form-footer { - display: flex; - justify-content: center; -} - -.task-form-label, -#title-input, -#date-input, -#description-input { - display: block; -} - -.task-form-label { - margin-bottom: 5px; - font-size: 1.3rem; - font-weight: bold; -} - -#title-input, -#date-input, -#description-input { - width: 100%; - margin-bottom: 10px; - padding: 2px; -} - -#confirm-close-dialog { - padding: 10px; - margin: 10px auto; - border-radius: 15px; -} - -.confirm-close-dialog-btn-container { - display: flex; - justify-content: center; - margin-top: 10px; -} - -.discard-message-text { - font-weight: bold; - font-size: 1.5rem; -} - -#tasks-container { - height: 100%; - overflow-y: auto; -} - -.task { - margin: 5px 0; -} - -.hidden { - display: none; -} - -@media (min-width: 576px) { - .todo-app, - .task-form { - width: 400px; - height: 450px; - } - - .task-form-label { - font-size: 1.5rem; - } - - #title-input, - #date-input { - height: 2rem; - } - - #title-input, - #date-input, - #description-input { - padding: 5px; - margin-bottom: 20px; - } -} -``` - -```js -const taskForm = document.getElementById("task-form"); -const confirmCloseDialog = document.getElementById("confirm-close-dialog"); -const openTaskFormBtn = document.getElementById("open-task-form-btn"); -const closeTaskFormBtn = document.getElementById("close-task-form-btn"); -const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); -const cancelBtn = document.getElementById("cancel-btn"); -const discardBtn = document.getElementById("discard-btn"); -const tasksContainer = document.getElementById("tasks-container"); -const titleInput = document.getElementById("title-input"); -const dateInput = document.getElementById("date-input"); -const descriptionInput = document.getElementById("description-input"); - -const taskData = JSON.parse(localStorage.getItem("data")) || []; -let currentTask = {}; - -const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; - const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); - const taskObj = { - id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, - title: titleInput.value, - date: dateInput.value, - description: descriptionInput.value, - }; - - if (dataArrIndex === -1) { - taskData.unshift(taskObj); - } else { - taskData[dataArrIndex] = taskObj; - } - - localStorage.setItem("data", JSON.stringify(taskData)); - updateTaskContainer() - reset() -}; - -const updateTaskContainer = () => { - tasksContainer.innerHTML = ""; - - taskData.forEach( - ({ id, title, date, description }) => { - (tasksContainer.innerHTML += ` -
-

Title: ${title}

-

Date: ${date}

-

Description: ${description}

- - -
- `) - } - ); -}; - - -const deleteTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - buttonEl.parentElement.remove(); - taskData.splice(dataArrIndex, 1); - localStorage.setItem("data", JSON.stringify(taskData)); -} - -const editTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - currentTask = taskData[dataArrIndex]; - - titleInput.value = currentTask.title; - dateInput.value = currentTask.date; - descriptionInput.value = currentTask.description; - - addOrUpdateTaskBtn.innerText = "Update Task"; - - - taskForm.classList.toggle("hidden"); -} - -const reset = () => { - titleInput.value = ""; - dateInput.value = ""; - descriptionInput.value = ""; - taskForm.classList.toggle("hidden"); - currentTask = {}; -} - -if (taskData.length) { - updateTaskContainer(); -} - -openTaskFormBtn.addEventListener("click", () => - taskForm.classList.toggle("hidden") -); - -closeTaskFormBtn.addEventListener("click", () => { - const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; - const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; - - if (formInputsContainValues && formInputValuesUpdated) { - confirmCloseDialog.showModal(); - } else { - reset(); - } -}); - -cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); - -discardBtn.addEventListener("click", () => { - confirmCloseDialog.close(); - reset() -}); - -taskForm.addEventListener("submit", (e) => { - e.preventDefault(); - - addOrUpdateTask(); -}); -``` diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md index 8a982fe77be..e1223fd9b03 100644 --- a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md @@ -7,7 +7,7 @@ dashedName: step-27 # --description-- -Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `"Description:"`. +Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `Description:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element with `${description}` as the text. assert.match(code, /

.*\$\{description\}<\/p>/) ``` -You should create a `strong` element with the text `"Description:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Description:` after the opening tag of your `p` element. ```js assert.match(code, /

Description:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md new file mode 100644 index 00000000000..8f2a57bf4e0 --- /dev/null +++ b/curriculum/challenges/chinese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md @@ -0,0 +1,774 @@ +--- +id: 6632420f81f3cc554a5e540b +title: Step 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +If you try to add a new task, edit that task, and then click on the `Add New Task` button, you will notice a bug. + +The form button will display the incorrect text of `"Update Task"` instead of `"Add Task"`. To fix this, you will need to assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText` inside your `reset` function. + +With that, you've completed this project. + +# --hints-- + +You should assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText`. + +```js +assert.match(code, /addOrUpdateTaskBtn\.innerText\s*=\s*('|")Add Task\1\s*/) +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +

+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + --fcc-editable-region-- + + --fcc-editable-region-- + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` + + +# --solutions-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +
+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + addOrUpdateTaskBtn.innerText = "Add Task"; + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` diff --git a/curriculum/challenges/chinese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md b/curriculum/challenges/chinese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md new file mode 100644 index 00000000000..1e918708d4c --- /dev/null +++ b/curriculum/challenges/chinese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md @@ -0,0 +1,61 @@ +--- +id: 6619240f46cec8e04d77e03a +title: Basic Functions Exercise A +challengeType: 1 +dashedName: top-basic-functions-exercise-a +--- + +# --description-- + +Create a function that takes in an integer. This function should return the given `integer + 7` if the integer is less than `10`. If the integer is greater than or equal to `10`, it should return the given `integer - 3`. + +The name of the function should be `addOrSubtract`. + +# --hints-- + +You should have a function called `addOrSubtract`. + +```js +assert.isFunction(addOrSubtract); +``` + +Your function should take in an integer as an argument. + +```js +assert.match(addOrSubtract.toString(), /\s*addOrSubtract\(\s*\w+\s*\)/); +``` + +You should return the given integer + 7 if the integer is less than 10. + +```js +assert.strictEqual(addOrSubtract(5), 12); +``` + +You should return the given integer - 3 if the integer is greater than or equal to 10. + +```js +assert.strictEqual(addOrSubtract(10), 7); +``` + + + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function addOrSubtract(num) { + if (num < 10) { + return num + 7; + } else { + return num - 3; + } +} +``` diff --git a/curriculum/challenges/chinese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md b/curriculum/challenges/chinese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md new file mode 100644 index 00000000000..4dbba976428 --- /dev/null +++ b/curriculum/challenges/chinese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md @@ -0,0 +1,47 @@ +--- +id: 661e131f068359c3ccf2f4d6 +title: Basic Functions Exercise B +challengeType: 1 +dashedName: top-basic-functions-exercise-b +--- + +# --description-- + +Write a function, named `multiply`, that takes two parameters and returns their product. + +# --hints-- + +You should have a function named `multiply`. + +```js +assert.isFunction(multiply); +``` + +Your function should take in two integers as arguments. + +```js +assert.match(multiply.toString(), /\s*multiply\(\s*\w+\s*,\s*\w+\s*\)/); +``` + +You should return the product of the two integers. + +```js +assert.strictEqual(multiply(10, 10), 100); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function multiply(a, b) { + return a * b; +} +``` diff --git a/curriculum/challenges/chinese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md b/curriculum/challenges/chinese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md new file mode 100644 index 00000000000..0c0640ae277 --- /dev/null +++ b/curriculum/challenges/chinese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md @@ -0,0 +1,47 @@ +--- +id: 661e151f068359c3ccf2f4d7 +title: Basic Functions Exercise C +challengeType: 1 +dashedName: top-basic-functions-exercise-c +--- + +# --description-- + +Write a function, named `capitalize`, that takes a string as an parameter and returns a new string with the first letter capitalized. + +# --hints-- + +You should have a function named `capitalize`. + +```js +assert.isFunction(capitalize); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(capitalize.toString(), /\s*capitalize\(\s*\w+\s*\)/); +``` + +Your function should return a new string with the first letter capitalized. + +```js +assert.strictEqual(capitalize('sem'), 'Sem'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function capitalize(str) { + return str[0].toUpperCase() + str.slice(1); +} +``` diff --git a/curriculum/challenges/chinese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md b/curriculum/challenges/chinese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md new file mode 100644 index 00000000000..79d9031b2d9 --- /dev/null +++ b/curriculum/challenges/chinese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md @@ -0,0 +1,47 @@ +--- +id: 661e17c6068359c3ccf2f4d8 +title: Basic Functions Exercise D +challengeType: 1 +dashedName: top-basic-functions-exercise-d +--- + +# --description-- + +Write a function, named `lastLetter`, that takes a string as a parameter and returns the last letter of the string. + +# --hints-- + +You should have a function named `lastLetter`. + +```js +assert.isFunction(lastLetter); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(lastLetter.toString(), /\s*lastLetter\(\s*\w+\s*\)/); +``` + +You should return the last letter of the string. + +```js +assert.strictEqual(lastLetter('Sem'), 'm'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function lastLetter(str) { + return str[str.length - 1]; +} +``` diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b1b54dda895..f5b7aaf7c32 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -39,7 +39,13 @@ Your `idToText` function should have an `id` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>/); ``` -You should assign `idToText` the result of calling the `.find()` method on your `cells` array. +Your `idToText` function should return the result of calling the `.find()` method on your `cells` array. Your callback function should use an implicit return. + +```js +assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); +``` + +Your `idToText` function should use an implicit return. ```js assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(/); @@ -57,12 +63,6 @@ Your callback function should have a `cell` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>/); ``` -Your callback function should use an implicit return. - -```js -assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); -``` - Your callback function should return whether `cell.id` is strictly equal to `id`. ```js diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md index 6ea58bc46e0..59e5ad6294e 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md @@ -11,72 +11,48 @@ In your `highPrecedence` function, declare a `regex` variable. Assign it a regul Each number, and the operator, should be in separate capture groups. +Incorporate the regular expression you've defined into your `highPrecedence` function to test if the provided string `str` matches the pattern. Use the `test()` method on your `regex` variable and return the result. + # --hints-- + You should declare a `regex` variable in your `highPrecedence` function. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*(?:const|let|var)\s+regex/); + ``` You should use `const` to declare your `regex` variable. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex/); + ``` Your `regex` variable should be a regular expression. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\//); + ``` -Your `regex` should use a capture group. +Your highPrecedence should return `regex.test(str);` ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(/); +assert.match(code, /return\s+regex\.test\(str\);?/); + ``` -Your first capture group should use a character class. +Please enter a properly functioning regex. ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[/); -``` -Your first capture group should match any digit or a period. Use the special `\d` character class. +assert.strictEqual(highPrecedence("5*3"), true); -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]/); -``` - -Your first capture group should match the character class one or more times. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)/); -``` - -Your `regex` should use a second capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(/); -``` - -Your second capture group should match a `*` or `/` operator. Use a character class in the capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)/); -``` - -Your `regex` should use a third capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(/); -``` - -Your third capture group should be the same as your first capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)/); ``` # --seed-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md index 6311798060f..3ba875ffb40 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md @@ -1,8 +1,8 @@ --- id: 646d40c543943ec250039682 -title: Step 75 +title: Step 77 challengeType: 0 -dashedName: step-75 +dashedName: step-77 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md index 3a66e0d1799..04c2e896ab3 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md @@ -1,8 +1,8 @@ --- id: 646d40fe4b7b50c30c2b4cd8 -title: Step 76 +title: Step 78 challengeType: 0 -dashedName: step-76 +dashedName: step-78 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md index 9e4657a50f7..356e13ac467 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md @@ -1,8 +1,8 @@ --- id: 646d41e23b583fc3b8cc4579 -title: Step 77 +title: Step 79 challengeType: 0 -dashedName: step-77 +dashedName: step-79 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md index 14138e9ca93..fbdf249ccbe 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md @@ -1,8 +1,8 @@ --- id: 646d423fade4a9c4636acd13 -title: Step 78 +title: Step 80 challengeType: 0 -dashedName: step-78 +dashedName: step-80 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md index 78368ca5d37..7b929decac2 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md @@ -1,8 +1,8 @@ --- id: 646d42f58deb2fc52adc6611 -title: Step 79 +title: Step 81 challengeType: 0 -dashedName: step-79 +dashedName: step-81 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md index 7c817f3c473..6c03c828f8d 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md @@ -1,8 +1,8 @@ --- id: 646d43587d926bc5b6cb2e50 -title: Step 80 +title: Step 82 challengeType: 0 -dashedName: step-80 +dashedName: step-82 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md index e61b9a38b4a..ebfac0b9aeb 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md @@ -1,8 +1,8 @@ --- id: 646d448479c8fdc8dcec868c -title: Step 81 +title: Step 83 challengeType: 0 -dashedName: step-81 +dashedName: step-83 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md index 558cef71b0f..aa83fe34555 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md @@ -1,8 +1,8 @@ --- id: 646d44da986f2bc9b72f5fe2 -title: Step 82 +title: Step 84 challengeType: 0 -dashedName: step-82 +dashedName: step-84 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md index da034ff8cd9..21d28405f26 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md @@ -1,8 +1,8 @@ --- id: 646d451c2e44afca71b67818 -title: Step 83 +title: Step 85 challengeType: 0 -dashedName: step-83 +dashedName: step-85 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md index 11e1632f84c..b8629fc2e12 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md @@ -1,8 +1,8 @@ --- id: 646d4554721d43cb19a68bc4 -title: Step 84 +title: Step 86 challengeType: 0 -dashedName: step-84 +dashedName: step-86 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md index 773d9dff52b..53a0f3b823b 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md @@ -1,8 +1,8 @@ --- id: 646d45b739da5ecbf830c108 -title: Step 85 +title: Step 87 challengeType: 0 -dashedName: step-85 +dashedName: step-87 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md index 99952a5bece..19849ef8c79 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md @@ -1,8 +1,8 @@ --- id: 646d45ee725632cca2555146 -title: Step 86 +title: Step 88 challengeType: 0 -dashedName: step-86 +dashedName: step-88 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md index 5eb843c3164..21236e19958 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md @@ -1,8 +1,8 @@ --- id: 646d4626420eeecd51f241c2 -title: Step 87 +title: Step 89 challengeType: 0 -dashedName: step-87 +dashedName: step-89 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md index 3ec60146d03..9277356624f 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md @@ -1,8 +1,8 @@ --- id: 646d467c6994f4ce0dc416a4 -title: Step 88 +title: Step 90 challengeType: 0 -dashedName: step-88 +dashedName: step-90 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md index 0144779f15e..43808a1fe26 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md @@ -1,8 +1,8 @@ --- id: 646d46c03e7d02cecb30f021 -title: Step 89 +title: Step 91 challengeType: 0 -dashedName: step-89 +dashedName: step-91 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md index de7fb664c3a..7926b0aa4e5 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md @@ -1,8 +1,8 @@ --- id: 646d4717a689e1cfa232e357 -title: Step 90 +title: Step 92 challengeType: 0 -dashedName: step-90 +dashedName: step-92 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md index 469bf574f9e..2c9733e01b0 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md @@ -1,8 +1,8 @@ --- id: 646d4769ba65f1d05ef6b634 -title: Step 91 +title: Step 93 challengeType: 0 -dashedName: step-91 +dashedName: step-93 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md index 124a786dab9..fd91e878fcd 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md @@ -1,8 +1,8 @@ --- id: 646d47c8f58107d10f1e5106 -title: Step 92 +title: Step 94 challengeType: 0 -dashedName: step-92 +dashedName: step-94 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md index dc4c70b62ac..db2a4e90437 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md @@ -1,8 +1,8 @@ --- id: 646d4813c17b37d1e261a566 -title: Step 93 +title: Step 95 challengeType: 0 -dashedName: step-93 +dashedName: step-95 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md index 449e0054421..7d8e9aa3122 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md @@ -1,8 +1,8 @@ --- id: 646d486aec20f7d2a581cc36 -title: Step 94 +title: Step 96 challengeType: 0 -dashedName: step-94 +dashedName: step-96 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md index 519590a84fa..96a39c72c8f 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md @@ -1,8 +1,8 @@ --- id: 646d48b936802fd34c3f05af -title: Step 95 +title: Step 97 challengeType: 0 -dashedName: step-95 +dashedName: step-97 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md index cc8b97da8c6..fd91d70e425 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md @@ -1,8 +1,8 @@ --- id: 646d498c8ebc31d3f753b22e -title: Step 96 +title: Step 98 challengeType: 0 -dashedName: step-96 +dashedName: step-98 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md index 0a62d2e9cc6..537acec2ad8 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md @@ -1,8 +1,8 @@ --- id: 646d49bfff9079d4b38df115 -title: Step 97 +title: Step 99 challengeType: 0 -dashedName: step-97 +dashedName: step-99 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md index 5efd22ab0b7..200c2e16ac6 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md @@ -1,8 +1,8 @@ --- id: 646d4a07a8fb14d55cd70e09 -title: Step 98 +title: Step 100 challengeType: 0 -dashedName: step-98 +dashedName: step-100 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md index ee241dee98e..51707a2bd52 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md @@ -1,8 +1,8 @@ --- id: 646d4a5b32a1cad6165df286 -title: Step 100 +title: Step 102 challengeType: 0 -dashedName: step-100 +dashedName: step-102 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md index 93ee83dcf49..8abcf6505fb 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md @@ -1,8 +1,8 @@ --- id: 646d4a8dbc04c6d6bb0001f8 -title: Step 101 +title: Step 103 challengeType: 0 -dashedName: step-101 +dashedName: step-103 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md index c380ecd405a..8093cab4152 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md @@ -1,8 +1,8 @@ --- id: 646d4ab9b3b4c5d74fdd2154 -title: Step 102 +title: Step 104 challengeType: 0 -dashedName: step-102 +dashedName: step-104 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md index 5457abbb3fd..4ec6876419d 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md @@ -1,8 +1,8 @@ --- id: 646d4b3d80ea98d824c8a4f9 -title: Step 103 +title: Step 105 challengeType: 0 -dashedName: step-103 +dashedName: step-105 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md index 41696356307..a2a6cc9edf4 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md @@ -1,8 +1,8 @@ --- id: 6491d38f5b09a021c4b5d5fe -title: Step 99 +title: Step 101 challengeType: 0 -dashedName: step-99 +dashedName: step-101 --- # --description-- diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md new file mode 100644 index 00000000000..7c2489b5b09 --- /dev/null +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md @@ -0,0 +1,159 @@ +--- +id: 661f48f412d7631a1d9c30e6 +title: Step 75 +challengeType: 0 +dashedName: step-75 +--- + +# --description-- + +You should use `console.log()` to print the result of calling the `highPrecedence` function with the string `"5*3"`. + +# --hints-- + +You should call `console.log()`. + +```js + +assert.match(code, /console\.log\(/); + +``` + +You should call your `highPrecedence` function. + +```js + +assert.match(code, /console\.log\(highPrecedence\(/); + + +``` + +Pass `5*3` as the argument + +```js + +assert.match(code, /console\.log\(highPrecedence\(["']5\*3["']\)\);?/); + +``` + + + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} + +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md new file mode 100644 index 00000000000..a36def51c9b --- /dev/null +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md @@ -0,0 +1,148 @@ +--- +id: 661f49650572031c6ebdb8e3 +title: Step 76 +challengeType: 0 +dashedName: step-76 +--- + +# --description-- + +Remove both the `console.log()` with your `highPrecedence` call, and the `return` statement from your `highPrecedence` function. + +# --hints-- + +Your code should not log the result of `highPrecedence("5*3")`. + +```js + +assert.notMatch(code, /console\.log\(highPrecedence\("5\*3"\)\)/); + +``` + +Your `highPrecedence` function should not return a value. + +```js + +assert.isUndefined(highPrecedence("5*3")); + +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} +console.log(highPrecedence("5*3")); +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md index 035126503c4..e90506c129f 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md @@ -14,6 +14,7 @@ For example, this code would assign the number `25` to the second element in the ```js let array = [1, 2, 3]; array[1] = 25; +console.log(array); // prints [1, 25, 3] ``` Update the **third** element of your `rows` array to be the number `10`. Then print the `rows` array to your console. diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md index 08b283f65e4..47b58025670 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md @@ -7,7 +7,7 @@ dashedName: step-25 # --description-- -Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `"Title:"`. +Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `Title:`. # --hints-- @@ -29,7 +29,7 @@ You should create a `strong` element after the opening tag of your `p` element. assert.match(code, /

/) ``` -Your `strong` element should have the text `"Title:"`. +Your `strong` element should have the text `Title:`. ```js assert.match(code, /

Title:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md index 6f104a6b68d..4535f1a4330 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md @@ -7,7 +7,7 @@ dashedName: step-26 # --description-- -Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `"Date:"`. +Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `Date:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element and interpolate `${date}` as the text. assert.match(code, /

.*\$\{date\}<\/p>/) ``` -You should create a `strong` element with the text `"Date:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Date:` after the opening tag of your `p` element. ```js assert.match(code, /

Date:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md index 03cba96db5c..1f8aa88d063 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md @@ -9,7 +9,7 @@ dashedName: step-28 To allow for task management, you need to include both a delete and an edit button for each task. -Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `"Edit"` and the text of the second button to `"Delete"`. +Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `Edit` and the text of the second button to `Delete`. # --hints-- @@ -19,7 +19,7 @@ You should create a `button` element of type `button`, a class `btn` and `"Edit" assert.match(code, /Edit<\/button/) ``` -You should create a `button` element of type `button` a class `btn` and `"Delete"` as the text, in that order. +You should create a `button` element of type `button` a class `btn` and `Delete` as the text, in that order. ```js assert.match(code, /Delete<\/button/) diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md index fd1945e43d0..1bca79335e1 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md @@ -1,8 +1,8 @@ --- id: 64fb1c4dc0feb219149a7c7d -title: Step 53 +title: Step 52 challengeType: 0 -dashedName: step-53 +dashedName: step-52 --- # --description-- @@ -307,7 +307,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md index 0c5aef4f9a2..cb787162942 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md @@ -1,8 +1,8 @@ --- id: 64fb285637fa1e1c222033e3 -title: Step 54 +title: Step 53 challengeType: 0 -dashedName: step-54 +dashedName: step-53 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md index 27538cc5ecf..53c055a2e6d 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md @@ -1,8 +1,8 @@ --- id: 64fb29348a60361ccd45c1e2 -title: Step 55 +title: Step 54 challengeType: 0 -dashedName: step-55 +dashedName: step-54 --- # --description-- @@ -304,7 +304,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md index 42de45bd160..349a1226355 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md @@ -1,8 +1,8 @@ --- id: 64fefebad99209211ec30537 -title: Step 56 +title: Step 55 challengeType: 0 -dashedName: step-56 +dashedName: step-55 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md index 42d6ed6ae2d..8c8c80db659 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md @@ -1,8 +1,8 @@ --- id: 64ff0313700dad264d19dfe4 -title: Step 57 +title: Step 56 challengeType: 0 -dashedName: step-57 +dashedName: step-56 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md index 1ca2784a3cc..89f8f555a63 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md @@ -1,8 +1,8 @@ --- id: 64ff04cc33779427a6412449 -title: Step 58 +title: Step 57 challengeType: 0 -dashedName: step-58 +dashedName: step-57 --- # --description-- @@ -296,7 +296,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md index 49f4240707d..ae847c9b4ab 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md @@ -1,8 +1,8 @@ --- id: 64ff068e0426eb288874ed79 -title: Step 59 +title: Step 58 challengeType: 0 -dashedName: step-59 +dashedName: step-58 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md index df55f88ac55..a69e6d3f98a 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md @@ -1,8 +1,8 @@ --- id: 64ff23daf176a92de95f24dc -title: Step 60 +title: Step 59 challengeType: 0 -dashedName: step-60 +dashedName: step-59 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md index 8f51f137e15..2d43ea0abaf 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md @@ -1,8 +1,8 @@ --- id: 64ff24b80431f62ec6b93f65 -title: Step 61 +title: Step 60 challengeType: 0 -dashedName: step-61 +dashedName: step-60 --- # --description-- @@ -286,7 +286,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md index 651b7fef4e1..defd194933a 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md @@ -1,8 +1,8 @@ --- id: 65003986d17d1e1865b269c0 -title: Step 62 +title: Step 61 challengeType: 0 -dashedName: step-62 +dashedName: step-61 --- # --description-- @@ -302,7 +302,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md index a0508d09fd1..1504db737a7 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md @@ -1,8 +1,8 @@ --- id: 650046832f92c01a35834bca -title: Step 63 +title: Step 62 challengeType: 0 -dashedName: step-63 +dashedName: step-62 --- # --description-- @@ -303,7 +303,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md index 0103dc8d732..2759f899e93 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md @@ -1,8 +1,8 @@ --- id: 650048b0764f9c1b798200e2 -title: Step 64 +title: Step 63 challengeType: 0 -dashedName: step-64 +dashedName: step-63 --- # --description-- @@ -290,7 +290,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md index a4b34f17043..304cbb31463 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md @@ -1,8 +1,8 @@ --- id: 65004ba581d03d1d5628b41c -title: Step 65 +title: Step 64 challengeType: 0 -dashedName: step-65 +dashedName: step-64 --- # --description-- @@ -23,8 +23,6 @@ In that example, if `arr` has a length greater than `0`, the code inside the `if Check if there's a task inside `taskData`, then call the `updateTaskContainer()` inside the `if` statement block. -With that, you've completed this project. - # --hints-- You should create an `if` statement with `(taskData.length)` as the condition. As a reminder, `0` is a falsy value. @@ -308,7 +306,6 @@ const taskData = JSON.parse(localStorage.getItem("data")) || []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, @@ -413,377 +410,3 @@ taskForm.addEventListener("submit", (e) => { addOrUpdateTask(); }); ``` - -# --solutions-- - -```html - - - - - - - - Learn localStorage by Building a Todo App - - - - -

-

Todo App

-
- - - -
-

Discard unsaved changes?

-
- - -
-
-
-
-
-
- - - - -``` - -```css -:root { - --white: #fff; - --light-grey: #f5f6f7; - --dark-grey: #0a0a23; - --yellow: #f1be32; - --golden-yellow: #feac32; -} - -*, -*::before, -*::after { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - background-color: var(--dark-grey); -} - -main { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -h1 { - color: var(--light-grey); - margin: 20px 0 40px 0; -} - -.todo-app { - background-color: var(--white); - width: 300px; - height: 350px; - border: 5px solid var(--yellow); - border-radius: 8px; - padding: 15px; - position: relative; - display: flex; - flex-direction: column; - gap: 10px; -} - -.btn { - cursor: pointer; - width: 100px; - margin: 10px; - color: var(--dark-grey); - background-color: var(--golden-yellow); - background-image: linear-gradient(#fecc4c, #ffac33); - border-color: var(--golden-yellow); - border-width: 3px; -} - -.btn:hover { - background-image: linear-gradient(#ffcc4c, #f89808); -} - -.large-btn { - width: 80%; - font-size: 1.2rem; - align-self: center; - justify-self: center; -} - -.close-task-form-btn { - background: none; - border: none; - cursor: pointer; -} - -.close-icon { - width: 20px; - height: 20px; -} - -.task-form { - display: flex; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - background-color: var(--white); - border-radius: 5px; - padding: 15px; - width: 300px; - height: 350px; - flex-direction: column; - justify-content: space-between; - overflow: auto; -} - -.task-form-header { - display: flex; - justify-content: flex-end; -} - -.task-form-body { - display: flex; - flex-direction: column; - justify-content: space-around; -} - -.task-form-footer { - display: flex; - justify-content: center; -} - -.task-form-label, -#title-input, -#date-input, -#description-input { - display: block; -} - -.task-form-label { - margin-bottom: 5px; - font-size: 1.3rem; - font-weight: bold; -} - -#title-input, -#date-input, -#description-input { - width: 100%; - margin-bottom: 10px; - padding: 2px; -} - -#confirm-close-dialog { - padding: 10px; - margin: 10px auto; - border-radius: 15px; -} - -.confirm-close-dialog-btn-container { - display: flex; - justify-content: center; - margin-top: 10px; -} - -.discard-message-text { - font-weight: bold; - font-size: 1.5rem; -} - -#tasks-container { - height: 100%; - overflow-y: auto; -} - -.task { - margin: 5px 0; -} - -.hidden { - display: none; -} - -@media (min-width: 576px) { - .todo-app, - .task-form { - width: 400px; - height: 450px; - } - - .task-form-label { - font-size: 1.5rem; - } - - #title-input, - #date-input { - height: 2rem; - } - - #title-input, - #date-input, - #description-input { - padding: 5px; - margin-bottom: 20px; - } -} -``` - -```js -const taskForm = document.getElementById("task-form"); -const confirmCloseDialog = document.getElementById("confirm-close-dialog"); -const openTaskFormBtn = document.getElementById("open-task-form-btn"); -const closeTaskFormBtn = document.getElementById("close-task-form-btn"); -const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); -const cancelBtn = document.getElementById("cancel-btn"); -const discardBtn = document.getElementById("discard-btn"); -const tasksContainer = document.getElementById("tasks-container"); -const titleInput = document.getElementById("title-input"); -const dateInput = document.getElementById("date-input"); -const descriptionInput = document.getElementById("description-input"); - -const taskData = JSON.parse(localStorage.getItem("data")) || []; -let currentTask = {}; - -const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; - const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); - const taskObj = { - id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, - title: titleInput.value, - date: dateInput.value, - description: descriptionInput.value, - }; - - if (dataArrIndex === -1) { - taskData.unshift(taskObj); - } else { - taskData[dataArrIndex] = taskObj; - } - - localStorage.setItem("data", JSON.stringify(taskData)); - updateTaskContainer() - reset() -}; - -const updateTaskContainer = () => { - tasksContainer.innerHTML = ""; - - taskData.forEach( - ({ id, title, date, description }) => { - (tasksContainer.innerHTML += ` -
-

Title: ${title}

-

Date: ${date}

-

Description: ${description}

- - -
- `) - } - ); -}; - - -const deleteTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - buttonEl.parentElement.remove(); - taskData.splice(dataArrIndex, 1); - localStorage.setItem("data", JSON.stringify(taskData)); -} - -const editTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - currentTask = taskData[dataArrIndex]; - - titleInput.value = currentTask.title; - dateInput.value = currentTask.date; - descriptionInput.value = currentTask.description; - - addOrUpdateTaskBtn.innerText = "Update Task"; - - - taskForm.classList.toggle("hidden"); -} - -const reset = () => { - titleInput.value = ""; - dateInput.value = ""; - descriptionInput.value = ""; - taskForm.classList.toggle("hidden"); - currentTask = {}; -} - -if (taskData.length) { - updateTaskContainer(); -} - -openTaskFormBtn.addEventListener("click", () => - taskForm.classList.toggle("hidden") -); - -closeTaskFormBtn.addEventListener("click", () => { - const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; - const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; - - if (formInputsContainValues && formInputValuesUpdated) { - confirmCloseDialog.showModal(); - } else { - reset(); - } -}); - -cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); - -discardBtn.addEventListener("click", () => { - confirmCloseDialog.close(); - reset() -}); - -taskForm.addEventListener("submit", (e) => { - e.preventDefault(); - - addOrUpdateTask(); -}); -``` diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md index 8a982fe77be..e1223fd9b03 100644 --- a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md @@ -7,7 +7,7 @@ dashedName: step-27 # --description-- -Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `"Description:"`. +Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `Description:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element with `${description}` as the text. assert.match(code, /

.*\$\{description\}<\/p>/) ``` -You should create a `strong` element with the text `"Description:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Description:` after the opening tag of your `p` element. ```js assert.match(code, /

Description:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md new file mode 100644 index 00000000000..8f2a57bf4e0 --- /dev/null +++ b/curriculum/challenges/espanol/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md @@ -0,0 +1,774 @@ +--- +id: 6632420f81f3cc554a5e540b +title: Step 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +If you try to add a new task, edit that task, and then click on the `Add New Task` button, you will notice a bug. + +The form button will display the incorrect text of `"Update Task"` instead of `"Add Task"`. To fix this, you will need to assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText` inside your `reset` function. + +With that, you've completed this project. + +# --hints-- + +You should assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText`. + +```js +assert.match(code, /addOrUpdateTaskBtn\.innerText\s*=\s*('|")Add Task\1\s*/) +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +

+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + --fcc-editable-region-- + + --fcc-editable-region-- + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` + + +# --solutions-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +
+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + addOrUpdateTaskBtn.innerText = "Add Task"; + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` diff --git a/curriculum/challenges/espanol/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md b/curriculum/challenges/espanol/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md new file mode 100644 index 00000000000..1e918708d4c --- /dev/null +++ b/curriculum/challenges/espanol/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md @@ -0,0 +1,61 @@ +--- +id: 6619240f46cec8e04d77e03a +title: Basic Functions Exercise A +challengeType: 1 +dashedName: top-basic-functions-exercise-a +--- + +# --description-- + +Create a function that takes in an integer. This function should return the given `integer + 7` if the integer is less than `10`. If the integer is greater than or equal to `10`, it should return the given `integer - 3`. + +The name of the function should be `addOrSubtract`. + +# --hints-- + +You should have a function called `addOrSubtract`. + +```js +assert.isFunction(addOrSubtract); +``` + +Your function should take in an integer as an argument. + +```js +assert.match(addOrSubtract.toString(), /\s*addOrSubtract\(\s*\w+\s*\)/); +``` + +You should return the given integer + 7 if the integer is less than 10. + +```js +assert.strictEqual(addOrSubtract(5), 12); +``` + +You should return the given integer - 3 if the integer is greater than or equal to 10. + +```js +assert.strictEqual(addOrSubtract(10), 7); +``` + + + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function addOrSubtract(num) { + if (num < 10) { + return num + 7; + } else { + return num - 3; + } +} +``` diff --git a/curriculum/challenges/espanol/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md b/curriculum/challenges/espanol/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md new file mode 100644 index 00000000000..4dbba976428 --- /dev/null +++ b/curriculum/challenges/espanol/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md @@ -0,0 +1,47 @@ +--- +id: 661e131f068359c3ccf2f4d6 +title: Basic Functions Exercise B +challengeType: 1 +dashedName: top-basic-functions-exercise-b +--- + +# --description-- + +Write a function, named `multiply`, that takes two parameters and returns their product. + +# --hints-- + +You should have a function named `multiply`. + +```js +assert.isFunction(multiply); +``` + +Your function should take in two integers as arguments. + +```js +assert.match(multiply.toString(), /\s*multiply\(\s*\w+\s*,\s*\w+\s*\)/); +``` + +You should return the product of the two integers. + +```js +assert.strictEqual(multiply(10, 10), 100); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function multiply(a, b) { + return a * b; +} +``` diff --git a/curriculum/challenges/espanol/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md b/curriculum/challenges/espanol/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md new file mode 100644 index 00000000000..0c0640ae277 --- /dev/null +++ b/curriculum/challenges/espanol/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md @@ -0,0 +1,47 @@ +--- +id: 661e151f068359c3ccf2f4d7 +title: Basic Functions Exercise C +challengeType: 1 +dashedName: top-basic-functions-exercise-c +--- + +# --description-- + +Write a function, named `capitalize`, that takes a string as an parameter and returns a new string with the first letter capitalized. + +# --hints-- + +You should have a function named `capitalize`. + +```js +assert.isFunction(capitalize); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(capitalize.toString(), /\s*capitalize\(\s*\w+\s*\)/); +``` + +Your function should return a new string with the first letter capitalized. + +```js +assert.strictEqual(capitalize('sem'), 'Sem'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function capitalize(str) { + return str[0].toUpperCase() + str.slice(1); +} +``` diff --git a/curriculum/challenges/espanol/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md b/curriculum/challenges/espanol/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md new file mode 100644 index 00000000000..79d9031b2d9 --- /dev/null +++ b/curriculum/challenges/espanol/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md @@ -0,0 +1,47 @@ +--- +id: 661e17c6068359c3ccf2f4d8 +title: Basic Functions Exercise D +challengeType: 1 +dashedName: top-basic-functions-exercise-d +--- + +# --description-- + +Write a function, named `lastLetter`, that takes a string as a parameter and returns the last letter of the string. + +# --hints-- + +You should have a function named `lastLetter`. + +```js +assert.isFunction(lastLetter); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(lastLetter.toString(), /\s*lastLetter\(\s*\w+\s*\)/); +``` + +You should return the last letter of the string. + +```js +assert.strictEqual(lastLetter('Sem'), 'm'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function lastLetter(str) { + return str[str.length - 1]; +} +``` diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index aa29fe5e958..ddce74c4042 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -39,7 +39,13 @@ Deine `idToText`-Funktion sollte einen `id`-Parameter verwenden. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>/); ``` -You should assign `idToText` the result of calling the `.find()` method on your `cells` array. +Your `idToText` function should return the result of calling the `.find()` method on your `cells` array. Deine Callback Funktion sollte eine implizite Rückgabe verwenden. + +```js +assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); +``` + +Your `idToText` function should use an implicit return. ```js assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(/); @@ -57,12 +63,6 @@ Deine Callback Funktion sollte einen `cell`-Parameter enthalten. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>/); ``` -Deine Callback Funktion sollte eine implizite Rückgabe verwenden. - -```js -assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); -``` - Deine Callback-Funktion sollte zurückgeben, ob `cell.id` genau gleich `id` ist. ```js diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md index 615bfe5a13c..499340c9f37 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md @@ -11,72 +11,48 @@ Deklariere in deiner `highPrecedence`-Funktion eine `regex`-Variable. Weise ihm Jede Zahl und der Operator sollten in separaten Capture-Gruppen sein. +Incorporate the regular expression you've defined into your `highPrecedence` function to test if the provided string `str` matches the pattern. Use the `test()` method on your `regex` variable and return the result. + # --hints-- + Du solltest eine `regex`-Variable in deiner `highPrecedence`-Funktion deklarieren. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*(?:const|let|var)\s+regex/); + ``` Du solltest `const` verwenden, um deine `regex`-Variable zu deklarieren. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex/); + ``` Deine `regex`-Variable sollte ein regulärer Ausdruck sein. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\//); + ``` -Dein `regex` sollte eine Capture-Gruppe verwenden. +Your highPrecedence should return `regex.test(str);` ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(/); +assert.match(code, /return\s+regex\.test\(str\);?/); + ``` -Deine erste Capture-Gruppe sollte eine Zeichenklasse verwenden. +Please enter a properly functioning regex. ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[/); -``` -Deine erste Capture-Gruppe sollte einer beliebigen Ziffer oder einem Punkt entsprechen. Verwende die spezielle `\d`-Zeichenklasse. +assert.strictEqual(highPrecedence("5*3"), true); -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]/); -``` - -Deine erste Capture-Group sollte der Zeichenklasse ein oder mehrere Male entsprechen. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)/); -``` - -Deine `regex` sollte eine zweite Capture-Gruppe verwenden. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(/); -``` - -Deine zweite Capture-Gruppe sollte einem `*`- oder `/`-Operator entsprechen. Verwende eine Zeichenklasse in der Capture-Gruppe. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)/); -``` - -Deine `regex` sollte eine dritte Capture-Gruppe verwenden. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(/); -``` - -Deine dritte Capture-Gruppe sollte die gleiche sein, wie deine erste Capture-Gruppe. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)/); ``` # --seed-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md index 4365a80a580..06b069e3822 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md @@ -1,8 +1,8 @@ --- id: 646d40c543943ec250039682 -title: Schritt 75 +title: Step 77 challengeType: 0 -dashedName: step-75 +dashedName: step-77 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md index 0256c3910de..ceb82ef4245 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md @@ -1,8 +1,8 @@ --- id: 646d40fe4b7b50c30c2b4cd8 -title: Schritt 76 +title: Step 78 challengeType: 0 -dashedName: step-76 +dashedName: step-78 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md index 9e2f006b99f..fb898a16caa 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md @@ -1,8 +1,8 @@ --- id: 646d41e23b583fc3b8cc4579 -title: Schritt 77 +title: Step 79 challengeType: 0 -dashedName: step-77 +dashedName: step-79 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md index 72a9159b945..e030df9681e 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md @@ -1,8 +1,8 @@ --- id: 646d423fade4a9c4636acd13 -title: Schritt 78 +title: Step 80 challengeType: 0 -dashedName: step-78 +dashedName: step-80 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md index 4aa07e43bbb..4a30e6e6bea 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md @@ -1,8 +1,8 @@ --- id: 646d42f58deb2fc52adc6611 -title: Schritt 79 +title: Step 81 challengeType: 0 -dashedName: step-79 +dashedName: step-81 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md index 8ca60e9bb14..fcecca8613e 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md @@ -1,8 +1,8 @@ --- id: 646d43587d926bc5b6cb2e50 -title: Schritt 80 +title: Step 82 challengeType: 0 -dashedName: step-80 +dashedName: step-82 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md index 32a2af31142..f8bf8a37bdc 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md @@ -1,8 +1,8 @@ --- id: 646d448479c8fdc8dcec868c -title: Schritt 81 +title: Step 83 challengeType: 0 -dashedName: step-81 +dashedName: step-83 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md index cbb5a87c706..9447420ccb4 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md @@ -1,8 +1,8 @@ --- id: 646d44da986f2bc9b72f5fe2 -title: Schritt 82 +title: Step 84 challengeType: 0 -dashedName: step-82 +dashedName: step-84 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md index bb95ed4f21a..24fc3b13869 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md @@ -1,8 +1,8 @@ --- id: 646d451c2e44afca71b67818 -title: Schritt 83 +title: Step 85 challengeType: 0 -dashedName: step-83 +dashedName: step-85 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md index 14cd7da4e61..ad5874f8ff5 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md @@ -1,8 +1,8 @@ --- id: 646d4554721d43cb19a68bc4 -title: Schritt 84 +title: Step 86 challengeType: 0 -dashedName: step-84 +dashedName: step-86 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md index e310f091ddb..5af0dea70a8 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md @@ -1,8 +1,8 @@ --- id: 646d45b739da5ecbf830c108 -title: Schritt 85 +title: Step 87 challengeType: 0 -dashedName: step-85 +dashedName: step-87 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md index 2b141f6d870..b91a5821c50 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md @@ -1,8 +1,8 @@ --- id: 646d45ee725632cca2555146 -title: Step 86 +title: Step 88 challengeType: 0 -dashedName: step-86 +dashedName: step-88 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md index 950ed52632e..7924ea30a21 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md @@ -1,8 +1,8 @@ --- id: 646d4626420eeecd51f241c2 -title: Schritt 87 +title: Step 89 challengeType: 0 -dashedName: step-87 +dashedName: step-89 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md index bb530056111..4db1b23e357 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md @@ -1,8 +1,8 @@ --- id: 646d467c6994f4ce0dc416a4 -title: Schritt 88 +title: Step 90 challengeType: 0 -dashedName: step-88 +dashedName: step-90 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md index 009e34eccb6..c0a68c79c51 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md @@ -1,8 +1,8 @@ --- id: 646d46c03e7d02cecb30f021 -title: Schritt 89 +title: Step 91 challengeType: 0 -dashedName: step-89 +dashedName: step-91 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md index c5c946d3606..69ead526498 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md @@ -1,8 +1,8 @@ --- id: 646d4717a689e1cfa232e357 -title: Schritt 90 +title: Step 92 challengeType: 0 -dashedName: step-90 +dashedName: step-92 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md index 3f57022592f..3cca65f77f1 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md @@ -1,8 +1,8 @@ --- id: 646d4769ba65f1d05ef6b634 -title: Schritt 91 +title: Step 93 challengeType: 0 -dashedName: step-91 +dashedName: step-93 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md index 9733a545251..f0f761d9769 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md @@ -1,8 +1,8 @@ --- id: 646d47c8f58107d10f1e5106 -title: Schritt 92 +title: Step 94 challengeType: 0 -dashedName: step-92 +dashedName: step-94 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md index 3a331ad1613..903c7e749af 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md @@ -1,8 +1,8 @@ --- id: 646d4813c17b37d1e261a566 -title: Schritt 93 +title: Step 95 challengeType: 0 -dashedName: step-93 +dashedName: step-95 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md index 2296c393bd1..1ee22280f64 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md @@ -1,8 +1,8 @@ --- id: 646d486aec20f7d2a581cc36 -title: Schritt 94 +title: Step 96 challengeType: 0 -dashedName: step-94 +dashedName: step-96 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md index e085e2018da..d97f534896f 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md @@ -1,8 +1,8 @@ --- id: 646d48b936802fd34c3f05af -title: Step 95 +title: Step 97 challengeType: 0 -dashedName: step-95 +dashedName: step-97 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md index b737b4a9989..f59402a084a 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md @@ -1,8 +1,8 @@ --- id: 646d498c8ebc31d3f753b22e -title: Schritt 96 +title: Step 98 challengeType: 0 -dashedName: step-96 +dashedName: step-98 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md index e65dc824bf1..7f7776def0c 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md @@ -1,8 +1,8 @@ --- id: 646d49bfff9079d4b38df115 -title: Schritt 97 +title: Step 99 challengeType: 0 -dashedName: step-97 +dashedName: step-99 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md index 7d5435e3f35..0911d6314bf 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md @@ -1,8 +1,8 @@ --- id: 646d4a07a8fb14d55cd70e09 -title: Schritt 98 +title: Step 100 challengeType: 0 -dashedName: step-98 +dashedName: step-100 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md index 9fbd2d0ab6c..c5d59aac98f 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md @@ -1,8 +1,8 @@ --- id: 646d4a5b32a1cad6165df286 -title: Schritt 100 +title: Step 102 challengeType: 0 -dashedName: step-100 +dashedName: step-102 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md index 7c67df2b6c2..88aea1490a1 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md @@ -1,8 +1,8 @@ --- id: 646d4a8dbc04c6d6bb0001f8 -title: Schritt 101 +title: Step 103 challengeType: 0 -dashedName: step-101 +dashedName: step-103 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md index 360ec98e9cf..6e9df876ad9 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md @@ -1,8 +1,8 @@ --- id: 646d4ab9b3b4c5d74fdd2154 -title: Schritt 102 +title: Step 104 challengeType: 0 -dashedName: step-102 +dashedName: step-104 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md index c0495507842..fc3f5d6c21a 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md @@ -1,8 +1,8 @@ --- id: 646d4b3d80ea98d824c8a4f9 -title: Schritt 103 +title: Step 105 challengeType: 0 -dashedName: step-103 +dashedName: step-105 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md index c823a47be89..2d4ab40c575 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md @@ -1,8 +1,8 @@ --- id: 6491d38f5b09a021c4b5d5fe -title: Schritt 99 +title: Step 101 challengeType: 0 -dashedName: step-99 +dashedName: step-101 --- # --description-- diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md new file mode 100644 index 00000000000..7c2489b5b09 --- /dev/null +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md @@ -0,0 +1,159 @@ +--- +id: 661f48f412d7631a1d9c30e6 +title: Step 75 +challengeType: 0 +dashedName: step-75 +--- + +# --description-- + +You should use `console.log()` to print the result of calling the `highPrecedence` function with the string `"5*3"`. + +# --hints-- + +You should call `console.log()`. + +```js + +assert.match(code, /console\.log\(/); + +``` + +You should call your `highPrecedence` function. + +```js + +assert.match(code, /console\.log\(highPrecedence\(/); + + +``` + +Pass `5*3` as the argument + +```js + +assert.match(code, /console\.log\(highPrecedence\(["']5\*3["']\)\);?/); + +``` + + + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} + +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md new file mode 100644 index 00000000000..a36def51c9b --- /dev/null +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md @@ -0,0 +1,148 @@ +--- +id: 661f49650572031c6ebdb8e3 +title: Step 76 +challengeType: 0 +dashedName: step-76 +--- + +# --description-- + +Remove both the `console.log()` with your `highPrecedence` call, and the `return` statement from your `highPrecedence` function. + +# --hints-- + +Your code should not log the result of `highPrecedence("5*3")`. + +```js + +assert.notMatch(code, /console\.log\(highPrecedence\("5\*3"\)\)/); + +``` + +Your `highPrecedence` function should not return a value. + +```js + +assert.isUndefined(highPrecedence("5*3")); + +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} +console.log(highPrecedence("5*3")); +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md index 035126503c4..e90506c129f 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md @@ -14,6 +14,7 @@ For example, this code would assign the number `25` to the second element in the ```js let array = [1, 2, 3]; array[1] = 25; +console.log(array); // prints [1, 25, 3] ``` Update the **third** element of your `rows` array to be the number `10`. Then print the `rows` array to your console. diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md index 9b9c5fa78fd..af7414db512 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md @@ -7,7 +7,7 @@ dashedName: step-25 # --description-- -Erstelle ein `p`-Element und verwende Template-Strings, um seinen Inhalt auf den `title` zu setzen, den du destrukturiert hast. Right before the content of the `p` element, create a `strong` element with the text `"Title:"`. +Erstelle ein `p`-Element und verwende Template-Strings, um seinen Inhalt auf den `title` zu setzen, den du destrukturiert hast. Right before the content of the `p` element, create a `strong` element with the text `Title:`. # --hints-- @@ -29,7 +29,7 @@ Du solltest ein `strong`-Element nach dem öffnenden Tag deines `p`-Elements ers assert.match(code, /

/) ``` -Your `strong` element should have the text `"Title:"`. +Your `strong` element should have the text `Title:`. ```js assert.match(code, /

Title:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md index 6f104a6b68d..4535f1a4330 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md @@ -7,7 +7,7 @@ dashedName: step-26 # --description-- -Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `"Date:"`. +Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `Date:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element and interpolate `${date}` as the text. assert.match(code, /

.*\$\{date\}<\/p>/) ``` -You should create a `strong` element with the text `"Date:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Date:` after the opening tag of your `p` element. ```js assert.match(code, /

Date:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md index 03cba96db5c..1f8aa88d063 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md @@ -9,7 +9,7 @@ dashedName: step-28 To allow for task management, you need to include both a delete and an edit button for each task. -Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `"Edit"` and the text of the second button to `"Delete"`. +Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `Edit` and the text of the second button to `Delete`. # --hints-- @@ -19,7 +19,7 @@ You should create a `button` element of type `button`, a class `btn` and `"Edit" assert.match(code, /Edit<\/button/) ``` -You should create a `button` element of type `button` a class `btn` and `"Delete"` as the text, in that order. +You should create a `button` element of type `button` a class `btn` and `Delete` as the text, in that order. ```js assert.match(code, /Delete<\/button/) diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md index fd1945e43d0..1bca79335e1 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md @@ -1,8 +1,8 @@ --- id: 64fb1c4dc0feb219149a7c7d -title: Step 53 +title: Step 52 challengeType: 0 -dashedName: step-53 +dashedName: step-52 --- # --description-- @@ -307,7 +307,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md index 0c5aef4f9a2..cb787162942 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md @@ -1,8 +1,8 @@ --- id: 64fb285637fa1e1c222033e3 -title: Step 54 +title: Step 53 challengeType: 0 -dashedName: step-54 +dashedName: step-53 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md index 27538cc5ecf..53c055a2e6d 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md @@ -1,8 +1,8 @@ --- id: 64fb29348a60361ccd45c1e2 -title: Step 55 +title: Step 54 challengeType: 0 -dashedName: step-55 +dashedName: step-54 --- # --description-- @@ -304,7 +304,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md index 42de45bd160..349a1226355 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md @@ -1,8 +1,8 @@ --- id: 64fefebad99209211ec30537 -title: Step 56 +title: Step 55 challengeType: 0 -dashedName: step-56 +dashedName: step-55 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md index 42d6ed6ae2d..8c8c80db659 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md @@ -1,8 +1,8 @@ --- id: 64ff0313700dad264d19dfe4 -title: Step 57 +title: Step 56 challengeType: 0 -dashedName: step-57 +dashedName: step-56 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md index 1ca2784a3cc..89f8f555a63 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md @@ -1,8 +1,8 @@ --- id: 64ff04cc33779427a6412449 -title: Step 58 +title: Step 57 challengeType: 0 -dashedName: step-58 +dashedName: step-57 --- # --description-- @@ -296,7 +296,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md index 49f4240707d..ae847c9b4ab 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md @@ -1,8 +1,8 @@ --- id: 64ff068e0426eb288874ed79 -title: Step 59 +title: Step 58 challengeType: 0 -dashedName: step-59 +dashedName: step-58 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md index df55f88ac55..a69e6d3f98a 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md @@ -1,8 +1,8 @@ --- id: 64ff23daf176a92de95f24dc -title: Step 60 +title: Step 59 challengeType: 0 -dashedName: step-60 +dashedName: step-59 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md index 8f51f137e15..2d43ea0abaf 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md @@ -1,8 +1,8 @@ --- id: 64ff24b80431f62ec6b93f65 -title: Step 61 +title: Step 60 challengeType: 0 -dashedName: step-61 +dashedName: step-60 --- # --description-- @@ -286,7 +286,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md index 651b7fef4e1..defd194933a 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md @@ -1,8 +1,8 @@ --- id: 65003986d17d1e1865b269c0 -title: Step 62 +title: Step 61 challengeType: 0 -dashedName: step-62 +dashedName: step-61 --- # --description-- @@ -302,7 +302,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md index a0508d09fd1..1504db737a7 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md @@ -1,8 +1,8 @@ --- id: 650046832f92c01a35834bca -title: Step 63 +title: Step 62 challengeType: 0 -dashedName: step-63 +dashedName: step-62 --- # --description-- @@ -303,7 +303,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md index 0103dc8d732..2759f899e93 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md @@ -1,8 +1,8 @@ --- id: 650048b0764f9c1b798200e2 -title: Step 64 +title: Step 63 challengeType: 0 -dashedName: step-64 +dashedName: step-63 --- # --description-- @@ -290,7 +290,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md index a4b34f17043..304cbb31463 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md @@ -1,8 +1,8 @@ --- id: 65004ba581d03d1d5628b41c -title: Step 65 +title: Step 64 challengeType: 0 -dashedName: step-65 +dashedName: step-64 --- # --description-- @@ -23,8 +23,6 @@ In that example, if `arr` has a length greater than `0`, the code inside the `if Check if there's a task inside `taskData`, then call the `updateTaskContainer()` inside the `if` statement block. -With that, you've completed this project. - # --hints-- You should create an `if` statement with `(taskData.length)` as the condition. As a reminder, `0` is a falsy value. @@ -308,7 +306,6 @@ const taskData = JSON.parse(localStorage.getItem("data")) || []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, @@ -413,377 +410,3 @@ taskForm.addEventListener("submit", (e) => { addOrUpdateTask(); }); ``` - -# --solutions-- - -```html - - - - - - - - Learn localStorage by Building a Todo App - - - - -

-

Todo App

-
- - - -
-

Discard unsaved changes?

-
- - -
-
-
-
-
-
- - - - -``` - -```css -:root { - --white: #fff; - --light-grey: #f5f6f7; - --dark-grey: #0a0a23; - --yellow: #f1be32; - --golden-yellow: #feac32; -} - -*, -*::before, -*::after { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - background-color: var(--dark-grey); -} - -main { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -h1 { - color: var(--light-grey); - margin: 20px 0 40px 0; -} - -.todo-app { - background-color: var(--white); - width: 300px; - height: 350px; - border: 5px solid var(--yellow); - border-radius: 8px; - padding: 15px; - position: relative; - display: flex; - flex-direction: column; - gap: 10px; -} - -.btn { - cursor: pointer; - width: 100px; - margin: 10px; - color: var(--dark-grey); - background-color: var(--golden-yellow); - background-image: linear-gradient(#fecc4c, #ffac33); - border-color: var(--golden-yellow); - border-width: 3px; -} - -.btn:hover { - background-image: linear-gradient(#ffcc4c, #f89808); -} - -.large-btn { - width: 80%; - font-size: 1.2rem; - align-self: center; - justify-self: center; -} - -.close-task-form-btn { - background: none; - border: none; - cursor: pointer; -} - -.close-icon { - width: 20px; - height: 20px; -} - -.task-form { - display: flex; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - background-color: var(--white); - border-radius: 5px; - padding: 15px; - width: 300px; - height: 350px; - flex-direction: column; - justify-content: space-between; - overflow: auto; -} - -.task-form-header { - display: flex; - justify-content: flex-end; -} - -.task-form-body { - display: flex; - flex-direction: column; - justify-content: space-around; -} - -.task-form-footer { - display: flex; - justify-content: center; -} - -.task-form-label, -#title-input, -#date-input, -#description-input { - display: block; -} - -.task-form-label { - margin-bottom: 5px; - font-size: 1.3rem; - font-weight: bold; -} - -#title-input, -#date-input, -#description-input { - width: 100%; - margin-bottom: 10px; - padding: 2px; -} - -#confirm-close-dialog { - padding: 10px; - margin: 10px auto; - border-radius: 15px; -} - -.confirm-close-dialog-btn-container { - display: flex; - justify-content: center; - margin-top: 10px; -} - -.discard-message-text { - font-weight: bold; - font-size: 1.5rem; -} - -#tasks-container { - height: 100%; - overflow-y: auto; -} - -.task { - margin: 5px 0; -} - -.hidden { - display: none; -} - -@media (min-width: 576px) { - .todo-app, - .task-form { - width: 400px; - height: 450px; - } - - .task-form-label { - font-size: 1.5rem; - } - - #title-input, - #date-input { - height: 2rem; - } - - #title-input, - #date-input, - #description-input { - padding: 5px; - margin-bottom: 20px; - } -} -``` - -```js -const taskForm = document.getElementById("task-form"); -const confirmCloseDialog = document.getElementById("confirm-close-dialog"); -const openTaskFormBtn = document.getElementById("open-task-form-btn"); -const closeTaskFormBtn = document.getElementById("close-task-form-btn"); -const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); -const cancelBtn = document.getElementById("cancel-btn"); -const discardBtn = document.getElementById("discard-btn"); -const tasksContainer = document.getElementById("tasks-container"); -const titleInput = document.getElementById("title-input"); -const dateInput = document.getElementById("date-input"); -const descriptionInput = document.getElementById("description-input"); - -const taskData = JSON.parse(localStorage.getItem("data")) || []; -let currentTask = {}; - -const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; - const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); - const taskObj = { - id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, - title: titleInput.value, - date: dateInput.value, - description: descriptionInput.value, - }; - - if (dataArrIndex === -1) { - taskData.unshift(taskObj); - } else { - taskData[dataArrIndex] = taskObj; - } - - localStorage.setItem("data", JSON.stringify(taskData)); - updateTaskContainer() - reset() -}; - -const updateTaskContainer = () => { - tasksContainer.innerHTML = ""; - - taskData.forEach( - ({ id, title, date, description }) => { - (tasksContainer.innerHTML += ` -
-

Title: ${title}

-

Date: ${date}

-

Description: ${description}

- - -
- `) - } - ); -}; - - -const deleteTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - buttonEl.parentElement.remove(); - taskData.splice(dataArrIndex, 1); - localStorage.setItem("data", JSON.stringify(taskData)); -} - -const editTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - currentTask = taskData[dataArrIndex]; - - titleInput.value = currentTask.title; - dateInput.value = currentTask.date; - descriptionInput.value = currentTask.description; - - addOrUpdateTaskBtn.innerText = "Update Task"; - - - taskForm.classList.toggle("hidden"); -} - -const reset = () => { - titleInput.value = ""; - dateInput.value = ""; - descriptionInput.value = ""; - taskForm.classList.toggle("hidden"); - currentTask = {}; -} - -if (taskData.length) { - updateTaskContainer(); -} - -openTaskFormBtn.addEventListener("click", () => - taskForm.classList.toggle("hidden") -); - -closeTaskFormBtn.addEventListener("click", () => { - const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; - const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; - - if (formInputsContainValues && formInputValuesUpdated) { - confirmCloseDialog.showModal(); - } else { - reset(); - } -}); - -cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); - -discardBtn.addEventListener("click", () => { - confirmCloseDialog.close(); - reset() -}); - -taskForm.addEventListener("submit", (e) => { - e.preventDefault(); - - addOrUpdateTask(); -}); -``` diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md index 8a982fe77be..e1223fd9b03 100644 --- a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md @@ -7,7 +7,7 @@ dashedName: step-27 # --description-- -Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `"Description:"`. +Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `Description:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element with `${description}` as the text. assert.match(code, /

.*\$\{description\}<\/p>/) ``` -You should create a `strong` element with the text `"Description:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Description:` after the opening tag of your `p` element. ```js assert.match(code, /

Description:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md new file mode 100644 index 00000000000..8f2a57bf4e0 --- /dev/null +++ b/curriculum/challenges/german/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md @@ -0,0 +1,774 @@ +--- +id: 6632420f81f3cc554a5e540b +title: Step 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +If you try to add a new task, edit that task, and then click on the `Add New Task` button, you will notice a bug. + +The form button will display the incorrect text of `"Update Task"` instead of `"Add Task"`. To fix this, you will need to assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText` inside your `reset` function. + +With that, you've completed this project. + +# --hints-- + +You should assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText`. + +```js +assert.match(code, /addOrUpdateTaskBtn\.innerText\s*=\s*('|")Add Task\1\s*/) +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +

+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + --fcc-editable-region-- + + --fcc-editable-region-- + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` + + +# --solutions-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +
+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + addOrUpdateTaskBtn.innerText = "Add Task"; + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` diff --git a/curriculum/challenges/german/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md b/curriculum/challenges/german/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md new file mode 100644 index 00000000000..1e918708d4c --- /dev/null +++ b/curriculum/challenges/german/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md @@ -0,0 +1,61 @@ +--- +id: 6619240f46cec8e04d77e03a +title: Basic Functions Exercise A +challengeType: 1 +dashedName: top-basic-functions-exercise-a +--- + +# --description-- + +Create a function that takes in an integer. This function should return the given `integer + 7` if the integer is less than `10`. If the integer is greater than or equal to `10`, it should return the given `integer - 3`. + +The name of the function should be `addOrSubtract`. + +# --hints-- + +You should have a function called `addOrSubtract`. + +```js +assert.isFunction(addOrSubtract); +``` + +Your function should take in an integer as an argument. + +```js +assert.match(addOrSubtract.toString(), /\s*addOrSubtract\(\s*\w+\s*\)/); +``` + +You should return the given integer + 7 if the integer is less than 10. + +```js +assert.strictEqual(addOrSubtract(5), 12); +``` + +You should return the given integer - 3 if the integer is greater than or equal to 10. + +```js +assert.strictEqual(addOrSubtract(10), 7); +``` + + + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function addOrSubtract(num) { + if (num < 10) { + return num + 7; + } else { + return num - 3; + } +} +``` diff --git a/curriculum/challenges/german/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md b/curriculum/challenges/german/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md new file mode 100644 index 00000000000..4dbba976428 --- /dev/null +++ b/curriculum/challenges/german/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md @@ -0,0 +1,47 @@ +--- +id: 661e131f068359c3ccf2f4d6 +title: Basic Functions Exercise B +challengeType: 1 +dashedName: top-basic-functions-exercise-b +--- + +# --description-- + +Write a function, named `multiply`, that takes two parameters and returns their product. + +# --hints-- + +You should have a function named `multiply`. + +```js +assert.isFunction(multiply); +``` + +Your function should take in two integers as arguments. + +```js +assert.match(multiply.toString(), /\s*multiply\(\s*\w+\s*,\s*\w+\s*\)/); +``` + +You should return the product of the two integers. + +```js +assert.strictEqual(multiply(10, 10), 100); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function multiply(a, b) { + return a * b; +} +``` diff --git a/curriculum/challenges/german/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md b/curriculum/challenges/german/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md new file mode 100644 index 00000000000..0c0640ae277 --- /dev/null +++ b/curriculum/challenges/german/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md @@ -0,0 +1,47 @@ +--- +id: 661e151f068359c3ccf2f4d7 +title: Basic Functions Exercise C +challengeType: 1 +dashedName: top-basic-functions-exercise-c +--- + +# --description-- + +Write a function, named `capitalize`, that takes a string as an parameter and returns a new string with the first letter capitalized. + +# --hints-- + +You should have a function named `capitalize`. + +```js +assert.isFunction(capitalize); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(capitalize.toString(), /\s*capitalize\(\s*\w+\s*\)/); +``` + +Your function should return a new string with the first letter capitalized. + +```js +assert.strictEqual(capitalize('sem'), 'Sem'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function capitalize(str) { + return str[0].toUpperCase() + str.slice(1); +} +``` diff --git a/curriculum/challenges/german/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md b/curriculum/challenges/german/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md new file mode 100644 index 00000000000..79d9031b2d9 --- /dev/null +++ b/curriculum/challenges/german/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md @@ -0,0 +1,47 @@ +--- +id: 661e17c6068359c3ccf2f4d8 +title: Basic Functions Exercise D +challengeType: 1 +dashedName: top-basic-functions-exercise-d +--- + +# --description-- + +Write a function, named `lastLetter`, that takes a string as a parameter and returns the last letter of the string. + +# --hints-- + +You should have a function named `lastLetter`. + +```js +assert.isFunction(lastLetter); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(lastLetter.toString(), /\s*lastLetter\(\s*\w+\s*\)/); +``` + +You should return the last letter of the string. + +```js +assert.strictEqual(lastLetter('Sem'), 'm'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function lastLetter(str) { + return str[str.length - 1]; +} +``` diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index 4c116acc40b..90288fd890a 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -39,7 +39,13 @@ La funzione `idToText` dovrebbe avere un parametro `id`. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>/); ``` -Dovresti assegnare a `idToText` il risultato della chiamata del metodo `.find()` sull'array `cells`. +Your `idToText` function should return the result of calling the `.find()` method on your `cells` array. La funzione callback dovrebbe utilizzare un return implicito. + +```js +assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); +``` + +Your `idToText` function should use an implicit return. ```js assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(/); @@ -57,12 +63,6 @@ La funzione callback dovrebbe avere un parametro `cell`. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>/); ``` -La funzione callback dovrebbe utilizzare un return implicito. - -```js -assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); -``` - La funzione callback dovrebbe restituire se `cell.id` è strettamente uguale a `id`. ```js diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md index 54db99128d0..a3ef0e97870 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md @@ -11,72 +11,48 @@ Nella funzione `highPrecedence`, dichiara una variabile `regex`. Assegnale un'es Ogni numero, e l'operatore, dovrebbero essere in gruppi di acquisizione separati. +Incorporate the regular expression you've defined into your `highPrecedence` function to test if the provided string `str` matches the pattern. Use the `test()` method on your `regex` variable and return the result. + # --hints-- + Dovresti dichiarare una variabile `regex` nella funzione `highPrecedence`. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*(?:const|let|var)\s+regex/); + ``` Dovresti usare `const` per dichiarare la variabile `regex`. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex/); + ``` La variabile `regex` dovrebbe essere un'espressione regolare. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\//); + ``` -`regex` dovrebbe usare un gruppo di acquisizione. +Your highPrecedence should return `regex.test(str);` ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(/); +assert.match(code, /return\s+regex\.test\(str\);?/); + ``` -Il primo gruppo di acquisizione dovrebbe usare una classe di caratteri. +Please enter a properly functioning regex. ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[/); -``` -Il primo gruppo di acquisizione dovrebbe trovare qualsiasi cifra o un punto. Usa la classe di caratteri speciale `\d`. +assert.strictEqual(highPrecedence("5*3"), true); -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]/); -``` - -Il primo gruppo di acquisizione dovrebbe trovare la classe di caratteri una o più volte. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)/); -``` - -`regex` dovrebbe usare un secondo gruppo di acquisizione. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(/); -``` - -Il secondo gruppo di acquisizione dovrebbe trovare un operatore `*` o `/`. Usa una classe di caratteri nel gruppo di acquisizione. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)/); -``` - -`regex` dovrebbe utilizzare un terzo gruppo di acquisizione. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(/); -``` - -Il terzo gruppo di acquisizione dovrebbe uguale al primo gruppo di acquisizione. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)/); ``` # --seed-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md index 479bbae205f..0429d84d312 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md @@ -1,8 +1,8 @@ --- id: 646d40c543943ec250039682 -title: Step 75 +title: Step 77 challengeType: 0 -dashedName: step-75 +dashedName: step-77 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md index dba24e9dd25..150a3fede57 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md @@ -1,8 +1,8 @@ --- id: 646d40fe4b7b50c30c2b4cd8 -title: Step 76 +title: Step 78 challengeType: 0 -dashedName: step-76 +dashedName: step-78 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md index 73719d28e55..c6548b25128 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md @@ -1,8 +1,8 @@ --- id: 646d41e23b583fc3b8cc4579 -title: Step 77 +title: Step 79 challengeType: 0 -dashedName: step-77 +dashedName: step-79 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md index 8bbd15f30f9..7fbc96498fb 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md @@ -1,8 +1,8 @@ --- id: 646d423fade4a9c4636acd13 -title: Step 78 +title: Step 80 challengeType: 0 -dashedName: step-78 +dashedName: step-80 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md index a5064307001..7ef0b335531 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md @@ -1,8 +1,8 @@ --- id: 646d42f58deb2fc52adc6611 -title: Step 79 +title: Step 81 challengeType: 0 -dashedName: step-79 +dashedName: step-81 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md index 03a00b62cd1..90d71f99b1c 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md @@ -1,8 +1,8 @@ --- id: 646d43587d926bc5b6cb2e50 -title: Step 80 +title: Step 82 challengeType: 0 -dashedName: step-80 +dashedName: step-82 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md index af1495b5842..45ebbda3b54 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md @@ -1,8 +1,8 @@ --- id: 646d448479c8fdc8dcec868c -title: Step 81 +title: Step 83 challengeType: 0 -dashedName: step-81 +dashedName: step-83 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md index 2976c64e2be..e5a50c4a7c5 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md @@ -1,8 +1,8 @@ --- id: 646d44da986f2bc9b72f5fe2 -title: Step 82 +title: Step 84 challengeType: 0 -dashedName: step-82 +dashedName: step-84 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md index e63e81da044..d3b4494d1f6 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md @@ -1,8 +1,8 @@ --- id: 646d451c2e44afca71b67818 -title: Step 83 +title: Step 85 challengeType: 0 -dashedName: step-83 +dashedName: step-85 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md index 36362ac9ea5..92bd6fe5770 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md @@ -1,8 +1,8 @@ --- id: 646d4554721d43cb19a68bc4 -title: Step 84 +title: Step 86 challengeType: 0 -dashedName: step-84 +dashedName: step-86 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md index f285bfa6ad5..0824b0014a4 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md @@ -1,8 +1,8 @@ --- id: 646d45b739da5ecbf830c108 -title: Step 85 +title: Step 87 challengeType: 0 -dashedName: step-85 +dashedName: step-87 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md index 550aeab56f2..29ee8f61c33 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md @@ -1,8 +1,8 @@ --- id: 646d45ee725632cca2555146 -title: Step 86 +title: Step 88 challengeType: 0 -dashedName: step-86 +dashedName: step-88 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md index f3c0c117b5e..d2971429e9b 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md @@ -1,8 +1,8 @@ --- id: 646d4626420eeecd51f241c2 -title: Step 87 +title: Step 89 challengeType: 0 -dashedName: step-87 +dashedName: step-89 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md index 16e16ca7f12..024979d733c 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md @@ -1,8 +1,8 @@ --- id: 646d467c6994f4ce0dc416a4 -title: Step 88 +title: Step 90 challengeType: 0 -dashedName: step-88 +dashedName: step-90 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md index 710a3a8e0ee..b3541e85069 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md @@ -1,8 +1,8 @@ --- id: 646d46c03e7d02cecb30f021 -title: Step 89 +title: Step 91 challengeType: 0 -dashedName: step-89 +dashedName: step-91 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md index 842da4cc139..8ba26e9f99c 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md @@ -1,8 +1,8 @@ --- id: 646d4717a689e1cfa232e357 -title: Step 90 +title: Step 92 challengeType: 0 -dashedName: step-90 +dashedName: step-92 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md index 4cea9bf6c2a..539c29058d1 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md @@ -1,8 +1,8 @@ --- id: 646d4769ba65f1d05ef6b634 -title: Step 91 +title: Step 93 challengeType: 0 -dashedName: step-91 +dashedName: step-93 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md index c2056c3d82b..d9e60417fec 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md @@ -1,8 +1,8 @@ --- id: 646d47c8f58107d10f1e5106 -title: Step 92 +title: Step 94 challengeType: 0 -dashedName: step-92 +dashedName: step-94 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md index 88c3ccd2e8c..8a085d4551b 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md @@ -1,8 +1,8 @@ --- id: 646d4813c17b37d1e261a566 -title: Step 93 +title: Step 95 challengeType: 0 -dashedName: step-93 +dashedName: step-95 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md index d1a91ba390e..0510b8f006d 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md @@ -1,8 +1,8 @@ --- id: 646d486aec20f7d2a581cc36 -title: Step 94 +title: Step 96 challengeType: 0 -dashedName: step-94 +dashedName: step-96 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md index b2098b85ceb..8661811591a 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md @@ -1,8 +1,8 @@ --- id: 646d48b936802fd34c3f05af -title: Step 95 +title: Step 97 challengeType: 0 -dashedName: step-95 +dashedName: step-97 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md index 830c8f16e6c..54190e14172 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md @@ -1,8 +1,8 @@ --- id: 646d498c8ebc31d3f753b22e -title: Step 96 +title: Step 98 challengeType: 0 -dashedName: step-96 +dashedName: step-98 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md index ef6d6ec2985..c698abf19ee 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md @@ -1,8 +1,8 @@ --- id: 646d49bfff9079d4b38df115 -title: Step 97 +title: Step 99 challengeType: 0 -dashedName: step-97 +dashedName: step-99 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md index f1b253a4f26..ae5dc5781c6 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md @@ -1,8 +1,8 @@ --- id: 646d4a07a8fb14d55cd70e09 -title: Step 98 +title: Step 100 challengeType: 0 -dashedName: step-98 +dashedName: step-100 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md index 2bfc38de590..fcd40cab485 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md @@ -1,8 +1,8 @@ --- id: 646d4a5b32a1cad6165df286 -title: Step 100 +title: Step 102 challengeType: 0 -dashedName: step-100 +dashedName: step-102 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md index 076f2ee1cb6..03cea51b2df 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md @@ -1,8 +1,8 @@ --- id: 646d4a8dbc04c6d6bb0001f8 -title: Step 101 +title: Step 103 challengeType: 0 -dashedName: step-101 +dashedName: step-103 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md index b57385473ac..101ea15ab3a 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md @@ -1,8 +1,8 @@ --- id: 646d4ab9b3b4c5d74fdd2154 -title: Step 102 +title: Step 104 challengeType: 0 -dashedName: step-102 +dashedName: step-104 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md index 3c128f54ee8..4d07b62e2c5 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md @@ -1,8 +1,8 @@ --- id: 646d4b3d80ea98d824c8a4f9 -title: Step 103 +title: Step 105 challengeType: 0 -dashedName: step-103 +dashedName: step-105 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md index 8209f6e2c89..ca3701dadf6 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md @@ -1,8 +1,8 @@ --- id: 6491d38f5b09a021c4b5d5fe -title: Step 99 +title: Step 101 challengeType: 0 -dashedName: step-99 +dashedName: step-101 --- # --description-- diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md new file mode 100644 index 00000000000..7c2489b5b09 --- /dev/null +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md @@ -0,0 +1,159 @@ +--- +id: 661f48f412d7631a1d9c30e6 +title: Step 75 +challengeType: 0 +dashedName: step-75 +--- + +# --description-- + +You should use `console.log()` to print the result of calling the `highPrecedence` function with the string `"5*3"`. + +# --hints-- + +You should call `console.log()`. + +```js + +assert.match(code, /console\.log\(/); + +``` + +You should call your `highPrecedence` function. + +```js + +assert.match(code, /console\.log\(highPrecedence\(/); + + +``` + +Pass `5*3` as the argument + +```js + +assert.match(code, /console\.log\(highPrecedence\(["']5\*3["']\)\);?/); + +``` + + + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} + +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md new file mode 100644 index 00000000000..a36def51c9b --- /dev/null +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md @@ -0,0 +1,148 @@ +--- +id: 661f49650572031c6ebdb8e3 +title: Step 76 +challengeType: 0 +dashedName: step-76 +--- + +# --description-- + +Remove both the `console.log()` with your `highPrecedence` call, and the `return` statement from your `highPrecedence` function. + +# --hints-- + +Your code should not log the result of `highPrecedence("5*3")`. + +```js + +assert.notMatch(code, /console\.log\(highPrecedence\("5\*3"\)\)/); + +``` + +Your `highPrecedence` function should not return a value. + +```js + +assert.isUndefined(highPrecedence("5*3")); + +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} +console.log(highPrecedence("5*3")); +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md index 035126503c4..e90506c129f 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md @@ -14,6 +14,7 @@ For example, this code would assign the number `25` to the second element in the ```js let array = [1, 2, 3]; array[1] = 25; +console.log(array); // prints [1, 25, 3] ``` Update the **third** element of your `rows` array to be the number `10`. Then print the `rows` array to your console. diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md index 08b283f65e4..47b58025670 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md @@ -7,7 +7,7 @@ dashedName: step-25 # --description-- -Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `"Title:"`. +Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `Title:`. # --hints-- @@ -29,7 +29,7 @@ You should create a `strong` element after the opening tag of your `p` element. assert.match(code, /

/) ``` -Your `strong` element should have the text `"Title:"`. +Your `strong` element should have the text `Title:`. ```js assert.match(code, /

Title:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md index 6f104a6b68d..4535f1a4330 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md @@ -7,7 +7,7 @@ dashedName: step-26 # --description-- -Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `"Date:"`. +Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `Date:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element and interpolate `${date}` as the text. assert.match(code, /

.*\$\{date\}<\/p>/) ``` -You should create a `strong` element with the text `"Date:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Date:` after the opening tag of your `p` element. ```js assert.match(code, /

Date:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md index 03cba96db5c..1f8aa88d063 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md @@ -9,7 +9,7 @@ dashedName: step-28 To allow for task management, you need to include both a delete and an edit button for each task. -Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `"Edit"` and the text of the second button to `"Delete"`. +Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `Edit` and the text of the second button to `Delete`. # --hints-- @@ -19,7 +19,7 @@ You should create a `button` element of type `button`, a class `btn` and `"Edit" assert.match(code, /Edit<\/button/) ``` -You should create a `button` element of type `button` a class `btn` and `"Delete"` as the text, in that order. +You should create a `button` element of type `button` a class `btn` and `Delete` as the text, in that order. ```js assert.match(code, /Delete<\/button/) diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md index fd1945e43d0..1bca79335e1 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md @@ -1,8 +1,8 @@ --- id: 64fb1c4dc0feb219149a7c7d -title: Step 53 +title: Step 52 challengeType: 0 -dashedName: step-53 +dashedName: step-52 --- # --description-- @@ -307,7 +307,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md index 0c5aef4f9a2..cb787162942 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md @@ -1,8 +1,8 @@ --- id: 64fb285637fa1e1c222033e3 -title: Step 54 +title: Step 53 challengeType: 0 -dashedName: step-54 +dashedName: step-53 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md index 27538cc5ecf..53c055a2e6d 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md @@ -1,8 +1,8 @@ --- id: 64fb29348a60361ccd45c1e2 -title: Step 55 +title: Step 54 challengeType: 0 -dashedName: step-55 +dashedName: step-54 --- # --description-- @@ -304,7 +304,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md index 42de45bd160..349a1226355 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md @@ -1,8 +1,8 @@ --- id: 64fefebad99209211ec30537 -title: Step 56 +title: Step 55 challengeType: 0 -dashedName: step-56 +dashedName: step-55 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md index 42d6ed6ae2d..8c8c80db659 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md @@ -1,8 +1,8 @@ --- id: 64ff0313700dad264d19dfe4 -title: Step 57 +title: Step 56 challengeType: 0 -dashedName: step-57 +dashedName: step-56 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md index 1ca2784a3cc..89f8f555a63 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md @@ -1,8 +1,8 @@ --- id: 64ff04cc33779427a6412449 -title: Step 58 +title: Step 57 challengeType: 0 -dashedName: step-58 +dashedName: step-57 --- # --description-- @@ -296,7 +296,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md index 49f4240707d..ae847c9b4ab 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md @@ -1,8 +1,8 @@ --- id: 64ff068e0426eb288874ed79 -title: Step 59 +title: Step 58 challengeType: 0 -dashedName: step-59 +dashedName: step-58 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md index df55f88ac55..a69e6d3f98a 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md @@ -1,8 +1,8 @@ --- id: 64ff23daf176a92de95f24dc -title: Step 60 +title: Step 59 challengeType: 0 -dashedName: step-60 +dashedName: step-59 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md index 8f51f137e15..2d43ea0abaf 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md @@ -1,8 +1,8 @@ --- id: 64ff24b80431f62ec6b93f65 -title: Step 61 +title: Step 60 challengeType: 0 -dashedName: step-61 +dashedName: step-60 --- # --description-- @@ -286,7 +286,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md index 651b7fef4e1..defd194933a 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md @@ -1,8 +1,8 @@ --- id: 65003986d17d1e1865b269c0 -title: Step 62 +title: Step 61 challengeType: 0 -dashedName: step-62 +dashedName: step-61 --- # --description-- @@ -302,7 +302,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md index a0508d09fd1..1504db737a7 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md @@ -1,8 +1,8 @@ --- id: 650046832f92c01a35834bca -title: Step 63 +title: Step 62 challengeType: 0 -dashedName: step-63 +dashedName: step-62 --- # --description-- @@ -303,7 +303,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md index 0103dc8d732..2759f899e93 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md @@ -1,8 +1,8 @@ --- id: 650048b0764f9c1b798200e2 -title: Step 64 +title: Step 63 challengeType: 0 -dashedName: step-64 +dashedName: step-63 --- # --description-- @@ -290,7 +290,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md index a4b34f17043..304cbb31463 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md @@ -1,8 +1,8 @@ --- id: 65004ba581d03d1d5628b41c -title: Step 65 +title: Step 64 challengeType: 0 -dashedName: step-65 +dashedName: step-64 --- # --description-- @@ -23,8 +23,6 @@ In that example, if `arr` has a length greater than `0`, the code inside the `if Check if there's a task inside `taskData`, then call the `updateTaskContainer()` inside the `if` statement block. -With that, you've completed this project. - # --hints-- You should create an `if` statement with `(taskData.length)` as the condition. As a reminder, `0` is a falsy value. @@ -308,7 +306,6 @@ const taskData = JSON.parse(localStorage.getItem("data")) || []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, @@ -413,377 +410,3 @@ taskForm.addEventListener("submit", (e) => { addOrUpdateTask(); }); ``` - -# --solutions-- - -```html - - - - - - - - Learn localStorage by Building a Todo App - - - - -

-

Todo App

-
- - - -
-

Discard unsaved changes?

-
- - -
-
-
-
-
-
- - - - -``` - -```css -:root { - --white: #fff; - --light-grey: #f5f6f7; - --dark-grey: #0a0a23; - --yellow: #f1be32; - --golden-yellow: #feac32; -} - -*, -*::before, -*::after { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - background-color: var(--dark-grey); -} - -main { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -h1 { - color: var(--light-grey); - margin: 20px 0 40px 0; -} - -.todo-app { - background-color: var(--white); - width: 300px; - height: 350px; - border: 5px solid var(--yellow); - border-radius: 8px; - padding: 15px; - position: relative; - display: flex; - flex-direction: column; - gap: 10px; -} - -.btn { - cursor: pointer; - width: 100px; - margin: 10px; - color: var(--dark-grey); - background-color: var(--golden-yellow); - background-image: linear-gradient(#fecc4c, #ffac33); - border-color: var(--golden-yellow); - border-width: 3px; -} - -.btn:hover { - background-image: linear-gradient(#ffcc4c, #f89808); -} - -.large-btn { - width: 80%; - font-size: 1.2rem; - align-self: center; - justify-self: center; -} - -.close-task-form-btn { - background: none; - border: none; - cursor: pointer; -} - -.close-icon { - width: 20px; - height: 20px; -} - -.task-form { - display: flex; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - background-color: var(--white); - border-radius: 5px; - padding: 15px; - width: 300px; - height: 350px; - flex-direction: column; - justify-content: space-between; - overflow: auto; -} - -.task-form-header { - display: flex; - justify-content: flex-end; -} - -.task-form-body { - display: flex; - flex-direction: column; - justify-content: space-around; -} - -.task-form-footer { - display: flex; - justify-content: center; -} - -.task-form-label, -#title-input, -#date-input, -#description-input { - display: block; -} - -.task-form-label { - margin-bottom: 5px; - font-size: 1.3rem; - font-weight: bold; -} - -#title-input, -#date-input, -#description-input { - width: 100%; - margin-bottom: 10px; - padding: 2px; -} - -#confirm-close-dialog { - padding: 10px; - margin: 10px auto; - border-radius: 15px; -} - -.confirm-close-dialog-btn-container { - display: flex; - justify-content: center; - margin-top: 10px; -} - -.discard-message-text { - font-weight: bold; - font-size: 1.5rem; -} - -#tasks-container { - height: 100%; - overflow-y: auto; -} - -.task { - margin: 5px 0; -} - -.hidden { - display: none; -} - -@media (min-width: 576px) { - .todo-app, - .task-form { - width: 400px; - height: 450px; - } - - .task-form-label { - font-size: 1.5rem; - } - - #title-input, - #date-input { - height: 2rem; - } - - #title-input, - #date-input, - #description-input { - padding: 5px; - margin-bottom: 20px; - } -} -``` - -```js -const taskForm = document.getElementById("task-form"); -const confirmCloseDialog = document.getElementById("confirm-close-dialog"); -const openTaskFormBtn = document.getElementById("open-task-form-btn"); -const closeTaskFormBtn = document.getElementById("close-task-form-btn"); -const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); -const cancelBtn = document.getElementById("cancel-btn"); -const discardBtn = document.getElementById("discard-btn"); -const tasksContainer = document.getElementById("tasks-container"); -const titleInput = document.getElementById("title-input"); -const dateInput = document.getElementById("date-input"); -const descriptionInput = document.getElementById("description-input"); - -const taskData = JSON.parse(localStorage.getItem("data")) || []; -let currentTask = {}; - -const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; - const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); - const taskObj = { - id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, - title: titleInput.value, - date: dateInput.value, - description: descriptionInput.value, - }; - - if (dataArrIndex === -1) { - taskData.unshift(taskObj); - } else { - taskData[dataArrIndex] = taskObj; - } - - localStorage.setItem("data", JSON.stringify(taskData)); - updateTaskContainer() - reset() -}; - -const updateTaskContainer = () => { - tasksContainer.innerHTML = ""; - - taskData.forEach( - ({ id, title, date, description }) => { - (tasksContainer.innerHTML += ` -
-

Title: ${title}

-

Date: ${date}

-

Description: ${description}

- - -
- `) - } - ); -}; - - -const deleteTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - buttonEl.parentElement.remove(); - taskData.splice(dataArrIndex, 1); - localStorage.setItem("data", JSON.stringify(taskData)); -} - -const editTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - currentTask = taskData[dataArrIndex]; - - titleInput.value = currentTask.title; - dateInput.value = currentTask.date; - descriptionInput.value = currentTask.description; - - addOrUpdateTaskBtn.innerText = "Update Task"; - - - taskForm.classList.toggle("hidden"); -} - -const reset = () => { - titleInput.value = ""; - dateInput.value = ""; - descriptionInput.value = ""; - taskForm.classList.toggle("hidden"); - currentTask = {}; -} - -if (taskData.length) { - updateTaskContainer(); -} - -openTaskFormBtn.addEventListener("click", () => - taskForm.classList.toggle("hidden") -); - -closeTaskFormBtn.addEventListener("click", () => { - const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; - const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; - - if (formInputsContainValues && formInputValuesUpdated) { - confirmCloseDialog.showModal(); - } else { - reset(); - } -}); - -cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); - -discardBtn.addEventListener("click", () => { - confirmCloseDialog.close(); - reset() -}); - -taskForm.addEventListener("submit", (e) => { - e.preventDefault(); - - addOrUpdateTask(); -}); -``` diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md index 8a982fe77be..e1223fd9b03 100644 --- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md @@ -7,7 +7,7 @@ dashedName: step-27 # --description-- -Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `"Description:"`. +Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `Description:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element with `${description}` as the text. assert.match(code, /

.*\$\{description\}<\/p>/) ``` -You should create a `strong` element with the text `"Description:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Description:` after the opening tag of your `p` element. ```js assert.match(code, /

Description:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md new file mode 100644 index 00000000000..8f2a57bf4e0 --- /dev/null +++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md @@ -0,0 +1,774 @@ +--- +id: 6632420f81f3cc554a5e540b +title: Step 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +If you try to add a new task, edit that task, and then click on the `Add New Task` button, you will notice a bug. + +The form button will display the incorrect text of `"Update Task"` instead of `"Add Task"`. To fix this, you will need to assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText` inside your `reset` function. + +With that, you've completed this project. + +# --hints-- + +You should assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText`. + +```js +assert.match(code, /addOrUpdateTaskBtn\.innerText\s*=\s*('|")Add Task\1\s*/) +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +

+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + --fcc-editable-region-- + + --fcc-editable-region-- + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` + + +# --solutions-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +
+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + addOrUpdateTaskBtn.innerText = "Add Task"; + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` diff --git a/curriculum/challenges/italian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md b/curriculum/challenges/italian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md new file mode 100644 index 00000000000..1e918708d4c --- /dev/null +++ b/curriculum/challenges/italian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md @@ -0,0 +1,61 @@ +--- +id: 6619240f46cec8e04d77e03a +title: Basic Functions Exercise A +challengeType: 1 +dashedName: top-basic-functions-exercise-a +--- + +# --description-- + +Create a function that takes in an integer. This function should return the given `integer + 7` if the integer is less than `10`. If the integer is greater than or equal to `10`, it should return the given `integer - 3`. + +The name of the function should be `addOrSubtract`. + +# --hints-- + +You should have a function called `addOrSubtract`. + +```js +assert.isFunction(addOrSubtract); +``` + +Your function should take in an integer as an argument. + +```js +assert.match(addOrSubtract.toString(), /\s*addOrSubtract\(\s*\w+\s*\)/); +``` + +You should return the given integer + 7 if the integer is less than 10. + +```js +assert.strictEqual(addOrSubtract(5), 12); +``` + +You should return the given integer - 3 if the integer is greater than or equal to 10. + +```js +assert.strictEqual(addOrSubtract(10), 7); +``` + + + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function addOrSubtract(num) { + if (num < 10) { + return num + 7; + } else { + return num - 3; + } +} +``` diff --git a/curriculum/challenges/italian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md b/curriculum/challenges/italian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md new file mode 100644 index 00000000000..4dbba976428 --- /dev/null +++ b/curriculum/challenges/italian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md @@ -0,0 +1,47 @@ +--- +id: 661e131f068359c3ccf2f4d6 +title: Basic Functions Exercise B +challengeType: 1 +dashedName: top-basic-functions-exercise-b +--- + +# --description-- + +Write a function, named `multiply`, that takes two parameters and returns their product. + +# --hints-- + +You should have a function named `multiply`. + +```js +assert.isFunction(multiply); +``` + +Your function should take in two integers as arguments. + +```js +assert.match(multiply.toString(), /\s*multiply\(\s*\w+\s*,\s*\w+\s*\)/); +``` + +You should return the product of the two integers. + +```js +assert.strictEqual(multiply(10, 10), 100); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function multiply(a, b) { + return a * b; +} +``` diff --git a/curriculum/challenges/italian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md b/curriculum/challenges/italian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md new file mode 100644 index 00000000000..0c0640ae277 --- /dev/null +++ b/curriculum/challenges/italian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md @@ -0,0 +1,47 @@ +--- +id: 661e151f068359c3ccf2f4d7 +title: Basic Functions Exercise C +challengeType: 1 +dashedName: top-basic-functions-exercise-c +--- + +# --description-- + +Write a function, named `capitalize`, that takes a string as an parameter and returns a new string with the first letter capitalized. + +# --hints-- + +You should have a function named `capitalize`. + +```js +assert.isFunction(capitalize); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(capitalize.toString(), /\s*capitalize\(\s*\w+\s*\)/); +``` + +Your function should return a new string with the first letter capitalized. + +```js +assert.strictEqual(capitalize('sem'), 'Sem'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function capitalize(str) { + return str[0].toUpperCase() + str.slice(1); +} +``` diff --git a/curriculum/challenges/italian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md b/curriculum/challenges/italian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md new file mode 100644 index 00000000000..79d9031b2d9 --- /dev/null +++ b/curriculum/challenges/italian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md @@ -0,0 +1,47 @@ +--- +id: 661e17c6068359c3ccf2f4d8 +title: Basic Functions Exercise D +challengeType: 1 +dashedName: top-basic-functions-exercise-d +--- + +# --description-- + +Write a function, named `lastLetter`, that takes a string as a parameter and returns the last letter of the string. + +# --hints-- + +You should have a function named `lastLetter`. + +```js +assert.isFunction(lastLetter); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(lastLetter.toString(), /\s*lastLetter\(\s*\w+\s*\)/); +``` + +You should return the last letter of the string. + +```js +assert.strictEqual(lastLetter('Sem'), 'm'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function lastLetter(str) { + return str[str.length - 1]; +} +``` diff --git a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/614796cb8086be482d60e0ac.md b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/614796cb8086be482d60e0ac.md index 9720fc18b1c..bf8e9552ef5 100644 --- a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/614796cb8086be482d60e0ac.md +++ b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-accessibility-by-building-a-quiz/614796cb8086be482d60e0ac.md @@ -13,14 +13,14 @@ dashedName: step-46 # --hints-- -Your selector should target links inside list items. +リスト項目の内側のリンクを選択するセレクターが必要です。 ```js const anchors = document.querySelectorAll('li > a'); anchors.forEach(a => assert.exists(getComputedStyle(a))); ``` -You should give the `a` elements inside list items a `color` property. +リスト項目内の `a` 要素に `color` プロパティを設定する必要があります。 ```js const helper = new __helpers.CSSHelp(document); @@ -29,7 +29,7 @@ const usedSelector = code.match(/^\s*?(.*?a)\s*?{/m)[1]; assert.notEmpty(helper.getStyle(usedSelector)?.color); ``` -You should only change the color of `a` elements inside list elements. +色を変更するのはリスト項目内の `a` 要素のみであるべきです。 ```js const footerAnchor = document.querySelector('footer a'); diff --git a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc2385ff86c76b9248c6eb7.md b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc2385ff86c76b9248c6eb7.md index a8fd7fccbde..a73597a13cb 100644 --- a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc2385ff86c76b9248c6eb7.md +++ b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dc2385ff86c76b9248c6eb7.md @@ -9,7 +9,7 @@ dashedName: step-5 HTML5 には、さまざまなコンテンツの領域を表す要素があります。 これらの要素によって HTML が読みやすくなり、検索エンジン最適化 (SEO) やアクセシビリティの向上に役立ちます。 -The `main` element is used to represent the main content of the body of an HTML document. Content inside the `main` element should be unique to the document and should not be repeated in other parts of the document. +`main` 要素は、HTML ドキュメント本文のメインとなるコンテンツを表すために使われます。 `main` 要素内のコンテンツはそのドキュメント特有のコンテンツであり、また、他の部分と重複しない内容であるべきです。 ```html
diff --git a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d6.md b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d6.md index 1ffe22ea1d2..b47e9ad4bdb 100644 --- a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d6.md +++ b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d6.md @@ -9,7 +9,7 @@ dashedName: step-35 では、ユーザーから情報を集めるためにウェブフォームを追加しましょう。 -The `form` element is used to get information from a user like their name, email, and other details. +`form` 要素は、ユーザーから情報、例えば名前やメールアドレスなどを受け取るために使われます。 `Cat Form` の見出しの後に、`form` 要素を追加してください。 diff --git a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/62bb4009e3458a128ff57d5d.md b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/62bb4009e3458a128ff57d5d.md index ee0b50e7473..39719b5268f 100644 --- a/curriculum/challenges/japanese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/62bb4009e3458a128ff57d5d.md +++ b/curriculum/challenges/japanese/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/62bb4009e3458a128ff57d5d.md @@ -17,7 +17,7 @@ dashedName: step-69 `meta` 要素は自己終了要素であることに注意してください。 -With that last change, you have completed the Cat Photo App project. Congratulations! +この変更で、猫の写真アプリのプロジェクトは完成です。 おめでとうございます! # --hints-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b1b54dda895..f5b7aaf7c32 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -39,7 +39,13 @@ Your `idToText` function should have an `id` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>/); ``` -You should assign `idToText` the result of calling the `.find()` method on your `cells` array. +Your `idToText` function should return the result of calling the `.find()` method on your `cells` array. Your callback function should use an implicit return. + +```js +assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); +``` + +Your `idToText` function should use an implicit return. ```js assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(/); @@ -57,12 +63,6 @@ Your callback function should have a `cell` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>/); ``` -Your callback function should use an implicit return. - -```js -assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); -``` - Your callback function should return whether `cell.id` is strictly equal to `id`. ```js diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md index 6ea58bc46e0..59e5ad6294e 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md @@ -11,72 +11,48 @@ In your `highPrecedence` function, declare a `regex` variable. Assign it a regul Each number, and the operator, should be in separate capture groups. +Incorporate the regular expression you've defined into your `highPrecedence` function to test if the provided string `str` matches the pattern. Use the `test()` method on your `regex` variable and return the result. + # --hints-- + You should declare a `regex` variable in your `highPrecedence` function. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*(?:const|let|var)\s+regex/); + ``` You should use `const` to declare your `regex` variable. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex/); + ``` Your `regex` variable should be a regular expression. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\//); + ``` -Your `regex` should use a capture group. +Your highPrecedence should return `regex.test(str);` ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(/); +assert.match(code, /return\s+regex\.test\(str\);?/); + ``` -Your first capture group should use a character class. +Please enter a properly functioning regex. ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[/); -``` -Your first capture group should match any digit or a period. Use the special `\d` character class. +assert.strictEqual(highPrecedence("5*3"), true); -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]/); -``` - -Your first capture group should match the character class one or more times. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)/); -``` - -Your `regex` should use a second capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(/); -``` - -Your second capture group should match a `*` or `/` operator. Use a character class in the capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)/); -``` - -Your `regex` should use a third capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(/); -``` - -Your third capture group should be the same as your first capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)/); ``` # --seed-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md index 6311798060f..3ba875ffb40 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md @@ -1,8 +1,8 @@ --- id: 646d40c543943ec250039682 -title: Step 75 +title: Step 77 challengeType: 0 -dashedName: step-75 +dashedName: step-77 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md index 3a66e0d1799..04c2e896ab3 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md @@ -1,8 +1,8 @@ --- id: 646d40fe4b7b50c30c2b4cd8 -title: Step 76 +title: Step 78 challengeType: 0 -dashedName: step-76 +dashedName: step-78 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md index 9e4657a50f7..356e13ac467 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md @@ -1,8 +1,8 @@ --- id: 646d41e23b583fc3b8cc4579 -title: Step 77 +title: Step 79 challengeType: 0 -dashedName: step-77 +dashedName: step-79 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md index 14138e9ca93..fbdf249ccbe 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md @@ -1,8 +1,8 @@ --- id: 646d423fade4a9c4636acd13 -title: Step 78 +title: Step 80 challengeType: 0 -dashedName: step-78 +dashedName: step-80 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md index 78368ca5d37..7b929decac2 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md @@ -1,8 +1,8 @@ --- id: 646d42f58deb2fc52adc6611 -title: Step 79 +title: Step 81 challengeType: 0 -dashedName: step-79 +dashedName: step-81 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md index 7c817f3c473..6c03c828f8d 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md @@ -1,8 +1,8 @@ --- id: 646d43587d926bc5b6cb2e50 -title: Step 80 +title: Step 82 challengeType: 0 -dashedName: step-80 +dashedName: step-82 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md index e61b9a38b4a..ebfac0b9aeb 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md @@ -1,8 +1,8 @@ --- id: 646d448479c8fdc8dcec868c -title: Step 81 +title: Step 83 challengeType: 0 -dashedName: step-81 +dashedName: step-83 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md index 558cef71b0f..aa83fe34555 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md @@ -1,8 +1,8 @@ --- id: 646d44da986f2bc9b72f5fe2 -title: Step 82 +title: Step 84 challengeType: 0 -dashedName: step-82 +dashedName: step-84 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md index da034ff8cd9..21d28405f26 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md @@ -1,8 +1,8 @@ --- id: 646d451c2e44afca71b67818 -title: Step 83 +title: Step 85 challengeType: 0 -dashedName: step-83 +dashedName: step-85 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md index 11e1632f84c..b8629fc2e12 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md @@ -1,8 +1,8 @@ --- id: 646d4554721d43cb19a68bc4 -title: Step 84 +title: Step 86 challengeType: 0 -dashedName: step-84 +dashedName: step-86 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md index 773d9dff52b..53a0f3b823b 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md @@ -1,8 +1,8 @@ --- id: 646d45b739da5ecbf830c108 -title: Step 85 +title: Step 87 challengeType: 0 -dashedName: step-85 +dashedName: step-87 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md index 99952a5bece..19849ef8c79 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md @@ -1,8 +1,8 @@ --- id: 646d45ee725632cca2555146 -title: Step 86 +title: Step 88 challengeType: 0 -dashedName: step-86 +dashedName: step-88 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md index 5eb843c3164..21236e19958 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md @@ -1,8 +1,8 @@ --- id: 646d4626420eeecd51f241c2 -title: Step 87 +title: Step 89 challengeType: 0 -dashedName: step-87 +dashedName: step-89 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md index 3ec60146d03..9277356624f 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md @@ -1,8 +1,8 @@ --- id: 646d467c6994f4ce0dc416a4 -title: Step 88 +title: Step 90 challengeType: 0 -dashedName: step-88 +dashedName: step-90 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md index 0144779f15e..43808a1fe26 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md @@ -1,8 +1,8 @@ --- id: 646d46c03e7d02cecb30f021 -title: Step 89 +title: Step 91 challengeType: 0 -dashedName: step-89 +dashedName: step-91 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md index de7fb664c3a..7926b0aa4e5 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md @@ -1,8 +1,8 @@ --- id: 646d4717a689e1cfa232e357 -title: Step 90 +title: Step 92 challengeType: 0 -dashedName: step-90 +dashedName: step-92 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md index 469bf574f9e..2c9733e01b0 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md @@ -1,8 +1,8 @@ --- id: 646d4769ba65f1d05ef6b634 -title: Step 91 +title: Step 93 challengeType: 0 -dashedName: step-91 +dashedName: step-93 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md index 124a786dab9..fd91e878fcd 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md @@ -1,8 +1,8 @@ --- id: 646d47c8f58107d10f1e5106 -title: Step 92 +title: Step 94 challengeType: 0 -dashedName: step-92 +dashedName: step-94 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md index dc4c70b62ac..db2a4e90437 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md @@ -1,8 +1,8 @@ --- id: 646d4813c17b37d1e261a566 -title: Step 93 +title: Step 95 challengeType: 0 -dashedName: step-93 +dashedName: step-95 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md index 449e0054421..7d8e9aa3122 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md @@ -1,8 +1,8 @@ --- id: 646d486aec20f7d2a581cc36 -title: Step 94 +title: Step 96 challengeType: 0 -dashedName: step-94 +dashedName: step-96 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md index 519590a84fa..96a39c72c8f 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md @@ -1,8 +1,8 @@ --- id: 646d48b936802fd34c3f05af -title: Step 95 +title: Step 97 challengeType: 0 -dashedName: step-95 +dashedName: step-97 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md index cc8b97da8c6..fd91d70e425 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md @@ -1,8 +1,8 @@ --- id: 646d498c8ebc31d3f753b22e -title: Step 96 +title: Step 98 challengeType: 0 -dashedName: step-96 +dashedName: step-98 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md index 0a62d2e9cc6..537acec2ad8 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md @@ -1,8 +1,8 @@ --- id: 646d49bfff9079d4b38df115 -title: Step 97 +title: Step 99 challengeType: 0 -dashedName: step-97 +dashedName: step-99 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md index 5efd22ab0b7..200c2e16ac6 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md @@ -1,8 +1,8 @@ --- id: 646d4a07a8fb14d55cd70e09 -title: Step 98 +title: Step 100 challengeType: 0 -dashedName: step-98 +dashedName: step-100 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md index ee241dee98e..51707a2bd52 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md @@ -1,8 +1,8 @@ --- id: 646d4a5b32a1cad6165df286 -title: Step 100 +title: Step 102 challengeType: 0 -dashedName: step-100 +dashedName: step-102 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md index 93ee83dcf49..8abcf6505fb 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md @@ -1,8 +1,8 @@ --- id: 646d4a8dbc04c6d6bb0001f8 -title: Step 101 +title: Step 103 challengeType: 0 -dashedName: step-101 +dashedName: step-103 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md index c380ecd405a..8093cab4152 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md @@ -1,8 +1,8 @@ --- id: 646d4ab9b3b4c5d74fdd2154 -title: Step 102 +title: Step 104 challengeType: 0 -dashedName: step-102 +dashedName: step-104 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md index 5457abbb3fd..4ec6876419d 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md @@ -1,8 +1,8 @@ --- id: 646d4b3d80ea98d824c8a4f9 -title: Step 103 +title: Step 105 challengeType: 0 -dashedName: step-103 +dashedName: step-105 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md index 41696356307..a2a6cc9edf4 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md @@ -1,8 +1,8 @@ --- id: 6491d38f5b09a021c4b5d5fe -title: Step 99 +title: Step 101 challengeType: 0 -dashedName: step-99 +dashedName: step-101 --- # --description-- diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md new file mode 100644 index 00000000000..7c2489b5b09 --- /dev/null +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md @@ -0,0 +1,159 @@ +--- +id: 661f48f412d7631a1d9c30e6 +title: Step 75 +challengeType: 0 +dashedName: step-75 +--- + +# --description-- + +You should use `console.log()` to print the result of calling the `highPrecedence` function with the string `"5*3"`. + +# --hints-- + +You should call `console.log()`. + +```js + +assert.match(code, /console\.log\(/); + +``` + +You should call your `highPrecedence` function. + +```js + +assert.match(code, /console\.log\(highPrecedence\(/); + + +``` + +Pass `5*3` as the argument + +```js + +assert.match(code, /console\.log\(highPrecedence\(["']5\*3["']\)\);?/); + +``` + + + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} + +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md new file mode 100644 index 00000000000..a36def51c9b --- /dev/null +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md @@ -0,0 +1,148 @@ +--- +id: 661f49650572031c6ebdb8e3 +title: Step 76 +challengeType: 0 +dashedName: step-76 +--- + +# --description-- + +Remove both the `console.log()` with your `highPrecedence` call, and the `return` statement from your `highPrecedence` function. + +# --hints-- + +Your code should not log the result of `highPrecedence("5*3")`. + +```js + +assert.notMatch(code, /console\.log\(highPrecedence\("5\*3"\)\)/); + +``` + +Your `highPrecedence` function should not return a value. + +```js + +assert.isUndefined(highPrecedence("5*3")); + +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} +console.log(highPrecedence("5*3")); +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md index 035126503c4..e90506c129f 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md @@ -14,6 +14,7 @@ For example, this code would assign the number `25` to the second element in the ```js let array = [1, 2, 3]; array[1] = 25; +console.log(array); // prints [1, 25, 3] ``` Update the **third** element of your `rows` array to be the number `10`. Then print the `rows` array to your console. diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md index 08b283f65e4..47b58025670 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md @@ -7,7 +7,7 @@ dashedName: step-25 # --description-- -Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `"Title:"`. +Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `Title:`. # --hints-- @@ -29,7 +29,7 @@ You should create a `strong` element after the opening tag of your `p` element. assert.match(code, /

/) ``` -Your `strong` element should have the text `"Title:"`. +Your `strong` element should have the text `Title:`. ```js assert.match(code, /

Title:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md index 6f104a6b68d..4535f1a4330 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md @@ -7,7 +7,7 @@ dashedName: step-26 # --description-- -Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `"Date:"`. +Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `Date:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element and interpolate `${date}` as the text. assert.match(code, /

.*\$\{date\}<\/p>/) ``` -You should create a `strong` element with the text `"Date:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Date:` after the opening tag of your `p` element. ```js assert.match(code, /

Date:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md index 03cba96db5c..1f8aa88d063 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md @@ -9,7 +9,7 @@ dashedName: step-28 To allow for task management, you need to include both a delete and an edit button for each task. -Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `"Edit"` and the text of the second button to `"Delete"`. +Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `Edit` and the text of the second button to `Delete`. # --hints-- @@ -19,7 +19,7 @@ You should create a `button` element of type `button`, a class `btn` and `"Edit" assert.match(code, /Edit<\/button/) ``` -You should create a `button` element of type `button` a class `btn` and `"Delete"` as the text, in that order. +You should create a `button` element of type `button` a class `btn` and `Delete` as the text, in that order. ```js assert.match(code, /Delete<\/button/) diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md index fd1945e43d0..1bca79335e1 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md @@ -1,8 +1,8 @@ --- id: 64fb1c4dc0feb219149a7c7d -title: Step 53 +title: Step 52 challengeType: 0 -dashedName: step-53 +dashedName: step-52 --- # --description-- @@ -307,7 +307,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md index 0c5aef4f9a2..cb787162942 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md @@ -1,8 +1,8 @@ --- id: 64fb285637fa1e1c222033e3 -title: Step 54 +title: Step 53 challengeType: 0 -dashedName: step-54 +dashedName: step-53 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md index 27538cc5ecf..53c055a2e6d 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md @@ -1,8 +1,8 @@ --- id: 64fb29348a60361ccd45c1e2 -title: Step 55 +title: Step 54 challengeType: 0 -dashedName: step-55 +dashedName: step-54 --- # --description-- @@ -304,7 +304,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md index 42de45bd160..349a1226355 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md @@ -1,8 +1,8 @@ --- id: 64fefebad99209211ec30537 -title: Step 56 +title: Step 55 challengeType: 0 -dashedName: step-56 +dashedName: step-55 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md index 42d6ed6ae2d..8c8c80db659 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md @@ -1,8 +1,8 @@ --- id: 64ff0313700dad264d19dfe4 -title: Step 57 +title: Step 56 challengeType: 0 -dashedName: step-57 +dashedName: step-56 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md index 1ca2784a3cc..89f8f555a63 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md @@ -1,8 +1,8 @@ --- id: 64ff04cc33779427a6412449 -title: Step 58 +title: Step 57 challengeType: 0 -dashedName: step-58 +dashedName: step-57 --- # --description-- @@ -296,7 +296,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md index 49f4240707d..ae847c9b4ab 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md @@ -1,8 +1,8 @@ --- id: 64ff068e0426eb288874ed79 -title: Step 59 +title: Step 58 challengeType: 0 -dashedName: step-59 +dashedName: step-58 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md index df55f88ac55..a69e6d3f98a 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md @@ -1,8 +1,8 @@ --- id: 64ff23daf176a92de95f24dc -title: Step 60 +title: Step 59 challengeType: 0 -dashedName: step-60 +dashedName: step-59 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md index 8f51f137e15..2d43ea0abaf 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md @@ -1,8 +1,8 @@ --- id: 64ff24b80431f62ec6b93f65 -title: Step 61 +title: Step 60 challengeType: 0 -dashedName: step-61 +dashedName: step-60 --- # --description-- @@ -286,7 +286,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md index 651b7fef4e1..defd194933a 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md @@ -1,8 +1,8 @@ --- id: 65003986d17d1e1865b269c0 -title: Step 62 +title: Step 61 challengeType: 0 -dashedName: step-62 +dashedName: step-61 --- # --description-- @@ -302,7 +302,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md index a0508d09fd1..1504db737a7 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md @@ -1,8 +1,8 @@ --- id: 650046832f92c01a35834bca -title: Step 63 +title: Step 62 challengeType: 0 -dashedName: step-63 +dashedName: step-62 --- # --description-- @@ -303,7 +303,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md index 0103dc8d732..2759f899e93 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md @@ -1,8 +1,8 @@ --- id: 650048b0764f9c1b798200e2 -title: Step 64 +title: Step 63 challengeType: 0 -dashedName: step-64 +dashedName: step-63 --- # --description-- @@ -290,7 +290,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md index a4b34f17043..304cbb31463 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md @@ -1,8 +1,8 @@ --- id: 65004ba581d03d1d5628b41c -title: Step 65 +title: Step 64 challengeType: 0 -dashedName: step-65 +dashedName: step-64 --- # --description-- @@ -23,8 +23,6 @@ In that example, if `arr` has a length greater than `0`, the code inside the `if Check if there's a task inside `taskData`, then call the `updateTaskContainer()` inside the `if` statement block. -With that, you've completed this project. - # --hints-- You should create an `if` statement with `(taskData.length)` as the condition. As a reminder, `0` is a falsy value. @@ -308,7 +306,6 @@ const taskData = JSON.parse(localStorage.getItem("data")) || []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, @@ -413,377 +410,3 @@ taskForm.addEventListener("submit", (e) => { addOrUpdateTask(); }); ``` - -# --solutions-- - -```html - - - - - - - - Learn localStorage by Building a Todo App - - - - -

-

Todo App

-
- - - -
-

Discard unsaved changes?

-
- - -
-
-
-
-
-
- - - - -``` - -```css -:root { - --white: #fff; - --light-grey: #f5f6f7; - --dark-grey: #0a0a23; - --yellow: #f1be32; - --golden-yellow: #feac32; -} - -*, -*::before, -*::after { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - background-color: var(--dark-grey); -} - -main { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -h1 { - color: var(--light-grey); - margin: 20px 0 40px 0; -} - -.todo-app { - background-color: var(--white); - width: 300px; - height: 350px; - border: 5px solid var(--yellow); - border-radius: 8px; - padding: 15px; - position: relative; - display: flex; - flex-direction: column; - gap: 10px; -} - -.btn { - cursor: pointer; - width: 100px; - margin: 10px; - color: var(--dark-grey); - background-color: var(--golden-yellow); - background-image: linear-gradient(#fecc4c, #ffac33); - border-color: var(--golden-yellow); - border-width: 3px; -} - -.btn:hover { - background-image: linear-gradient(#ffcc4c, #f89808); -} - -.large-btn { - width: 80%; - font-size: 1.2rem; - align-self: center; - justify-self: center; -} - -.close-task-form-btn { - background: none; - border: none; - cursor: pointer; -} - -.close-icon { - width: 20px; - height: 20px; -} - -.task-form { - display: flex; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - background-color: var(--white); - border-radius: 5px; - padding: 15px; - width: 300px; - height: 350px; - flex-direction: column; - justify-content: space-between; - overflow: auto; -} - -.task-form-header { - display: flex; - justify-content: flex-end; -} - -.task-form-body { - display: flex; - flex-direction: column; - justify-content: space-around; -} - -.task-form-footer { - display: flex; - justify-content: center; -} - -.task-form-label, -#title-input, -#date-input, -#description-input { - display: block; -} - -.task-form-label { - margin-bottom: 5px; - font-size: 1.3rem; - font-weight: bold; -} - -#title-input, -#date-input, -#description-input { - width: 100%; - margin-bottom: 10px; - padding: 2px; -} - -#confirm-close-dialog { - padding: 10px; - margin: 10px auto; - border-radius: 15px; -} - -.confirm-close-dialog-btn-container { - display: flex; - justify-content: center; - margin-top: 10px; -} - -.discard-message-text { - font-weight: bold; - font-size: 1.5rem; -} - -#tasks-container { - height: 100%; - overflow-y: auto; -} - -.task { - margin: 5px 0; -} - -.hidden { - display: none; -} - -@media (min-width: 576px) { - .todo-app, - .task-form { - width: 400px; - height: 450px; - } - - .task-form-label { - font-size: 1.5rem; - } - - #title-input, - #date-input { - height: 2rem; - } - - #title-input, - #date-input, - #description-input { - padding: 5px; - margin-bottom: 20px; - } -} -``` - -```js -const taskForm = document.getElementById("task-form"); -const confirmCloseDialog = document.getElementById("confirm-close-dialog"); -const openTaskFormBtn = document.getElementById("open-task-form-btn"); -const closeTaskFormBtn = document.getElementById("close-task-form-btn"); -const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); -const cancelBtn = document.getElementById("cancel-btn"); -const discardBtn = document.getElementById("discard-btn"); -const tasksContainer = document.getElementById("tasks-container"); -const titleInput = document.getElementById("title-input"); -const dateInput = document.getElementById("date-input"); -const descriptionInput = document.getElementById("description-input"); - -const taskData = JSON.parse(localStorage.getItem("data")) || []; -let currentTask = {}; - -const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; - const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); - const taskObj = { - id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, - title: titleInput.value, - date: dateInput.value, - description: descriptionInput.value, - }; - - if (dataArrIndex === -1) { - taskData.unshift(taskObj); - } else { - taskData[dataArrIndex] = taskObj; - } - - localStorage.setItem("data", JSON.stringify(taskData)); - updateTaskContainer() - reset() -}; - -const updateTaskContainer = () => { - tasksContainer.innerHTML = ""; - - taskData.forEach( - ({ id, title, date, description }) => { - (tasksContainer.innerHTML += ` -
-

Title: ${title}

-

Date: ${date}

-

Description: ${description}

- - -
- `) - } - ); -}; - - -const deleteTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - buttonEl.parentElement.remove(); - taskData.splice(dataArrIndex, 1); - localStorage.setItem("data", JSON.stringify(taskData)); -} - -const editTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - currentTask = taskData[dataArrIndex]; - - titleInput.value = currentTask.title; - dateInput.value = currentTask.date; - descriptionInput.value = currentTask.description; - - addOrUpdateTaskBtn.innerText = "Update Task"; - - - taskForm.classList.toggle("hidden"); -} - -const reset = () => { - titleInput.value = ""; - dateInput.value = ""; - descriptionInput.value = ""; - taskForm.classList.toggle("hidden"); - currentTask = {}; -} - -if (taskData.length) { - updateTaskContainer(); -} - -openTaskFormBtn.addEventListener("click", () => - taskForm.classList.toggle("hidden") -); - -closeTaskFormBtn.addEventListener("click", () => { - const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; - const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; - - if (formInputsContainValues && formInputValuesUpdated) { - confirmCloseDialog.showModal(); - } else { - reset(); - } -}); - -cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); - -discardBtn.addEventListener("click", () => { - confirmCloseDialog.close(); - reset() -}); - -taskForm.addEventListener("submit", (e) => { - e.preventDefault(); - - addOrUpdateTask(); -}); -``` diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md index 8a982fe77be..e1223fd9b03 100644 --- a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md @@ -7,7 +7,7 @@ dashedName: step-27 # --description-- -Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `"Description:"`. +Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `Description:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element with `${description}` as the text. assert.match(code, /

.*\$\{description\}<\/p>/) ``` -You should create a `strong` element with the text `"Description:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Description:` after the opening tag of your `p` element. ```js assert.match(code, /

Description:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md new file mode 100644 index 00000000000..8f2a57bf4e0 --- /dev/null +++ b/curriculum/challenges/japanese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md @@ -0,0 +1,774 @@ +--- +id: 6632420f81f3cc554a5e540b +title: Step 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +If you try to add a new task, edit that task, and then click on the `Add New Task` button, you will notice a bug. + +The form button will display the incorrect text of `"Update Task"` instead of `"Add Task"`. To fix this, you will need to assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText` inside your `reset` function. + +With that, you've completed this project. + +# --hints-- + +You should assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText`. + +```js +assert.match(code, /addOrUpdateTaskBtn\.innerText\s*=\s*('|")Add Task\1\s*/) +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +

+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + --fcc-editable-region-- + + --fcc-editable-region-- + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` + + +# --solutions-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +
+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + addOrUpdateTaskBtn.innerText = "Add Task"; + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` diff --git a/curriculum/challenges/japanese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md b/curriculum/challenges/japanese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md new file mode 100644 index 00000000000..1e918708d4c --- /dev/null +++ b/curriculum/challenges/japanese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md @@ -0,0 +1,61 @@ +--- +id: 6619240f46cec8e04d77e03a +title: Basic Functions Exercise A +challengeType: 1 +dashedName: top-basic-functions-exercise-a +--- + +# --description-- + +Create a function that takes in an integer. This function should return the given `integer + 7` if the integer is less than `10`. If the integer is greater than or equal to `10`, it should return the given `integer - 3`. + +The name of the function should be `addOrSubtract`. + +# --hints-- + +You should have a function called `addOrSubtract`. + +```js +assert.isFunction(addOrSubtract); +``` + +Your function should take in an integer as an argument. + +```js +assert.match(addOrSubtract.toString(), /\s*addOrSubtract\(\s*\w+\s*\)/); +``` + +You should return the given integer + 7 if the integer is less than 10. + +```js +assert.strictEqual(addOrSubtract(5), 12); +``` + +You should return the given integer - 3 if the integer is greater than or equal to 10. + +```js +assert.strictEqual(addOrSubtract(10), 7); +``` + + + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function addOrSubtract(num) { + if (num < 10) { + return num + 7; + } else { + return num - 3; + } +} +``` diff --git a/curriculum/challenges/japanese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md b/curriculum/challenges/japanese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md new file mode 100644 index 00000000000..4dbba976428 --- /dev/null +++ b/curriculum/challenges/japanese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md @@ -0,0 +1,47 @@ +--- +id: 661e131f068359c3ccf2f4d6 +title: Basic Functions Exercise B +challengeType: 1 +dashedName: top-basic-functions-exercise-b +--- + +# --description-- + +Write a function, named `multiply`, that takes two parameters and returns their product. + +# --hints-- + +You should have a function named `multiply`. + +```js +assert.isFunction(multiply); +``` + +Your function should take in two integers as arguments. + +```js +assert.match(multiply.toString(), /\s*multiply\(\s*\w+\s*,\s*\w+\s*\)/); +``` + +You should return the product of the two integers. + +```js +assert.strictEqual(multiply(10, 10), 100); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function multiply(a, b) { + return a * b; +} +``` diff --git a/curriculum/challenges/japanese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md b/curriculum/challenges/japanese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md new file mode 100644 index 00000000000..0c0640ae277 --- /dev/null +++ b/curriculum/challenges/japanese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md @@ -0,0 +1,47 @@ +--- +id: 661e151f068359c3ccf2f4d7 +title: Basic Functions Exercise C +challengeType: 1 +dashedName: top-basic-functions-exercise-c +--- + +# --description-- + +Write a function, named `capitalize`, that takes a string as an parameter and returns a new string with the first letter capitalized. + +# --hints-- + +You should have a function named `capitalize`. + +```js +assert.isFunction(capitalize); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(capitalize.toString(), /\s*capitalize\(\s*\w+\s*\)/); +``` + +Your function should return a new string with the first letter capitalized. + +```js +assert.strictEqual(capitalize('sem'), 'Sem'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function capitalize(str) { + return str[0].toUpperCase() + str.slice(1); +} +``` diff --git a/curriculum/challenges/japanese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md b/curriculum/challenges/japanese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md new file mode 100644 index 00000000000..79d9031b2d9 --- /dev/null +++ b/curriculum/challenges/japanese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md @@ -0,0 +1,47 @@ +--- +id: 661e17c6068359c3ccf2f4d8 +title: Basic Functions Exercise D +challengeType: 1 +dashedName: top-basic-functions-exercise-d +--- + +# --description-- + +Write a function, named `lastLetter`, that takes a string as a parameter and returns the last letter of the string. + +# --hints-- + +You should have a function named `lastLetter`. + +```js +assert.isFunction(lastLetter); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(lastLetter.toString(), /\s*lastLetter\(\s*\w+\s*\)/); +``` + +You should return the last letter of the string. + +```js +assert.strictEqual(lastLetter('Sem'), 'm'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function lastLetter(str) { + return str[str.length - 1]; +} +``` diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b1b54dda895..f5b7aaf7c32 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -39,7 +39,13 @@ Your `idToText` function should have an `id` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>/); ``` -You should assign `idToText` the result of calling the `.find()` method on your `cells` array. +Your `idToText` function should return the result of calling the `.find()` method on your `cells` array. Your callback function should use an implicit return. + +```js +assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); +``` + +Your `idToText` function should use an implicit return. ```js assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(/); @@ -57,12 +63,6 @@ Your callback function should have a `cell` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>/); ``` -Your callback function should use an implicit return. - -```js -assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); -``` - Your callback function should return whether `cell.id` is strictly equal to `id`. ```js diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md index 6ea58bc46e0..59e5ad6294e 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md @@ -11,72 +11,48 @@ In your `highPrecedence` function, declare a `regex` variable. Assign it a regul Each number, and the operator, should be in separate capture groups. +Incorporate the regular expression you've defined into your `highPrecedence` function to test if the provided string `str` matches the pattern. Use the `test()` method on your `regex` variable and return the result. + # --hints-- + You should declare a `regex` variable in your `highPrecedence` function. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*(?:const|let|var)\s+regex/); + ``` You should use `const` to declare your `regex` variable. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex/); + ``` Your `regex` variable should be a regular expression. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\//); + ``` -Your `regex` should use a capture group. +Your highPrecedence should return `regex.test(str);` ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(/); +assert.match(code, /return\s+regex\.test\(str\);?/); + ``` -Your first capture group should use a character class. +Please enter a properly functioning regex. ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[/); -``` -Your first capture group should match any digit or a period. Use the special `\d` character class. +assert.strictEqual(highPrecedence("5*3"), true); -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]/); -``` - -Your first capture group should match the character class one or more times. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)/); -``` - -Your `regex` should use a second capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(/); -``` - -Your second capture group should match a `*` or `/` operator. Use a character class in the capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)/); -``` - -Your `regex` should use a third capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(/); -``` - -Your third capture group should be the same as your first capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)/); ``` # --seed-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md index 6311798060f..3ba875ffb40 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md @@ -1,8 +1,8 @@ --- id: 646d40c543943ec250039682 -title: Step 75 +title: Step 77 challengeType: 0 -dashedName: step-75 +dashedName: step-77 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md index 3a66e0d1799..04c2e896ab3 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md @@ -1,8 +1,8 @@ --- id: 646d40fe4b7b50c30c2b4cd8 -title: Step 76 +title: Step 78 challengeType: 0 -dashedName: step-76 +dashedName: step-78 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md index 9e4657a50f7..356e13ac467 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md @@ -1,8 +1,8 @@ --- id: 646d41e23b583fc3b8cc4579 -title: Step 77 +title: Step 79 challengeType: 0 -dashedName: step-77 +dashedName: step-79 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md index 14138e9ca93..fbdf249ccbe 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md @@ -1,8 +1,8 @@ --- id: 646d423fade4a9c4636acd13 -title: Step 78 +title: Step 80 challengeType: 0 -dashedName: step-78 +dashedName: step-80 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md index 78368ca5d37..7b929decac2 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md @@ -1,8 +1,8 @@ --- id: 646d42f58deb2fc52adc6611 -title: Step 79 +title: Step 81 challengeType: 0 -dashedName: step-79 +dashedName: step-81 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md index 7c817f3c473..6c03c828f8d 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md @@ -1,8 +1,8 @@ --- id: 646d43587d926bc5b6cb2e50 -title: Step 80 +title: Step 82 challengeType: 0 -dashedName: step-80 +dashedName: step-82 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md index e61b9a38b4a..ebfac0b9aeb 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md @@ -1,8 +1,8 @@ --- id: 646d448479c8fdc8dcec868c -title: Step 81 +title: Step 83 challengeType: 0 -dashedName: step-81 +dashedName: step-83 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md index 558cef71b0f..aa83fe34555 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md @@ -1,8 +1,8 @@ --- id: 646d44da986f2bc9b72f5fe2 -title: Step 82 +title: Step 84 challengeType: 0 -dashedName: step-82 +dashedName: step-84 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md index da034ff8cd9..21d28405f26 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md @@ -1,8 +1,8 @@ --- id: 646d451c2e44afca71b67818 -title: Step 83 +title: Step 85 challengeType: 0 -dashedName: step-83 +dashedName: step-85 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md index 11e1632f84c..b8629fc2e12 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md @@ -1,8 +1,8 @@ --- id: 646d4554721d43cb19a68bc4 -title: Step 84 +title: Step 86 challengeType: 0 -dashedName: step-84 +dashedName: step-86 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md index 773d9dff52b..53a0f3b823b 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md @@ -1,8 +1,8 @@ --- id: 646d45b739da5ecbf830c108 -title: Step 85 +title: Step 87 challengeType: 0 -dashedName: step-85 +dashedName: step-87 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md index 99952a5bece..19849ef8c79 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md @@ -1,8 +1,8 @@ --- id: 646d45ee725632cca2555146 -title: Step 86 +title: Step 88 challengeType: 0 -dashedName: step-86 +dashedName: step-88 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md index 5eb843c3164..21236e19958 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md @@ -1,8 +1,8 @@ --- id: 646d4626420eeecd51f241c2 -title: Step 87 +title: Step 89 challengeType: 0 -dashedName: step-87 +dashedName: step-89 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md index 3ec60146d03..9277356624f 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md @@ -1,8 +1,8 @@ --- id: 646d467c6994f4ce0dc416a4 -title: Step 88 +title: Step 90 challengeType: 0 -dashedName: step-88 +dashedName: step-90 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md index 0144779f15e..43808a1fe26 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md @@ -1,8 +1,8 @@ --- id: 646d46c03e7d02cecb30f021 -title: Step 89 +title: Step 91 challengeType: 0 -dashedName: step-89 +dashedName: step-91 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md index de7fb664c3a..7926b0aa4e5 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md @@ -1,8 +1,8 @@ --- id: 646d4717a689e1cfa232e357 -title: Step 90 +title: Step 92 challengeType: 0 -dashedName: step-90 +dashedName: step-92 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md index 469bf574f9e..2c9733e01b0 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md @@ -1,8 +1,8 @@ --- id: 646d4769ba65f1d05ef6b634 -title: Step 91 +title: Step 93 challengeType: 0 -dashedName: step-91 +dashedName: step-93 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md index 124a786dab9..fd91e878fcd 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md @@ -1,8 +1,8 @@ --- id: 646d47c8f58107d10f1e5106 -title: Step 92 +title: Step 94 challengeType: 0 -dashedName: step-92 +dashedName: step-94 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md index dc4c70b62ac..db2a4e90437 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md @@ -1,8 +1,8 @@ --- id: 646d4813c17b37d1e261a566 -title: Step 93 +title: Step 95 challengeType: 0 -dashedName: step-93 +dashedName: step-95 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md index 449e0054421..7d8e9aa3122 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md @@ -1,8 +1,8 @@ --- id: 646d486aec20f7d2a581cc36 -title: Step 94 +title: Step 96 challengeType: 0 -dashedName: step-94 +dashedName: step-96 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md index 519590a84fa..96a39c72c8f 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md @@ -1,8 +1,8 @@ --- id: 646d48b936802fd34c3f05af -title: Step 95 +title: Step 97 challengeType: 0 -dashedName: step-95 +dashedName: step-97 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md index cc8b97da8c6..fd91d70e425 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md @@ -1,8 +1,8 @@ --- id: 646d498c8ebc31d3f753b22e -title: Step 96 +title: Step 98 challengeType: 0 -dashedName: step-96 +dashedName: step-98 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md index 0a62d2e9cc6..537acec2ad8 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md @@ -1,8 +1,8 @@ --- id: 646d49bfff9079d4b38df115 -title: Step 97 +title: Step 99 challengeType: 0 -dashedName: step-97 +dashedName: step-99 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md index 5efd22ab0b7..200c2e16ac6 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md @@ -1,8 +1,8 @@ --- id: 646d4a07a8fb14d55cd70e09 -title: Step 98 +title: Step 100 challengeType: 0 -dashedName: step-98 +dashedName: step-100 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md index ee241dee98e..51707a2bd52 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md @@ -1,8 +1,8 @@ --- id: 646d4a5b32a1cad6165df286 -title: Step 100 +title: Step 102 challengeType: 0 -dashedName: step-100 +dashedName: step-102 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md index 93ee83dcf49..8abcf6505fb 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md @@ -1,8 +1,8 @@ --- id: 646d4a8dbc04c6d6bb0001f8 -title: Step 101 +title: Step 103 challengeType: 0 -dashedName: step-101 +dashedName: step-103 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md index c380ecd405a..8093cab4152 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md @@ -1,8 +1,8 @@ --- id: 646d4ab9b3b4c5d74fdd2154 -title: Step 102 +title: Step 104 challengeType: 0 -dashedName: step-102 +dashedName: step-104 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md index 5457abbb3fd..4ec6876419d 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md @@ -1,8 +1,8 @@ --- id: 646d4b3d80ea98d824c8a4f9 -title: Step 103 +title: Step 105 challengeType: 0 -dashedName: step-103 +dashedName: step-105 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md index 41696356307..a2a6cc9edf4 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md @@ -1,8 +1,8 @@ --- id: 6491d38f5b09a021c4b5d5fe -title: Step 99 +title: Step 101 challengeType: 0 -dashedName: step-99 +dashedName: step-101 --- # --description-- diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md new file mode 100644 index 00000000000..7c2489b5b09 --- /dev/null +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md @@ -0,0 +1,159 @@ +--- +id: 661f48f412d7631a1d9c30e6 +title: Step 75 +challengeType: 0 +dashedName: step-75 +--- + +# --description-- + +You should use `console.log()` to print the result of calling the `highPrecedence` function with the string `"5*3"`. + +# --hints-- + +You should call `console.log()`. + +```js + +assert.match(code, /console\.log\(/); + +``` + +You should call your `highPrecedence` function. + +```js + +assert.match(code, /console\.log\(highPrecedence\(/); + + +``` + +Pass `5*3` as the argument + +```js + +assert.match(code, /console\.log\(highPrecedence\(["']5\*3["']\)\);?/); + +``` + + + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} + +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md new file mode 100644 index 00000000000..a36def51c9b --- /dev/null +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md @@ -0,0 +1,148 @@ +--- +id: 661f49650572031c6ebdb8e3 +title: Step 76 +challengeType: 0 +dashedName: step-76 +--- + +# --description-- + +Remove both the `console.log()` with your `highPrecedence` call, and the `return` statement from your `highPrecedence` function. + +# --hints-- + +Your code should not log the result of `highPrecedence("5*3")`. + +```js + +assert.notMatch(code, /console\.log\(highPrecedence\("5\*3"\)\)/); + +``` + +Your `highPrecedence` function should not return a value. + +```js + +assert.isUndefined(highPrecedence("5*3")); + +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} +console.log(highPrecedence("5*3")); +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md index 035126503c4..e90506c129f 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md @@ -14,6 +14,7 @@ For example, this code would assign the number `25` to the second element in the ```js let array = [1, 2, 3]; array[1] = 25; +console.log(array); // prints [1, 25, 3] ``` Update the **third** element of your `rows` array to be the number `10`. Then print the `rows` array to your console. diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md index 08b283f65e4..47b58025670 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md @@ -7,7 +7,7 @@ dashedName: step-25 # --description-- -Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `"Title:"`. +Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `Title:`. # --hints-- @@ -29,7 +29,7 @@ You should create a `strong` element after the opening tag of your `p` element. assert.match(code, /

/) ``` -Your `strong` element should have the text `"Title:"`. +Your `strong` element should have the text `Title:`. ```js assert.match(code, /

Title:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md index 6f104a6b68d..4535f1a4330 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md @@ -7,7 +7,7 @@ dashedName: step-26 # --description-- -Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `"Date:"`. +Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `Date:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element and interpolate `${date}` as the text. assert.match(code, /

.*\$\{date\}<\/p>/) ``` -You should create a `strong` element with the text `"Date:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Date:` after the opening tag of your `p` element. ```js assert.match(code, /

Date:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md index 03cba96db5c..1f8aa88d063 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md @@ -9,7 +9,7 @@ dashedName: step-28 To allow for task management, you need to include both a delete and an edit button for each task. -Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `"Edit"` and the text of the second button to `"Delete"`. +Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `Edit` and the text of the second button to `Delete`. # --hints-- @@ -19,7 +19,7 @@ You should create a `button` element of type `button`, a class `btn` and `"Edit" assert.match(code, /Edit<\/button/) ``` -You should create a `button` element of type `button` a class `btn` and `"Delete"` as the text, in that order. +You should create a `button` element of type `button` a class `btn` and `Delete` as the text, in that order. ```js assert.match(code, /Delete<\/button/) diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md index fd1945e43d0..1bca79335e1 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md @@ -1,8 +1,8 @@ --- id: 64fb1c4dc0feb219149a7c7d -title: Step 53 +title: Step 52 challengeType: 0 -dashedName: step-53 +dashedName: step-52 --- # --description-- @@ -307,7 +307,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md index 0c5aef4f9a2..cb787162942 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md @@ -1,8 +1,8 @@ --- id: 64fb285637fa1e1c222033e3 -title: Step 54 +title: Step 53 challengeType: 0 -dashedName: step-54 +dashedName: step-53 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md index 27538cc5ecf..53c055a2e6d 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md @@ -1,8 +1,8 @@ --- id: 64fb29348a60361ccd45c1e2 -title: Step 55 +title: Step 54 challengeType: 0 -dashedName: step-55 +dashedName: step-54 --- # --description-- @@ -304,7 +304,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md index 42de45bd160..349a1226355 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md @@ -1,8 +1,8 @@ --- id: 64fefebad99209211ec30537 -title: Step 56 +title: Step 55 challengeType: 0 -dashedName: step-56 +dashedName: step-55 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md index 42d6ed6ae2d..8c8c80db659 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md @@ -1,8 +1,8 @@ --- id: 64ff0313700dad264d19dfe4 -title: Step 57 +title: Step 56 challengeType: 0 -dashedName: step-57 +dashedName: step-56 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md index 1ca2784a3cc..89f8f555a63 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md @@ -1,8 +1,8 @@ --- id: 64ff04cc33779427a6412449 -title: Step 58 +title: Step 57 challengeType: 0 -dashedName: step-58 +dashedName: step-57 --- # --description-- @@ -296,7 +296,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md index 49f4240707d..ae847c9b4ab 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md @@ -1,8 +1,8 @@ --- id: 64ff068e0426eb288874ed79 -title: Step 59 +title: Step 58 challengeType: 0 -dashedName: step-59 +dashedName: step-58 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md index df55f88ac55..a69e6d3f98a 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md @@ -1,8 +1,8 @@ --- id: 64ff23daf176a92de95f24dc -title: Step 60 +title: Step 59 challengeType: 0 -dashedName: step-60 +dashedName: step-59 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md index 8f51f137e15..2d43ea0abaf 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md @@ -1,8 +1,8 @@ --- id: 64ff24b80431f62ec6b93f65 -title: Step 61 +title: Step 60 challengeType: 0 -dashedName: step-61 +dashedName: step-60 --- # --description-- @@ -286,7 +286,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md index 651b7fef4e1..defd194933a 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md @@ -1,8 +1,8 @@ --- id: 65003986d17d1e1865b269c0 -title: Step 62 +title: Step 61 challengeType: 0 -dashedName: step-62 +dashedName: step-61 --- # --description-- @@ -302,7 +302,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md index a0508d09fd1..1504db737a7 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md @@ -1,8 +1,8 @@ --- id: 650046832f92c01a35834bca -title: Step 63 +title: Step 62 challengeType: 0 -dashedName: step-63 +dashedName: step-62 --- # --description-- @@ -303,7 +303,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md index 0103dc8d732..2759f899e93 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md @@ -1,8 +1,8 @@ --- id: 650048b0764f9c1b798200e2 -title: Step 64 +title: Step 63 challengeType: 0 -dashedName: step-64 +dashedName: step-63 --- # --description-- @@ -290,7 +290,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md index a4b34f17043..304cbb31463 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md @@ -1,8 +1,8 @@ --- id: 65004ba581d03d1d5628b41c -title: Step 65 +title: Step 64 challengeType: 0 -dashedName: step-65 +dashedName: step-64 --- # --description-- @@ -23,8 +23,6 @@ In that example, if `arr` has a length greater than `0`, the code inside the `if Check if there's a task inside `taskData`, then call the `updateTaskContainer()` inside the `if` statement block. -With that, you've completed this project. - # --hints-- You should create an `if` statement with `(taskData.length)` as the condition. As a reminder, `0` is a falsy value. @@ -308,7 +306,6 @@ const taskData = JSON.parse(localStorage.getItem("data")) || []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, @@ -413,377 +410,3 @@ taskForm.addEventListener("submit", (e) => { addOrUpdateTask(); }); ``` - -# --solutions-- - -```html - - - - - - - - Learn localStorage by Building a Todo App - - - - -

-

Todo App

-
- - - -
-

Discard unsaved changes?

-
- - -
-
-
-
-
-
- - - - -``` - -```css -:root { - --white: #fff; - --light-grey: #f5f6f7; - --dark-grey: #0a0a23; - --yellow: #f1be32; - --golden-yellow: #feac32; -} - -*, -*::before, -*::after { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - background-color: var(--dark-grey); -} - -main { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -h1 { - color: var(--light-grey); - margin: 20px 0 40px 0; -} - -.todo-app { - background-color: var(--white); - width: 300px; - height: 350px; - border: 5px solid var(--yellow); - border-radius: 8px; - padding: 15px; - position: relative; - display: flex; - flex-direction: column; - gap: 10px; -} - -.btn { - cursor: pointer; - width: 100px; - margin: 10px; - color: var(--dark-grey); - background-color: var(--golden-yellow); - background-image: linear-gradient(#fecc4c, #ffac33); - border-color: var(--golden-yellow); - border-width: 3px; -} - -.btn:hover { - background-image: linear-gradient(#ffcc4c, #f89808); -} - -.large-btn { - width: 80%; - font-size: 1.2rem; - align-self: center; - justify-self: center; -} - -.close-task-form-btn { - background: none; - border: none; - cursor: pointer; -} - -.close-icon { - width: 20px; - height: 20px; -} - -.task-form { - display: flex; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - background-color: var(--white); - border-radius: 5px; - padding: 15px; - width: 300px; - height: 350px; - flex-direction: column; - justify-content: space-between; - overflow: auto; -} - -.task-form-header { - display: flex; - justify-content: flex-end; -} - -.task-form-body { - display: flex; - flex-direction: column; - justify-content: space-around; -} - -.task-form-footer { - display: flex; - justify-content: center; -} - -.task-form-label, -#title-input, -#date-input, -#description-input { - display: block; -} - -.task-form-label { - margin-bottom: 5px; - font-size: 1.3rem; - font-weight: bold; -} - -#title-input, -#date-input, -#description-input { - width: 100%; - margin-bottom: 10px; - padding: 2px; -} - -#confirm-close-dialog { - padding: 10px; - margin: 10px auto; - border-radius: 15px; -} - -.confirm-close-dialog-btn-container { - display: flex; - justify-content: center; - margin-top: 10px; -} - -.discard-message-text { - font-weight: bold; - font-size: 1.5rem; -} - -#tasks-container { - height: 100%; - overflow-y: auto; -} - -.task { - margin: 5px 0; -} - -.hidden { - display: none; -} - -@media (min-width: 576px) { - .todo-app, - .task-form { - width: 400px; - height: 450px; - } - - .task-form-label { - font-size: 1.5rem; - } - - #title-input, - #date-input { - height: 2rem; - } - - #title-input, - #date-input, - #description-input { - padding: 5px; - margin-bottom: 20px; - } -} -``` - -```js -const taskForm = document.getElementById("task-form"); -const confirmCloseDialog = document.getElementById("confirm-close-dialog"); -const openTaskFormBtn = document.getElementById("open-task-form-btn"); -const closeTaskFormBtn = document.getElementById("close-task-form-btn"); -const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); -const cancelBtn = document.getElementById("cancel-btn"); -const discardBtn = document.getElementById("discard-btn"); -const tasksContainer = document.getElementById("tasks-container"); -const titleInput = document.getElementById("title-input"); -const dateInput = document.getElementById("date-input"); -const descriptionInput = document.getElementById("description-input"); - -const taskData = JSON.parse(localStorage.getItem("data")) || []; -let currentTask = {}; - -const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; - const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); - const taskObj = { - id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, - title: titleInput.value, - date: dateInput.value, - description: descriptionInput.value, - }; - - if (dataArrIndex === -1) { - taskData.unshift(taskObj); - } else { - taskData[dataArrIndex] = taskObj; - } - - localStorage.setItem("data", JSON.stringify(taskData)); - updateTaskContainer() - reset() -}; - -const updateTaskContainer = () => { - tasksContainer.innerHTML = ""; - - taskData.forEach( - ({ id, title, date, description }) => { - (tasksContainer.innerHTML += ` -
-

Title: ${title}

-

Date: ${date}

-

Description: ${description}

- - -
- `) - } - ); -}; - - -const deleteTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - buttonEl.parentElement.remove(); - taskData.splice(dataArrIndex, 1); - localStorage.setItem("data", JSON.stringify(taskData)); -} - -const editTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - currentTask = taskData[dataArrIndex]; - - titleInput.value = currentTask.title; - dateInput.value = currentTask.date; - descriptionInput.value = currentTask.description; - - addOrUpdateTaskBtn.innerText = "Update Task"; - - - taskForm.classList.toggle("hidden"); -} - -const reset = () => { - titleInput.value = ""; - dateInput.value = ""; - descriptionInput.value = ""; - taskForm.classList.toggle("hidden"); - currentTask = {}; -} - -if (taskData.length) { - updateTaskContainer(); -} - -openTaskFormBtn.addEventListener("click", () => - taskForm.classList.toggle("hidden") -); - -closeTaskFormBtn.addEventListener("click", () => { - const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; - const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; - - if (formInputsContainValues && formInputValuesUpdated) { - confirmCloseDialog.showModal(); - } else { - reset(); - } -}); - -cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); - -discardBtn.addEventListener("click", () => { - confirmCloseDialog.close(); - reset() -}); - -taskForm.addEventListener("submit", (e) => { - e.preventDefault(); - - addOrUpdateTask(); -}); -``` diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md index 8a982fe77be..e1223fd9b03 100644 --- a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md @@ -7,7 +7,7 @@ dashedName: step-27 # --description-- -Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `"Description:"`. +Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `Description:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element with `${description}` as the text. assert.match(code, /

.*\$\{description\}<\/p>/) ``` -You should create a `strong` element with the text `"Description:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Description:` after the opening tag of your `p` element. ```js assert.match(code, /

Description:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md new file mode 100644 index 00000000000..8f2a57bf4e0 --- /dev/null +++ b/curriculum/challenges/korean/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md @@ -0,0 +1,774 @@ +--- +id: 6632420f81f3cc554a5e540b +title: Step 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +If you try to add a new task, edit that task, and then click on the `Add New Task` button, you will notice a bug. + +The form button will display the incorrect text of `"Update Task"` instead of `"Add Task"`. To fix this, you will need to assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText` inside your `reset` function. + +With that, you've completed this project. + +# --hints-- + +You should assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText`. + +```js +assert.match(code, /addOrUpdateTaskBtn\.innerText\s*=\s*('|")Add Task\1\s*/) +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +

+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + --fcc-editable-region-- + + --fcc-editable-region-- + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` + + +# --solutions-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +
+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + addOrUpdateTaskBtn.innerText = "Add Task"; + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` diff --git a/curriculum/challenges/korean/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md b/curriculum/challenges/korean/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md new file mode 100644 index 00000000000..1e918708d4c --- /dev/null +++ b/curriculum/challenges/korean/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md @@ -0,0 +1,61 @@ +--- +id: 6619240f46cec8e04d77e03a +title: Basic Functions Exercise A +challengeType: 1 +dashedName: top-basic-functions-exercise-a +--- + +# --description-- + +Create a function that takes in an integer. This function should return the given `integer + 7` if the integer is less than `10`. If the integer is greater than or equal to `10`, it should return the given `integer - 3`. + +The name of the function should be `addOrSubtract`. + +# --hints-- + +You should have a function called `addOrSubtract`. + +```js +assert.isFunction(addOrSubtract); +``` + +Your function should take in an integer as an argument. + +```js +assert.match(addOrSubtract.toString(), /\s*addOrSubtract\(\s*\w+\s*\)/); +``` + +You should return the given integer + 7 if the integer is less than 10. + +```js +assert.strictEqual(addOrSubtract(5), 12); +``` + +You should return the given integer - 3 if the integer is greater than or equal to 10. + +```js +assert.strictEqual(addOrSubtract(10), 7); +``` + + + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function addOrSubtract(num) { + if (num < 10) { + return num + 7; + } else { + return num - 3; + } +} +``` diff --git a/curriculum/challenges/korean/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md b/curriculum/challenges/korean/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md new file mode 100644 index 00000000000..4dbba976428 --- /dev/null +++ b/curriculum/challenges/korean/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md @@ -0,0 +1,47 @@ +--- +id: 661e131f068359c3ccf2f4d6 +title: Basic Functions Exercise B +challengeType: 1 +dashedName: top-basic-functions-exercise-b +--- + +# --description-- + +Write a function, named `multiply`, that takes two parameters and returns their product. + +# --hints-- + +You should have a function named `multiply`. + +```js +assert.isFunction(multiply); +``` + +Your function should take in two integers as arguments. + +```js +assert.match(multiply.toString(), /\s*multiply\(\s*\w+\s*,\s*\w+\s*\)/); +``` + +You should return the product of the two integers. + +```js +assert.strictEqual(multiply(10, 10), 100); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function multiply(a, b) { + return a * b; +} +``` diff --git a/curriculum/challenges/korean/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md b/curriculum/challenges/korean/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md new file mode 100644 index 00000000000..0c0640ae277 --- /dev/null +++ b/curriculum/challenges/korean/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md @@ -0,0 +1,47 @@ +--- +id: 661e151f068359c3ccf2f4d7 +title: Basic Functions Exercise C +challengeType: 1 +dashedName: top-basic-functions-exercise-c +--- + +# --description-- + +Write a function, named `capitalize`, that takes a string as an parameter and returns a new string with the first letter capitalized. + +# --hints-- + +You should have a function named `capitalize`. + +```js +assert.isFunction(capitalize); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(capitalize.toString(), /\s*capitalize\(\s*\w+\s*\)/); +``` + +Your function should return a new string with the first letter capitalized. + +```js +assert.strictEqual(capitalize('sem'), 'Sem'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function capitalize(str) { + return str[0].toUpperCase() + str.slice(1); +} +``` diff --git a/curriculum/challenges/korean/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md b/curriculum/challenges/korean/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md new file mode 100644 index 00000000000..79d9031b2d9 --- /dev/null +++ b/curriculum/challenges/korean/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md @@ -0,0 +1,47 @@ +--- +id: 661e17c6068359c3ccf2f4d8 +title: Basic Functions Exercise D +challengeType: 1 +dashedName: top-basic-functions-exercise-d +--- + +# --description-- + +Write a function, named `lastLetter`, that takes a string as a parameter and returns the last letter of the string. + +# --hints-- + +You should have a function named `lastLetter`. + +```js +assert.isFunction(lastLetter); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(lastLetter.toString(), /\s*lastLetter\(\s*\w+\s*\)/); +``` + +You should return the last letter of the string. + +```js +assert.strictEqual(lastLetter('Sem'), 'm'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function lastLetter(str) { + return str[str.length - 1]; +} +``` diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b917bbfeb4f..37f1619878b 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -39,7 +39,13 @@ A função `idToText` deve ter um parâmetro `id`. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>/); ``` -Você deve atribuir a `idToText` o resultado da chamada do método `.find()` no array `cells`. +Your `idToText` function should return the result of calling the `.find()` method on your `cells` array. A função de callback deve usar um retorno implícito. + +```js +assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); +``` + +Your `idToText` function should use an implicit return. ```js assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(/); @@ -57,12 +63,6 @@ A função de callback deve ter um parâmetro `cell`. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>/); ``` -A função de callback deve usar um retorno implícito. - -```js -assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); -``` - A função de callback deve retornar se `cell.id` é estritamente igual a `id`. ```js diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md index 33469a74c47..4c4688b222d 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md @@ -11,72 +11,48 @@ Na função `highPrecedence`, declare uma variável `regex`. Atribua a ela uma e Cada número, assim como o operador, deve estar em grupos de captura separados. +Incorporate the regular expression you've defined into your `highPrecedence` function to test if the provided string `str` matches the pattern. Use the `test()` method on your `regex` variable and return the result. + # --hints-- + Você deve declarar uma variável `regex` na função `highPrecedence`. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*(?:const|let|var)\s+regex/); + ``` Você deve usar `const` para declarar a variável `regex`. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex/); + ``` A variável `regex` deve ser uma expressão regular. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\//); + ``` -`regex` deve usar um grupo de captura. +Your highPrecedence should return `regex.test(str);` ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(/); +assert.match(code, /return\s+regex\.test\(str\);?/); + ``` -O primeiro grupo de captura deve usar uma classe de caractere. +Please enter a properly functioning regex. ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[/); -``` -O primeiro grupo de captura deve corresponder a qualquer algarismo ou a um ponto. Use a classe de caractere especial `\d`. +assert.strictEqual(highPrecedence("5*3"), true); -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]/); -``` - -O primeiro grupo de captura deve coincidir com a classe de caractere uma ou mais vezes. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)/); -``` - -`regex` deve usar um segundo grupo de captura. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(/); -``` - -O segundo grupo de captura deve corresponder a um operador `*` ou `/`. Use uma classe de caractere no grupo de captura. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)/); -``` - -`regex` deve usar um terceiro grupo de captura. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(/); -``` - -O terceiro grupo de captura deve ser igual ao primeiro. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)/); ``` # --seed-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md index dfd4bef8b4d..74e2d8cb65a 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md @@ -1,8 +1,8 @@ --- id: 646d40c543943ec250039682 -title: Step 75 +title: Step 77 challengeType: 0 -dashedName: step-75 +dashedName: step-77 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md index fec5dc98818..0c59759a0d4 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md @@ -1,8 +1,8 @@ --- id: 646d40fe4b7b50c30c2b4cd8 -title: Step 76 +title: Step 78 challengeType: 0 -dashedName: step-76 +dashedName: step-78 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md index b69ee11eaf9..8ff3ed71911 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md @@ -1,8 +1,8 @@ --- id: 646d41e23b583fc3b8cc4579 -title: Step 77 +title: Step 79 challengeType: 0 -dashedName: step-77 +dashedName: step-79 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md index faa6f52852d..9541d8237b5 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md @@ -1,8 +1,8 @@ --- id: 646d423fade4a9c4636acd13 -title: Step 78 +title: Step 80 challengeType: 0 -dashedName: step-78 +dashedName: step-80 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md index 5105f5561d5..50de2dac239 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md @@ -1,8 +1,8 @@ --- id: 646d42f58deb2fc52adc6611 -title: Step 79 +title: Step 81 challengeType: 0 -dashedName: step-79 +dashedName: step-81 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md index 21d98f139ad..69a141aa12c 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md @@ -1,8 +1,8 @@ --- id: 646d43587d926bc5b6cb2e50 -title: Step 80 +title: Step 82 challengeType: 0 -dashedName: step-80 +dashedName: step-82 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md index b214e583819..4cc4349a5dd 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md @@ -1,8 +1,8 @@ --- id: 646d448479c8fdc8dcec868c -title: Step 81 +title: Step 83 challengeType: 0 -dashedName: step-81 +dashedName: step-83 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md index 61ae7ad5023..6ea74e4919a 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md @@ -1,8 +1,8 @@ --- id: 646d44da986f2bc9b72f5fe2 -title: Step 82 +title: Step 84 challengeType: 0 -dashedName: step-82 +dashedName: step-84 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md index b9bf603262d..000410f7197 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md @@ -1,8 +1,8 @@ --- id: 646d451c2e44afca71b67818 -title: Step 83 +title: Step 85 challengeType: 0 -dashedName: step-83 +dashedName: step-85 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md index 4d4915c05e4..e75382734f7 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md @@ -1,8 +1,8 @@ --- id: 646d4554721d43cb19a68bc4 -title: Step 84 +title: Step 86 challengeType: 0 -dashedName: step-84 +dashedName: step-86 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md index 65dab1f3edb..711a4128abf 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md @@ -1,8 +1,8 @@ --- id: 646d45b739da5ecbf830c108 -title: Step 85 +title: Step 87 challengeType: 0 -dashedName: step-85 +dashedName: step-87 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md index 145133d3fe6..663d815fd08 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md @@ -1,8 +1,8 @@ --- id: 646d45ee725632cca2555146 -title: Step 86 +title: Step 88 challengeType: 0 -dashedName: step-86 +dashedName: step-88 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md index 8e478f181fa..25e7ec3c559 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md @@ -1,8 +1,8 @@ --- id: 646d4626420eeecd51f241c2 -title: Step 87 +title: Step 89 challengeType: 0 -dashedName: step-87 +dashedName: step-89 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md index 3188cebf88d..754e68c44e3 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md @@ -1,8 +1,8 @@ --- id: 646d467c6994f4ce0dc416a4 -title: Step 88 +title: Step 90 challengeType: 0 -dashedName: step-88 +dashedName: step-90 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md index 748b540b7e1..402f177f665 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md @@ -1,8 +1,8 @@ --- id: 646d46c03e7d02cecb30f021 -title: Step 89 +title: Step 91 challengeType: 0 -dashedName: step-89 +dashedName: step-91 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md index 0e45f56df4c..f5e1f8a2c6b 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md @@ -1,8 +1,8 @@ --- id: 646d4717a689e1cfa232e357 -title: Step 90 +title: Step 92 challengeType: 0 -dashedName: step-90 +dashedName: step-92 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md index a4c4487c70d..3d28102cf40 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md @@ -1,8 +1,8 @@ --- id: 646d4769ba65f1d05ef6b634 -title: Step 91 +title: Step 93 challengeType: 0 -dashedName: step-91 +dashedName: step-93 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md index fee20ed3573..176b757ce12 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md @@ -1,8 +1,8 @@ --- id: 646d47c8f58107d10f1e5106 -title: Step 92 +title: Step 94 challengeType: 0 -dashedName: step-92 +dashedName: step-94 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md index 697620015b1..dd34646a5bf 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md @@ -1,8 +1,8 @@ --- id: 646d4813c17b37d1e261a566 -title: Step 93 +title: Step 95 challengeType: 0 -dashedName: step-93 +dashedName: step-95 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md index 2ddfb747c37..83b7c1816e6 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md @@ -1,8 +1,8 @@ --- id: 646d486aec20f7d2a581cc36 -title: Step 94 +title: Step 96 challengeType: 0 -dashedName: step-94 +dashedName: step-96 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md index 1a3efbd4577..0d39ec45a21 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md @@ -1,8 +1,8 @@ --- id: 646d48b936802fd34c3f05af -title: Step 95 +title: Step 97 challengeType: 0 -dashedName: step-95 +dashedName: step-97 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md index 09a3caf6b5f..9d9c3120545 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md @@ -1,8 +1,8 @@ --- id: 646d498c8ebc31d3f753b22e -title: Step 96 +title: Step 98 challengeType: 0 -dashedName: step-96 +dashedName: step-98 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md index 3ac8eaea9e5..9e4aaa5423f 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md @@ -1,8 +1,8 @@ --- id: 646d49bfff9079d4b38df115 -title: Step 97 +title: Step 99 challengeType: 0 -dashedName: step-97 +dashedName: step-99 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md index 9c6c6866e85..7980f7cfbcf 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md @@ -1,8 +1,8 @@ --- id: 646d4a07a8fb14d55cd70e09 -title: Step 98 +title: Step 100 challengeType: 0 -dashedName: step-98 +dashedName: step-100 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md index 7370e2e41d1..e60def897c9 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md @@ -1,8 +1,8 @@ --- id: 646d4a5b32a1cad6165df286 -title: Step 100 +title: Step 102 challengeType: 0 -dashedName: step-100 +dashedName: step-102 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md index 7c7c87d5a6b..32e7e76cd42 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md @@ -1,8 +1,8 @@ --- id: 646d4a8dbc04c6d6bb0001f8 -title: Step 101 +title: Step 103 challengeType: 0 -dashedName: step-101 +dashedName: step-103 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md index 056bade6657..5c98ff3662a 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md @@ -1,8 +1,8 @@ --- id: 646d4ab9b3b4c5d74fdd2154 -title: Step 102 +title: Step 104 challengeType: 0 -dashedName: step-102 +dashedName: step-104 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md index 784809defe2..0109445c02c 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md @@ -1,8 +1,8 @@ --- id: 646d4b3d80ea98d824c8a4f9 -title: Step 103 +title: Step 105 challengeType: 0 -dashedName: step-103 +dashedName: step-105 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md index 24b75713476..b3eb074689d 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md @@ -1,8 +1,8 @@ --- id: 6491d38f5b09a021c4b5d5fe -title: Step 99 +title: Step 101 challengeType: 0 -dashedName: step-99 +dashedName: step-101 --- # --description-- diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md new file mode 100644 index 00000000000..7c2489b5b09 --- /dev/null +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md @@ -0,0 +1,159 @@ +--- +id: 661f48f412d7631a1d9c30e6 +title: Step 75 +challengeType: 0 +dashedName: step-75 +--- + +# --description-- + +You should use `console.log()` to print the result of calling the `highPrecedence` function with the string `"5*3"`. + +# --hints-- + +You should call `console.log()`. + +```js + +assert.match(code, /console\.log\(/); + +``` + +You should call your `highPrecedence` function. + +```js + +assert.match(code, /console\.log\(highPrecedence\(/); + + +``` + +Pass `5*3` as the argument + +```js + +assert.match(code, /console\.log\(highPrecedence\(["']5\*3["']\)\);?/); + +``` + + + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} + +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md new file mode 100644 index 00000000000..a36def51c9b --- /dev/null +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md @@ -0,0 +1,148 @@ +--- +id: 661f49650572031c6ebdb8e3 +title: Step 76 +challengeType: 0 +dashedName: step-76 +--- + +# --description-- + +Remove both the `console.log()` with your `highPrecedence` call, and the `return` statement from your `highPrecedence` function. + +# --hints-- + +Your code should not log the result of `highPrecedence("5*3")`. + +```js + +assert.notMatch(code, /console\.log\(highPrecedence\("5\*3"\)\)/); + +``` + +Your `highPrecedence` function should not return a value. + +```js + +assert.isUndefined(highPrecedence("5*3")); + +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} +console.log(highPrecedence("5*3")); +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md index 035126503c4..e90506c129f 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md @@ -14,6 +14,7 @@ For example, this code would assign the number `25` to the second element in the ```js let array = [1, 2, 3]; array[1] = 25; +console.log(array); // prints [1, 25, 3] ``` Update the **third** element of your `rows` array to be the number `10`. Then print the `rows` array to your console. diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md index 22c11cade09..9a30df0a382 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md @@ -7,7 +7,7 @@ dashedName: step-25 # --description-- -Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `"Title:"`. +Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `Title:`. # --hints-- @@ -29,7 +29,7 @@ You should create a `strong` element after the opening tag of your `p` element. assert.match(code, /

/) ``` -Your `strong` element should have the text `"Title:"`. +Your `strong` element should have the text `Title:`. ```js assert.match(code, /

Title:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md index 6f104a6b68d..4535f1a4330 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md @@ -7,7 +7,7 @@ dashedName: step-26 # --description-- -Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `"Date:"`. +Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `Date:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element and interpolate `${date}` as the text. assert.match(code, /

.*\$\{date\}<\/p>/) ``` -You should create a `strong` element with the text `"Date:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Date:` after the opening tag of your `p` element. ```js assert.match(code, /

Date:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md index 03cba96db5c..1f8aa88d063 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md @@ -9,7 +9,7 @@ dashedName: step-28 To allow for task management, you need to include both a delete and an edit button for each task. -Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `"Edit"` and the text of the second button to `"Delete"`. +Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `Edit` and the text of the second button to `Delete`. # --hints-- @@ -19,7 +19,7 @@ You should create a `button` element of type `button`, a class `btn` and `"Edit" assert.match(code, /Edit<\/button/) ``` -You should create a `button` element of type `button` a class `btn` and `"Delete"` as the text, in that order. +You should create a `button` element of type `button` a class `btn` and `Delete` as the text, in that order. ```js assert.match(code, /Delete<\/button/) diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md index fd1945e43d0..1bca79335e1 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md @@ -1,8 +1,8 @@ --- id: 64fb1c4dc0feb219149a7c7d -title: Step 53 +title: Step 52 challengeType: 0 -dashedName: step-53 +dashedName: step-52 --- # --description-- @@ -307,7 +307,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md index 0c5aef4f9a2..cb787162942 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md @@ -1,8 +1,8 @@ --- id: 64fb285637fa1e1c222033e3 -title: Step 54 +title: Step 53 challengeType: 0 -dashedName: step-54 +dashedName: step-53 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md index 27538cc5ecf..53c055a2e6d 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md @@ -1,8 +1,8 @@ --- id: 64fb29348a60361ccd45c1e2 -title: Step 55 +title: Step 54 challengeType: 0 -dashedName: step-55 +dashedName: step-54 --- # --description-- @@ -304,7 +304,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md index 42de45bd160..349a1226355 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md @@ -1,8 +1,8 @@ --- id: 64fefebad99209211ec30537 -title: Step 56 +title: Step 55 challengeType: 0 -dashedName: step-56 +dashedName: step-55 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md index 42d6ed6ae2d..8c8c80db659 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md @@ -1,8 +1,8 @@ --- id: 64ff0313700dad264d19dfe4 -title: Step 57 +title: Step 56 challengeType: 0 -dashedName: step-57 +dashedName: step-56 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md index 1ca2784a3cc..89f8f555a63 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md @@ -1,8 +1,8 @@ --- id: 64ff04cc33779427a6412449 -title: Step 58 +title: Step 57 challengeType: 0 -dashedName: step-58 +dashedName: step-57 --- # --description-- @@ -296,7 +296,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md index 49f4240707d..ae847c9b4ab 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md @@ -1,8 +1,8 @@ --- id: 64ff068e0426eb288874ed79 -title: Step 59 +title: Step 58 challengeType: 0 -dashedName: step-59 +dashedName: step-58 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md index df55f88ac55..a69e6d3f98a 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md @@ -1,8 +1,8 @@ --- id: 64ff23daf176a92de95f24dc -title: Step 60 +title: Step 59 challengeType: 0 -dashedName: step-60 +dashedName: step-59 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md index 8f51f137e15..2d43ea0abaf 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md @@ -1,8 +1,8 @@ --- id: 64ff24b80431f62ec6b93f65 -title: Step 61 +title: Step 60 challengeType: 0 -dashedName: step-61 +dashedName: step-60 --- # --description-- @@ -286,7 +286,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md index 651b7fef4e1..defd194933a 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md @@ -1,8 +1,8 @@ --- id: 65003986d17d1e1865b269c0 -title: Step 62 +title: Step 61 challengeType: 0 -dashedName: step-62 +dashedName: step-61 --- # --description-- @@ -302,7 +302,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md index a0508d09fd1..1504db737a7 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md @@ -1,8 +1,8 @@ --- id: 650046832f92c01a35834bca -title: Step 63 +title: Step 62 challengeType: 0 -dashedName: step-63 +dashedName: step-62 --- # --description-- @@ -303,7 +303,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md index 0103dc8d732..2759f899e93 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md @@ -1,8 +1,8 @@ --- id: 650048b0764f9c1b798200e2 -title: Step 64 +title: Step 63 challengeType: 0 -dashedName: step-64 +dashedName: step-63 --- # --description-- @@ -290,7 +290,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md index a4b34f17043..304cbb31463 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md @@ -1,8 +1,8 @@ --- id: 65004ba581d03d1d5628b41c -title: Step 65 +title: Step 64 challengeType: 0 -dashedName: step-65 +dashedName: step-64 --- # --description-- @@ -23,8 +23,6 @@ In that example, if `arr` has a length greater than `0`, the code inside the `if Check if there's a task inside `taskData`, then call the `updateTaskContainer()` inside the `if` statement block. -With that, you've completed this project. - # --hints-- You should create an `if` statement with `(taskData.length)` as the condition. As a reminder, `0` is a falsy value. @@ -308,7 +306,6 @@ const taskData = JSON.parse(localStorage.getItem("data")) || []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, @@ -413,377 +410,3 @@ taskForm.addEventListener("submit", (e) => { addOrUpdateTask(); }); ``` - -# --solutions-- - -```html - - - - - - - - Learn localStorage by Building a Todo App - - - - -

-

Todo App

-
- - - -
-

Discard unsaved changes?

-
- - -
-
-
-
-
-
- - - - -``` - -```css -:root { - --white: #fff; - --light-grey: #f5f6f7; - --dark-grey: #0a0a23; - --yellow: #f1be32; - --golden-yellow: #feac32; -} - -*, -*::before, -*::after { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - background-color: var(--dark-grey); -} - -main { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -h1 { - color: var(--light-grey); - margin: 20px 0 40px 0; -} - -.todo-app { - background-color: var(--white); - width: 300px; - height: 350px; - border: 5px solid var(--yellow); - border-radius: 8px; - padding: 15px; - position: relative; - display: flex; - flex-direction: column; - gap: 10px; -} - -.btn { - cursor: pointer; - width: 100px; - margin: 10px; - color: var(--dark-grey); - background-color: var(--golden-yellow); - background-image: linear-gradient(#fecc4c, #ffac33); - border-color: var(--golden-yellow); - border-width: 3px; -} - -.btn:hover { - background-image: linear-gradient(#ffcc4c, #f89808); -} - -.large-btn { - width: 80%; - font-size: 1.2rem; - align-self: center; - justify-self: center; -} - -.close-task-form-btn { - background: none; - border: none; - cursor: pointer; -} - -.close-icon { - width: 20px; - height: 20px; -} - -.task-form { - display: flex; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - background-color: var(--white); - border-radius: 5px; - padding: 15px; - width: 300px; - height: 350px; - flex-direction: column; - justify-content: space-between; - overflow: auto; -} - -.task-form-header { - display: flex; - justify-content: flex-end; -} - -.task-form-body { - display: flex; - flex-direction: column; - justify-content: space-around; -} - -.task-form-footer { - display: flex; - justify-content: center; -} - -.task-form-label, -#title-input, -#date-input, -#description-input { - display: block; -} - -.task-form-label { - margin-bottom: 5px; - font-size: 1.3rem; - font-weight: bold; -} - -#title-input, -#date-input, -#description-input { - width: 100%; - margin-bottom: 10px; - padding: 2px; -} - -#confirm-close-dialog { - padding: 10px; - margin: 10px auto; - border-radius: 15px; -} - -.confirm-close-dialog-btn-container { - display: flex; - justify-content: center; - margin-top: 10px; -} - -.discard-message-text { - font-weight: bold; - font-size: 1.5rem; -} - -#tasks-container { - height: 100%; - overflow-y: auto; -} - -.task { - margin: 5px 0; -} - -.hidden { - display: none; -} - -@media (min-width: 576px) { - .todo-app, - .task-form { - width: 400px; - height: 450px; - } - - .task-form-label { - font-size: 1.5rem; - } - - #title-input, - #date-input { - height: 2rem; - } - - #title-input, - #date-input, - #description-input { - padding: 5px; - margin-bottom: 20px; - } -} -``` - -```js -const taskForm = document.getElementById("task-form"); -const confirmCloseDialog = document.getElementById("confirm-close-dialog"); -const openTaskFormBtn = document.getElementById("open-task-form-btn"); -const closeTaskFormBtn = document.getElementById("close-task-form-btn"); -const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); -const cancelBtn = document.getElementById("cancel-btn"); -const discardBtn = document.getElementById("discard-btn"); -const tasksContainer = document.getElementById("tasks-container"); -const titleInput = document.getElementById("title-input"); -const dateInput = document.getElementById("date-input"); -const descriptionInput = document.getElementById("description-input"); - -const taskData = JSON.parse(localStorage.getItem("data")) || []; -let currentTask = {}; - -const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; - const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); - const taskObj = { - id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, - title: titleInput.value, - date: dateInput.value, - description: descriptionInput.value, - }; - - if (dataArrIndex === -1) { - taskData.unshift(taskObj); - } else { - taskData[dataArrIndex] = taskObj; - } - - localStorage.setItem("data", JSON.stringify(taskData)); - updateTaskContainer() - reset() -}; - -const updateTaskContainer = () => { - tasksContainer.innerHTML = ""; - - taskData.forEach( - ({ id, title, date, description }) => { - (tasksContainer.innerHTML += ` -
-

Title: ${title}

-

Date: ${date}

-

Description: ${description}

- - -
- `) - } - ); -}; - - -const deleteTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - buttonEl.parentElement.remove(); - taskData.splice(dataArrIndex, 1); - localStorage.setItem("data", JSON.stringify(taskData)); -} - -const editTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - currentTask = taskData[dataArrIndex]; - - titleInput.value = currentTask.title; - dateInput.value = currentTask.date; - descriptionInput.value = currentTask.description; - - addOrUpdateTaskBtn.innerText = "Update Task"; - - - taskForm.classList.toggle("hidden"); -} - -const reset = () => { - titleInput.value = ""; - dateInput.value = ""; - descriptionInput.value = ""; - taskForm.classList.toggle("hidden"); - currentTask = {}; -} - -if (taskData.length) { - updateTaskContainer(); -} - -openTaskFormBtn.addEventListener("click", () => - taskForm.classList.toggle("hidden") -); - -closeTaskFormBtn.addEventListener("click", () => { - const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; - const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; - - if (formInputsContainValues && formInputValuesUpdated) { - confirmCloseDialog.showModal(); - } else { - reset(); - } -}); - -cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); - -discardBtn.addEventListener("click", () => { - confirmCloseDialog.close(); - reset() -}); - -taskForm.addEventListener("submit", (e) => { - e.preventDefault(); - - addOrUpdateTask(); -}); -``` diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md index 8a982fe77be..e1223fd9b03 100644 --- a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md @@ -7,7 +7,7 @@ dashedName: step-27 # --description-- -Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `"Description:"`. +Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `Description:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element with `${description}` as the text. assert.match(code, /

.*\$\{description\}<\/p>/) ``` -You should create a `strong` element with the text `"Description:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Description:` after the opening tag of your `p` element. ```js assert.match(code, /

Description:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md new file mode 100644 index 00000000000..8f2a57bf4e0 --- /dev/null +++ b/curriculum/challenges/portuguese/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md @@ -0,0 +1,774 @@ +--- +id: 6632420f81f3cc554a5e540b +title: Step 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +If you try to add a new task, edit that task, and then click on the `Add New Task` button, you will notice a bug. + +The form button will display the incorrect text of `"Update Task"` instead of `"Add Task"`. To fix this, you will need to assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText` inside your `reset` function. + +With that, you've completed this project. + +# --hints-- + +You should assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText`. + +```js +assert.match(code, /addOrUpdateTaskBtn\.innerText\s*=\s*('|")Add Task\1\s*/) +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +

+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + --fcc-editable-region-- + + --fcc-editable-region-- + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` + + +# --solutions-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +
+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + addOrUpdateTaskBtn.innerText = "Add Task"; + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` diff --git a/curriculum/challenges/portuguese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md b/curriculum/challenges/portuguese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md new file mode 100644 index 00000000000..1e918708d4c --- /dev/null +++ b/curriculum/challenges/portuguese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md @@ -0,0 +1,61 @@ +--- +id: 6619240f46cec8e04d77e03a +title: Basic Functions Exercise A +challengeType: 1 +dashedName: top-basic-functions-exercise-a +--- + +# --description-- + +Create a function that takes in an integer. This function should return the given `integer + 7` if the integer is less than `10`. If the integer is greater than or equal to `10`, it should return the given `integer - 3`. + +The name of the function should be `addOrSubtract`. + +# --hints-- + +You should have a function called `addOrSubtract`. + +```js +assert.isFunction(addOrSubtract); +``` + +Your function should take in an integer as an argument. + +```js +assert.match(addOrSubtract.toString(), /\s*addOrSubtract\(\s*\w+\s*\)/); +``` + +You should return the given integer + 7 if the integer is less than 10. + +```js +assert.strictEqual(addOrSubtract(5), 12); +``` + +You should return the given integer - 3 if the integer is greater than or equal to 10. + +```js +assert.strictEqual(addOrSubtract(10), 7); +``` + + + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function addOrSubtract(num) { + if (num < 10) { + return num + 7; + } else { + return num - 3; + } +} +``` diff --git a/curriculum/challenges/portuguese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md b/curriculum/challenges/portuguese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md new file mode 100644 index 00000000000..4dbba976428 --- /dev/null +++ b/curriculum/challenges/portuguese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md @@ -0,0 +1,47 @@ +--- +id: 661e131f068359c3ccf2f4d6 +title: Basic Functions Exercise B +challengeType: 1 +dashedName: top-basic-functions-exercise-b +--- + +# --description-- + +Write a function, named `multiply`, that takes two parameters and returns their product. + +# --hints-- + +You should have a function named `multiply`. + +```js +assert.isFunction(multiply); +``` + +Your function should take in two integers as arguments. + +```js +assert.match(multiply.toString(), /\s*multiply\(\s*\w+\s*,\s*\w+\s*\)/); +``` + +You should return the product of the two integers. + +```js +assert.strictEqual(multiply(10, 10), 100); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function multiply(a, b) { + return a * b; +} +``` diff --git a/curriculum/challenges/portuguese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md b/curriculum/challenges/portuguese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md new file mode 100644 index 00000000000..0c0640ae277 --- /dev/null +++ b/curriculum/challenges/portuguese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md @@ -0,0 +1,47 @@ +--- +id: 661e151f068359c3ccf2f4d7 +title: Basic Functions Exercise C +challengeType: 1 +dashedName: top-basic-functions-exercise-c +--- + +# --description-- + +Write a function, named `capitalize`, that takes a string as an parameter and returns a new string with the first letter capitalized. + +# --hints-- + +You should have a function named `capitalize`. + +```js +assert.isFunction(capitalize); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(capitalize.toString(), /\s*capitalize\(\s*\w+\s*\)/); +``` + +Your function should return a new string with the first letter capitalized. + +```js +assert.strictEqual(capitalize('sem'), 'Sem'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function capitalize(str) { + return str[0].toUpperCase() + str.slice(1); +} +``` diff --git a/curriculum/challenges/portuguese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md b/curriculum/challenges/portuguese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md new file mode 100644 index 00000000000..79d9031b2d9 --- /dev/null +++ b/curriculum/challenges/portuguese/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md @@ -0,0 +1,47 @@ +--- +id: 661e17c6068359c3ccf2f4d8 +title: Basic Functions Exercise D +challengeType: 1 +dashedName: top-basic-functions-exercise-d +--- + +# --description-- + +Write a function, named `lastLetter`, that takes a string as a parameter and returns the last letter of the string. + +# --hints-- + +You should have a function named `lastLetter`. + +```js +assert.isFunction(lastLetter); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(lastLetter.toString(), /\s*lastLetter\(\s*\w+\s*\)/); +``` + +You should return the last letter of the string. + +```js +assert.strictEqual(lastLetter('Sem'), 'm'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function lastLetter(str) { + return str[str.length - 1]; +} +``` diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index b1b54dda895..f5b7aaf7c32 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -39,7 +39,13 @@ Your `idToText` function should have an `id` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>/); ``` -You should assign `idToText` the result of calling the `.find()` method on your `cells` array. +Your `idToText` function should return the result of calling the `.find()` method on your `cells` array. Your callback function should use an implicit return. + +```js +assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); +``` + +Your `idToText` function should use an implicit return. ```js assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(/); @@ -57,12 +63,6 @@ Your callback function should have a `cell` parameter. assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>/); ``` -Your callback function should use an implicit return. - -```js -assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); -``` - Your callback function should return whether `cell.id` is strictly equal to `id`. ```js diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md index 6ea58bc46e0..59e5ad6294e 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md @@ -11,72 +11,48 @@ In your `highPrecedence` function, declare a `regex` variable. Assign it a regul Each number, and the operator, should be in separate capture groups. +Incorporate the regular expression you've defined into your `highPrecedence` function to test if the provided string `str` matches the pattern. Use the `test()` method on your `regex` variable and return the result. + # --hints-- + You should declare a `regex` variable in your `highPrecedence` function. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*(?:const|let|var)\s+regex/); + ``` You should use `const` to declare your `regex` variable. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex/); + ``` Your `regex` variable should be a regular expression. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\//); + ``` -Your `regex` should use a capture group. +Your highPrecedence should return `regex.test(str);` ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(/); +assert.match(code, /return\s+regex\.test\(str\);?/); + ``` -Your first capture group should use a character class. +Please enter a properly functioning regex. ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[/); -``` -Your first capture group should match any digit or a period. Use the special `\d` character class. +assert.strictEqual(highPrecedence("5*3"), true); -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]/); -``` - -Your first capture group should match the character class one or more times. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)/); -``` - -Your `regex` should use a second capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(/); -``` - -Your second capture group should match a `*` or `/` operator. Use a character class in the capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)/); -``` - -Your `regex` should use a third capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(/); -``` - -Your third capture group should be the same as your first capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)/); ``` # --seed-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md index 6311798060f..3ba875ffb40 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md @@ -1,8 +1,8 @@ --- id: 646d40c543943ec250039682 -title: Step 75 +title: Step 77 challengeType: 0 -dashedName: step-75 +dashedName: step-77 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md index 3a66e0d1799..04c2e896ab3 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md @@ -1,8 +1,8 @@ --- id: 646d40fe4b7b50c30c2b4cd8 -title: Step 76 +title: Step 78 challengeType: 0 -dashedName: step-76 +dashedName: step-78 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md index 9e4657a50f7..356e13ac467 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md @@ -1,8 +1,8 @@ --- id: 646d41e23b583fc3b8cc4579 -title: Step 77 +title: Step 79 challengeType: 0 -dashedName: step-77 +dashedName: step-79 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md index 14138e9ca93..fbdf249ccbe 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md @@ -1,8 +1,8 @@ --- id: 646d423fade4a9c4636acd13 -title: Step 78 +title: Step 80 challengeType: 0 -dashedName: step-78 +dashedName: step-80 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md index 78368ca5d37..7b929decac2 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md @@ -1,8 +1,8 @@ --- id: 646d42f58deb2fc52adc6611 -title: Step 79 +title: Step 81 challengeType: 0 -dashedName: step-79 +dashedName: step-81 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md index 7c817f3c473..6c03c828f8d 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md @@ -1,8 +1,8 @@ --- id: 646d43587d926bc5b6cb2e50 -title: Step 80 +title: Step 82 challengeType: 0 -dashedName: step-80 +dashedName: step-82 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md index e61b9a38b4a..ebfac0b9aeb 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md @@ -1,8 +1,8 @@ --- id: 646d448479c8fdc8dcec868c -title: Step 81 +title: Step 83 challengeType: 0 -dashedName: step-81 +dashedName: step-83 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md index 558cef71b0f..aa83fe34555 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md @@ -1,8 +1,8 @@ --- id: 646d44da986f2bc9b72f5fe2 -title: Step 82 +title: Step 84 challengeType: 0 -dashedName: step-82 +dashedName: step-84 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md index da034ff8cd9..21d28405f26 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md @@ -1,8 +1,8 @@ --- id: 646d451c2e44afca71b67818 -title: Step 83 +title: Step 85 challengeType: 0 -dashedName: step-83 +dashedName: step-85 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md index 11e1632f84c..b8629fc2e12 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md @@ -1,8 +1,8 @@ --- id: 646d4554721d43cb19a68bc4 -title: Step 84 +title: Step 86 challengeType: 0 -dashedName: step-84 +dashedName: step-86 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md index 773d9dff52b..53a0f3b823b 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md @@ -1,8 +1,8 @@ --- id: 646d45b739da5ecbf830c108 -title: Step 85 +title: Step 87 challengeType: 0 -dashedName: step-85 +dashedName: step-87 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md index 99952a5bece..19849ef8c79 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md @@ -1,8 +1,8 @@ --- id: 646d45ee725632cca2555146 -title: Step 86 +title: Step 88 challengeType: 0 -dashedName: step-86 +dashedName: step-88 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md index 5eb843c3164..21236e19958 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md @@ -1,8 +1,8 @@ --- id: 646d4626420eeecd51f241c2 -title: Step 87 +title: Step 89 challengeType: 0 -dashedName: step-87 +dashedName: step-89 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md index 3ec60146d03..9277356624f 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md @@ -1,8 +1,8 @@ --- id: 646d467c6994f4ce0dc416a4 -title: Step 88 +title: Step 90 challengeType: 0 -dashedName: step-88 +dashedName: step-90 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md index 0144779f15e..43808a1fe26 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md @@ -1,8 +1,8 @@ --- id: 646d46c03e7d02cecb30f021 -title: Step 89 +title: Step 91 challengeType: 0 -dashedName: step-89 +dashedName: step-91 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md index de7fb664c3a..7926b0aa4e5 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md @@ -1,8 +1,8 @@ --- id: 646d4717a689e1cfa232e357 -title: Step 90 +title: Step 92 challengeType: 0 -dashedName: step-90 +dashedName: step-92 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md index 469bf574f9e..2c9733e01b0 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md @@ -1,8 +1,8 @@ --- id: 646d4769ba65f1d05ef6b634 -title: Step 91 +title: Step 93 challengeType: 0 -dashedName: step-91 +dashedName: step-93 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md index 124a786dab9..fd91e878fcd 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md @@ -1,8 +1,8 @@ --- id: 646d47c8f58107d10f1e5106 -title: Step 92 +title: Step 94 challengeType: 0 -dashedName: step-92 +dashedName: step-94 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md index dc4c70b62ac..db2a4e90437 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md @@ -1,8 +1,8 @@ --- id: 646d4813c17b37d1e261a566 -title: Step 93 +title: Step 95 challengeType: 0 -dashedName: step-93 +dashedName: step-95 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md index 449e0054421..7d8e9aa3122 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md @@ -1,8 +1,8 @@ --- id: 646d486aec20f7d2a581cc36 -title: Step 94 +title: Step 96 challengeType: 0 -dashedName: step-94 +dashedName: step-96 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md index 519590a84fa..96a39c72c8f 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md @@ -1,8 +1,8 @@ --- id: 646d48b936802fd34c3f05af -title: Step 95 +title: Step 97 challengeType: 0 -dashedName: step-95 +dashedName: step-97 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md index cc8b97da8c6..fd91d70e425 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md @@ -1,8 +1,8 @@ --- id: 646d498c8ebc31d3f753b22e -title: Step 96 +title: Step 98 challengeType: 0 -dashedName: step-96 +dashedName: step-98 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md index 0a62d2e9cc6..537acec2ad8 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md @@ -1,8 +1,8 @@ --- id: 646d49bfff9079d4b38df115 -title: Step 97 +title: Step 99 challengeType: 0 -dashedName: step-97 +dashedName: step-99 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md index 5efd22ab0b7..200c2e16ac6 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md @@ -1,8 +1,8 @@ --- id: 646d4a07a8fb14d55cd70e09 -title: Step 98 +title: Step 100 challengeType: 0 -dashedName: step-98 +dashedName: step-100 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md index ee241dee98e..51707a2bd52 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md @@ -1,8 +1,8 @@ --- id: 646d4a5b32a1cad6165df286 -title: Step 100 +title: Step 102 challengeType: 0 -dashedName: step-100 +dashedName: step-102 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md index 93ee83dcf49..8abcf6505fb 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md @@ -1,8 +1,8 @@ --- id: 646d4a8dbc04c6d6bb0001f8 -title: Step 101 +title: Step 103 challengeType: 0 -dashedName: step-101 +dashedName: step-103 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md index c380ecd405a..8093cab4152 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md @@ -1,8 +1,8 @@ --- id: 646d4ab9b3b4c5d74fdd2154 -title: Step 102 +title: Step 104 challengeType: 0 -dashedName: step-102 +dashedName: step-104 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md index 5457abbb3fd..4ec6876419d 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md @@ -1,8 +1,8 @@ --- id: 646d4b3d80ea98d824c8a4f9 -title: Step 103 +title: Step 105 challengeType: 0 -dashedName: step-103 +dashedName: step-105 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md index 41696356307..a2a6cc9edf4 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md @@ -1,8 +1,8 @@ --- id: 6491d38f5b09a021c4b5d5fe -title: Step 99 +title: Step 101 challengeType: 0 -dashedName: step-99 +dashedName: step-101 --- # --description-- diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md new file mode 100644 index 00000000000..7c2489b5b09 --- /dev/null +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md @@ -0,0 +1,159 @@ +--- +id: 661f48f412d7631a1d9c30e6 +title: Step 75 +challengeType: 0 +dashedName: step-75 +--- + +# --description-- + +You should use `console.log()` to print the result of calling the `highPrecedence` function with the string `"5*3"`. + +# --hints-- + +You should call `console.log()`. + +```js + +assert.match(code, /console\.log\(/); + +``` + +You should call your `highPrecedence` function. + +```js + +assert.match(code, /console\.log\(highPrecedence\(/); + + +``` + +Pass `5*3` as the argument + +```js + +assert.match(code, /console\.log\(highPrecedence\(["']5\*3["']\)\);?/); + +``` + + + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} + +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md new file mode 100644 index 00000000000..a36def51c9b --- /dev/null +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md @@ -0,0 +1,148 @@ +--- +id: 661f49650572031c6ebdb8e3 +title: Step 76 +challengeType: 0 +dashedName: step-76 +--- + +# --description-- + +Remove both the `console.log()` with your `highPrecedence` call, and the `return` statement from your `highPrecedence` function. + +# --hints-- + +Your code should not log the result of `highPrecedence("5*3")`. + +```js + +assert.notMatch(code, /console\.log\(highPrecedence\("5\*3"\)\)/); + +``` + +Your `highPrecedence` function should not return a value. + +```js + +assert.isUndefined(highPrecedence("5*3")); + +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} +console.log(highPrecedence("5*3")); +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md index 035126503c4..e90506c129f 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md @@ -14,6 +14,7 @@ For example, this code would assign the number `25` to the second element in the ```js let array = [1, 2, 3]; array[1] = 25; +console.log(array); // prints [1, 25, 3] ``` Update the **third** element of your `rows` array to be the number `10`. Then print the `rows` array to your console. diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md index 08b283f65e4..47b58025670 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md @@ -7,7 +7,7 @@ dashedName: step-25 # --description-- -Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `"Title:"`. +Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `Title:`. # --hints-- @@ -29,7 +29,7 @@ You should create a `strong` element after the opening tag of your `p` element. assert.match(code, /

/) ``` -Your `strong` element should have the text `"Title:"`. +Your `strong` element should have the text `Title:`. ```js assert.match(code, /

Title:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md index 6f104a6b68d..4535f1a4330 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md @@ -7,7 +7,7 @@ dashedName: step-26 # --description-- -Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `"Date:"`. +Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `Date:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element and interpolate `${date}` as the text. assert.match(code, /

.*\$\{date\}<\/p>/) ``` -You should create a `strong` element with the text `"Date:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Date:` after the opening tag of your `p` element. ```js assert.match(code, /

Date:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md index 03cba96db5c..1f8aa88d063 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md @@ -9,7 +9,7 @@ dashedName: step-28 To allow for task management, you need to include both a delete and an edit button for each task. -Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `"Edit"` and the text of the second button to `"Delete"`. +Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `Edit` and the text of the second button to `Delete`. # --hints-- @@ -19,7 +19,7 @@ You should create a `button` element of type `button`, a class `btn` and `"Edit" assert.match(code, /Edit<\/button/) ``` -You should create a `button` element of type `button` a class `btn` and `"Delete"` as the text, in that order. +You should create a `button` element of type `button` a class `btn` and `Delete` as the text, in that order. ```js assert.match(code, /Delete<\/button/) diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md index fd1945e43d0..1bca79335e1 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md @@ -1,8 +1,8 @@ --- id: 64fb1c4dc0feb219149a7c7d -title: Step 53 +title: Step 52 challengeType: 0 -dashedName: step-53 +dashedName: step-52 --- # --description-- @@ -307,7 +307,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md index 0c5aef4f9a2..cb787162942 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md @@ -1,8 +1,8 @@ --- id: 64fb285637fa1e1c222033e3 -title: Step 54 +title: Step 53 challengeType: 0 -dashedName: step-54 +dashedName: step-53 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md index 27538cc5ecf..53c055a2e6d 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md @@ -1,8 +1,8 @@ --- id: 64fb29348a60361ccd45c1e2 -title: Step 55 +title: Step 54 challengeType: 0 -dashedName: step-55 +dashedName: step-54 --- # --description-- @@ -304,7 +304,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md index 42de45bd160..349a1226355 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md @@ -1,8 +1,8 @@ --- id: 64fefebad99209211ec30537 -title: Step 56 +title: Step 55 challengeType: 0 -dashedName: step-56 +dashedName: step-55 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md index 42d6ed6ae2d..8c8c80db659 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md @@ -1,8 +1,8 @@ --- id: 64ff0313700dad264d19dfe4 -title: Step 57 +title: Step 56 challengeType: 0 -dashedName: step-57 +dashedName: step-56 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md index 1ca2784a3cc..89f8f555a63 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md @@ -1,8 +1,8 @@ --- id: 64ff04cc33779427a6412449 -title: Step 58 +title: Step 57 challengeType: 0 -dashedName: step-58 +dashedName: step-57 --- # --description-- @@ -296,7 +296,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md index 49f4240707d..ae847c9b4ab 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md @@ -1,8 +1,8 @@ --- id: 64ff068e0426eb288874ed79 -title: Step 59 +title: Step 58 challengeType: 0 -dashedName: step-59 +dashedName: step-58 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md index df55f88ac55..a69e6d3f98a 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md @@ -1,8 +1,8 @@ --- id: 64ff23daf176a92de95f24dc -title: Step 60 +title: Step 59 challengeType: 0 -dashedName: step-60 +dashedName: step-59 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md index 8f51f137e15..2d43ea0abaf 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md @@ -1,8 +1,8 @@ --- id: 64ff24b80431f62ec6b93f65 -title: Step 61 +title: Step 60 challengeType: 0 -dashedName: step-61 +dashedName: step-60 --- # --description-- @@ -286,7 +286,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md index 651b7fef4e1..defd194933a 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md @@ -1,8 +1,8 @@ --- id: 65003986d17d1e1865b269c0 -title: Step 62 +title: Step 61 challengeType: 0 -dashedName: step-62 +dashedName: step-61 --- # --description-- @@ -302,7 +302,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md index a0508d09fd1..1504db737a7 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md @@ -1,8 +1,8 @@ --- id: 650046832f92c01a35834bca -title: Step 63 +title: Step 62 challengeType: 0 -dashedName: step-63 +dashedName: step-62 --- # --description-- @@ -303,7 +303,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md index 0103dc8d732..2759f899e93 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md @@ -1,8 +1,8 @@ --- id: 650048b0764f9c1b798200e2 -title: Step 64 +title: Step 63 challengeType: 0 -dashedName: step-64 +dashedName: step-63 --- # --description-- @@ -290,7 +290,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md index a4b34f17043..304cbb31463 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md @@ -1,8 +1,8 @@ --- id: 65004ba581d03d1d5628b41c -title: Step 65 +title: Step 64 challengeType: 0 -dashedName: step-65 +dashedName: step-64 --- # --description-- @@ -23,8 +23,6 @@ In that example, if `arr` has a length greater than `0`, the code inside the `if Check if there's a task inside `taskData`, then call the `updateTaskContainer()` inside the `if` statement block. -With that, you've completed this project. - # --hints-- You should create an `if` statement with `(taskData.length)` as the condition. As a reminder, `0` is a falsy value. @@ -308,7 +306,6 @@ const taskData = JSON.parse(localStorage.getItem("data")) || []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, @@ -413,377 +410,3 @@ taskForm.addEventListener("submit", (e) => { addOrUpdateTask(); }); ``` - -# --solutions-- - -```html - - - - - - - - Learn localStorage by Building a Todo App - - - - -

-

Todo App

-
- - - -
-

Discard unsaved changes?

-
- - -
-
-
-
-
-
- - - - -``` - -```css -:root { - --white: #fff; - --light-grey: #f5f6f7; - --dark-grey: #0a0a23; - --yellow: #f1be32; - --golden-yellow: #feac32; -} - -*, -*::before, -*::after { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - background-color: var(--dark-grey); -} - -main { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -h1 { - color: var(--light-grey); - margin: 20px 0 40px 0; -} - -.todo-app { - background-color: var(--white); - width: 300px; - height: 350px; - border: 5px solid var(--yellow); - border-radius: 8px; - padding: 15px; - position: relative; - display: flex; - flex-direction: column; - gap: 10px; -} - -.btn { - cursor: pointer; - width: 100px; - margin: 10px; - color: var(--dark-grey); - background-color: var(--golden-yellow); - background-image: linear-gradient(#fecc4c, #ffac33); - border-color: var(--golden-yellow); - border-width: 3px; -} - -.btn:hover { - background-image: linear-gradient(#ffcc4c, #f89808); -} - -.large-btn { - width: 80%; - font-size: 1.2rem; - align-self: center; - justify-self: center; -} - -.close-task-form-btn { - background: none; - border: none; - cursor: pointer; -} - -.close-icon { - width: 20px; - height: 20px; -} - -.task-form { - display: flex; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - background-color: var(--white); - border-radius: 5px; - padding: 15px; - width: 300px; - height: 350px; - flex-direction: column; - justify-content: space-between; - overflow: auto; -} - -.task-form-header { - display: flex; - justify-content: flex-end; -} - -.task-form-body { - display: flex; - flex-direction: column; - justify-content: space-around; -} - -.task-form-footer { - display: flex; - justify-content: center; -} - -.task-form-label, -#title-input, -#date-input, -#description-input { - display: block; -} - -.task-form-label { - margin-bottom: 5px; - font-size: 1.3rem; - font-weight: bold; -} - -#title-input, -#date-input, -#description-input { - width: 100%; - margin-bottom: 10px; - padding: 2px; -} - -#confirm-close-dialog { - padding: 10px; - margin: 10px auto; - border-radius: 15px; -} - -.confirm-close-dialog-btn-container { - display: flex; - justify-content: center; - margin-top: 10px; -} - -.discard-message-text { - font-weight: bold; - font-size: 1.5rem; -} - -#tasks-container { - height: 100%; - overflow-y: auto; -} - -.task { - margin: 5px 0; -} - -.hidden { - display: none; -} - -@media (min-width: 576px) { - .todo-app, - .task-form { - width: 400px; - height: 450px; - } - - .task-form-label { - font-size: 1.5rem; - } - - #title-input, - #date-input { - height: 2rem; - } - - #title-input, - #date-input, - #description-input { - padding: 5px; - margin-bottom: 20px; - } -} -``` - -```js -const taskForm = document.getElementById("task-form"); -const confirmCloseDialog = document.getElementById("confirm-close-dialog"); -const openTaskFormBtn = document.getElementById("open-task-form-btn"); -const closeTaskFormBtn = document.getElementById("close-task-form-btn"); -const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); -const cancelBtn = document.getElementById("cancel-btn"); -const discardBtn = document.getElementById("discard-btn"); -const tasksContainer = document.getElementById("tasks-container"); -const titleInput = document.getElementById("title-input"); -const dateInput = document.getElementById("date-input"); -const descriptionInput = document.getElementById("description-input"); - -const taskData = JSON.parse(localStorage.getItem("data")) || []; -let currentTask = {}; - -const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; - const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); - const taskObj = { - id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, - title: titleInput.value, - date: dateInput.value, - description: descriptionInput.value, - }; - - if (dataArrIndex === -1) { - taskData.unshift(taskObj); - } else { - taskData[dataArrIndex] = taskObj; - } - - localStorage.setItem("data", JSON.stringify(taskData)); - updateTaskContainer() - reset() -}; - -const updateTaskContainer = () => { - tasksContainer.innerHTML = ""; - - taskData.forEach( - ({ id, title, date, description }) => { - (tasksContainer.innerHTML += ` -
-

Title: ${title}

-

Date: ${date}

-

Description: ${description}

- - -
- `) - } - ); -}; - - -const deleteTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - buttonEl.parentElement.remove(); - taskData.splice(dataArrIndex, 1); - localStorage.setItem("data", JSON.stringify(taskData)); -} - -const editTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - currentTask = taskData[dataArrIndex]; - - titleInput.value = currentTask.title; - dateInput.value = currentTask.date; - descriptionInput.value = currentTask.description; - - addOrUpdateTaskBtn.innerText = "Update Task"; - - - taskForm.classList.toggle("hidden"); -} - -const reset = () => { - titleInput.value = ""; - dateInput.value = ""; - descriptionInput.value = ""; - taskForm.classList.toggle("hidden"); - currentTask = {}; -} - -if (taskData.length) { - updateTaskContainer(); -} - -openTaskFormBtn.addEventListener("click", () => - taskForm.classList.toggle("hidden") -); - -closeTaskFormBtn.addEventListener("click", () => { - const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; - const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; - - if (formInputsContainValues && formInputValuesUpdated) { - confirmCloseDialog.showModal(); - } else { - reset(); - } -}); - -cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); - -discardBtn.addEventListener("click", () => { - confirmCloseDialog.close(); - reset() -}); - -taskForm.addEventListener("submit", (e) => { - e.preventDefault(); - - addOrUpdateTask(); -}); -``` diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md index 8a982fe77be..e1223fd9b03 100644 --- a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md @@ -7,7 +7,7 @@ dashedName: step-27 # --description-- -Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `"Description:"`. +Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `Description:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element with `${description}` as the text. assert.match(code, /

.*\$\{description\}<\/p>/) ``` -You should create a `strong` element with the text `"Description:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Description:` after the opening tag of your `p` element. ```js assert.match(code, /

Description:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md new file mode 100644 index 00000000000..8f2a57bf4e0 --- /dev/null +++ b/curriculum/challenges/swahili/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md @@ -0,0 +1,774 @@ +--- +id: 6632420f81f3cc554a5e540b +title: Step 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +If you try to add a new task, edit that task, and then click on the `Add New Task` button, you will notice a bug. + +The form button will display the incorrect text of `"Update Task"` instead of `"Add Task"`. To fix this, you will need to assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText` inside your `reset` function. + +With that, you've completed this project. + +# --hints-- + +You should assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText`. + +```js +assert.match(code, /addOrUpdateTaskBtn\.innerText\s*=\s*('|")Add Task\1\s*/) +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +

+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + --fcc-editable-region-- + + --fcc-editable-region-- + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` + + +# --solutions-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +
+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + addOrUpdateTaskBtn.innerText = "Add Task"; + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` diff --git a/curriculum/challenges/swahili/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md b/curriculum/challenges/swahili/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md new file mode 100644 index 00000000000..1e918708d4c --- /dev/null +++ b/curriculum/challenges/swahili/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md @@ -0,0 +1,61 @@ +--- +id: 6619240f46cec8e04d77e03a +title: Basic Functions Exercise A +challengeType: 1 +dashedName: top-basic-functions-exercise-a +--- + +# --description-- + +Create a function that takes in an integer. This function should return the given `integer + 7` if the integer is less than `10`. If the integer is greater than or equal to `10`, it should return the given `integer - 3`. + +The name of the function should be `addOrSubtract`. + +# --hints-- + +You should have a function called `addOrSubtract`. + +```js +assert.isFunction(addOrSubtract); +``` + +Your function should take in an integer as an argument. + +```js +assert.match(addOrSubtract.toString(), /\s*addOrSubtract\(\s*\w+\s*\)/); +``` + +You should return the given integer + 7 if the integer is less than 10. + +```js +assert.strictEqual(addOrSubtract(5), 12); +``` + +You should return the given integer - 3 if the integer is greater than or equal to 10. + +```js +assert.strictEqual(addOrSubtract(10), 7); +``` + + + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function addOrSubtract(num) { + if (num < 10) { + return num + 7; + } else { + return num - 3; + } +} +``` diff --git a/curriculum/challenges/swahili/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md b/curriculum/challenges/swahili/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md new file mode 100644 index 00000000000..4dbba976428 --- /dev/null +++ b/curriculum/challenges/swahili/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md @@ -0,0 +1,47 @@ +--- +id: 661e131f068359c3ccf2f4d6 +title: Basic Functions Exercise B +challengeType: 1 +dashedName: top-basic-functions-exercise-b +--- + +# --description-- + +Write a function, named `multiply`, that takes two parameters and returns their product. + +# --hints-- + +You should have a function named `multiply`. + +```js +assert.isFunction(multiply); +``` + +Your function should take in two integers as arguments. + +```js +assert.match(multiply.toString(), /\s*multiply\(\s*\w+\s*,\s*\w+\s*\)/); +``` + +You should return the product of the two integers. + +```js +assert.strictEqual(multiply(10, 10), 100); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function multiply(a, b) { + return a * b; +} +``` diff --git a/curriculum/challenges/swahili/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md b/curriculum/challenges/swahili/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md new file mode 100644 index 00000000000..0c0640ae277 --- /dev/null +++ b/curriculum/challenges/swahili/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md @@ -0,0 +1,47 @@ +--- +id: 661e151f068359c3ccf2f4d7 +title: Basic Functions Exercise C +challengeType: 1 +dashedName: top-basic-functions-exercise-c +--- + +# --description-- + +Write a function, named `capitalize`, that takes a string as an parameter and returns a new string with the first letter capitalized. + +# --hints-- + +You should have a function named `capitalize`. + +```js +assert.isFunction(capitalize); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(capitalize.toString(), /\s*capitalize\(\s*\w+\s*\)/); +``` + +Your function should return a new string with the first letter capitalized. + +```js +assert.strictEqual(capitalize('sem'), 'Sem'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function capitalize(str) { + return str[0].toUpperCase() + str.slice(1); +} +``` diff --git a/curriculum/challenges/swahili/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md b/curriculum/challenges/swahili/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md new file mode 100644 index 00000000000..79d9031b2d9 --- /dev/null +++ b/curriculum/challenges/swahili/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md @@ -0,0 +1,47 @@ +--- +id: 661e17c6068359c3ccf2f4d8 +title: Basic Functions Exercise D +challengeType: 1 +dashedName: top-basic-functions-exercise-d +--- + +# --description-- + +Write a function, named `lastLetter`, that takes a string as a parameter and returns the last letter of the string. + +# --hints-- + +You should have a function named `lastLetter`. + +```js +assert.isFunction(lastLetter); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(lastLetter.toString(), /\s*lastLetter\(\s*\w+\s*\)/); +``` + +You should return the last letter of the string. + +```js +assert.strictEqual(lastLetter('Sem'), 'm'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function lastLetter(str) { + return str[str.length - 1]; +} +``` diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md index 122acf74060..bbc1a5e6a7c 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6449842c6f6c84261075e4c9.md @@ -39,7 +39,13 @@ assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>/); ``` -You should assign `idToText` the result of calling the `.find()` method on your `cells` array. +Your `idToText` function should return the result of calling the `.find()` method on your `cells` array. Функція зворотного виклику має використати неявне повернення. + +```js +assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); +``` + +Your `idToText` function should use an implicit return. ```js assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(/); @@ -57,12 +63,6 @@ assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s assert.match(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>/); ``` -Функція зворотного виклику має використати неявне повернення. - -```js -assert.notMatch(code, /const\s+evalFormula\s*=\s*\(\s*x\s*,\s*cells\s*\)\s*=>\s*{\s*const\s+idToText\s*=\s*(\(\s*id\s*\)|id)\s*=>\s*cells\.find\(\s*(\(\s*cell\s*\)|cell)\s*=>\s*\{/); -``` - Your callback function should return whether `cell.id` is strictly equal to `id`. ```js diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md index 48374f9c51c..5d7e3cf778d 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d404259f512c1a9e86ac1.md @@ -11,72 +11,48 @@ In your `highPrecedence` function, declare a `regex` variable. Assign it a regul Each number, and the operator, should be in separate capture groups. +Incorporate the regular expression you've defined into your `highPrecedence` function to test if the provided string `str` matches the pattern. Use the `test()` method on your `regex` variable and return the result. + # --hints-- + Оголосіть змінну `regex` у функції `highPrecedence`. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*(?:const|let|var)\s+regex/); + ``` Використайте `const`, щоб оголосити змінну `regex`. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex/); + ``` Змінна `regex` має бути регулярним виразом. ```js + assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\//); + ``` -Your `regex` should use a capture group. +Your highPrecedence should return `regex.test(str);` ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(/); +assert.match(code, /return\s+regex\.test\(str\);?/); + ``` -Your first capture group should use a character class. +Please enter a properly functioning regex. ```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[/); -``` -Your first capture group should match any digit or a period. Use the special `\d` character class. +assert.strictEqual(highPrecedence("5*3"), true); -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]/); -``` - -Your first capture group should match the character class one or more times. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)/); -``` - -Your `regex` should use a second capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(/); -``` - -Your second capture group should match a `*` or `/` operator. Use a character class in the capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)/); -``` - -Your `regex` should use a third capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(/); -``` - -Your third capture group should be the same as your first capture group. - -```js -assert.match(code, /const\s+highPrecedence\s*=\s*(\(\s*str\s*\)|str)\s*=>\s*{\s*const\s+regex\s*=\s*\/\(\[(?:\\d\.|\.\\d)\]\+\)\(\[(?:\*\\\/|\\\/*)\]\)\(\[(?:\\d\.|\.\\d)\]\+\)/); ``` # --seed-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md index 24d33825e50..dcebf61b9fb 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40c543943ec250039682.md @@ -1,8 +1,8 @@ --- id: 646d40c543943ec250039682 -title: Крок 75 +title: Step 77 challengeType: 0 -dashedName: step-75 +dashedName: step-77 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md index 22b997b66d1..29941b77f08 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d40fe4b7b50c30c2b4cd8.md @@ -1,8 +1,8 @@ --- id: 646d40fe4b7b50c30c2b4cd8 -title: Крок 76 +title: Step 78 challengeType: 0 -dashedName: step-76 +dashedName: step-78 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md index 27d8c1c1399..1629616b1df 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d41e23b583fc3b8cc4579.md @@ -1,8 +1,8 @@ --- id: 646d41e23b583fc3b8cc4579 -title: Крок 77 +title: Step 79 challengeType: 0 -dashedName: step-77 +dashedName: step-79 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md index 66427e1ce07..b60f307b4f2 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d423fade4a9c4636acd13.md @@ -1,8 +1,8 @@ --- id: 646d423fade4a9c4636acd13 -title: Крок 78 +title: Step 80 challengeType: 0 -dashedName: step-78 +dashedName: step-80 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md index d0cdd784a09..a6b207fe954 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d42f58deb2fc52adc6611.md @@ -1,8 +1,8 @@ --- id: 646d42f58deb2fc52adc6611 -title: Крок 79 +title: Step 81 challengeType: 0 -dashedName: step-79 +dashedName: step-81 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md index 9c5098cbc95..357d508a6d5 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d43587d926bc5b6cb2e50.md @@ -1,8 +1,8 @@ --- id: 646d43587d926bc5b6cb2e50 -title: Крок 80 +title: Step 82 challengeType: 0 -dashedName: step-80 +dashedName: step-82 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md index 84a7c18bbde..198cfeddca7 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d448479c8fdc8dcec868c.md @@ -1,8 +1,8 @@ --- id: 646d448479c8fdc8dcec868c -title: Крок 81 +title: Step 83 challengeType: 0 -dashedName: step-81 +dashedName: step-83 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md index a18dfdb1f45..d8d83eaeba1 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d44da986f2bc9b72f5fe2.md @@ -1,8 +1,8 @@ --- id: 646d44da986f2bc9b72f5fe2 -title: Крок 82 +title: Step 84 challengeType: 0 -dashedName: step-82 +dashedName: step-84 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md index fe5a83d3943..fc4fd071b05 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d451c2e44afca71b67818.md @@ -1,8 +1,8 @@ --- id: 646d451c2e44afca71b67818 -title: Крок 83 +title: Step 85 challengeType: 0 -dashedName: step-83 +dashedName: step-85 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md index 9fab0c946c9..410c7764312 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4554721d43cb19a68bc4.md @@ -1,8 +1,8 @@ --- id: 646d4554721d43cb19a68bc4 -title: Крок 84 +title: Step 86 challengeType: 0 -dashedName: step-84 +dashedName: step-86 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md index f68a0af759a..fece7dbccdc 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45b739da5ecbf830c108.md @@ -1,8 +1,8 @@ --- id: 646d45b739da5ecbf830c108 -title: Крок 85 +title: Step 87 challengeType: 0 -dashedName: step-85 +dashedName: step-87 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md index 761277f2a36..af5834889c9 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d45ee725632cca2555146.md @@ -1,8 +1,8 @@ --- id: 646d45ee725632cca2555146 -title: Крок 86 +title: Step 88 challengeType: 0 -dashedName: step-86 +dashedName: step-88 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md index 85f9d69fea1..3ca39680e5e 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4626420eeecd51f241c2.md @@ -1,8 +1,8 @@ --- id: 646d4626420eeecd51f241c2 -title: Крок 87 +title: Step 89 challengeType: 0 -dashedName: step-87 +dashedName: step-89 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md index bb98267e434..fa74016c649 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d467c6994f4ce0dc416a4.md @@ -1,8 +1,8 @@ --- id: 646d467c6994f4ce0dc416a4 -title: Крок 88 +title: Step 90 challengeType: 0 -dashedName: step-88 +dashedName: step-90 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md index 14f8fccf872..a4d91cf86e4 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d46c03e7d02cecb30f021.md @@ -1,8 +1,8 @@ --- id: 646d46c03e7d02cecb30f021 -title: Крок 89 +title: Step 91 challengeType: 0 -dashedName: step-89 +dashedName: step-91 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md index a39c8a3a081..16eac2b9ac6 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4717a689e1cfa232e357.md @@ -1,8 +1,8 @@ --- id: 646d4717a689e1cfa232e357 -title: Крок 90 +title: Step 92 challengeType: 0 -dashedName: step-90 +dashedName: step-92 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md index 3653fac6892..2c9733e01b0 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4769ba65f1d05ef6b634.md @@ -1,8 +1,8 @@ --- id: 646d4769ba65f1d05ef6b634 -title: Крок 91 +title: Step 93 challengeType: 0 -dashedName: step-91 +dashedName: step-93 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md index c6c330448e2..24c27ef6d1f 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d47c8f58107d10f1e5106.md @@ -1,8 +1,8 @@ --- id: 646d47c8f58107d10f1e5106 -title: Крок 92 +title: Step 94 challengeType: 0 -dashedName: step-92 +dashedName: step-94 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md index 7a334eafd2b..de773fb9291 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4813c17b37d1e261a566.md @@ -1,8 +1,8 @@ --- id: 646d4813c17b37d1e261a566 -title: Крок 93 +title: Step 95 challengeType: 0 -dashedName: step-93 +dashedName: step-95 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md index a72fad04c27..7d8e9aa3122 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d486aec20f7d2a581cc36.md @@ -1,8 +1,8 @@ --- id: 646d486aec20f7d2a581cc36 -title: Крок 94 +title: Step 96 challengeType: 0 -dashedName: step-94 +dashedName: step-96 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md index e3a85cfaace..cac3011dc72 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d48b936802fd34c3f05af.md @@ -1,8 +1,8 @@ --- id: 646d48b936802fd34c3f05af -title: Крок 95 +title: Step 97 challengeType: 0 -dashedName: step-95 +dashedName: step-97 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md index 132d306ea58..ec20eb94920 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d498c8ebc31d3f753b22e.md @@ -1,8 +1,8 @@ --- id: 646d498c8ebc31d3f753b22e -title: Крок 96 +title: Step 98 challengeType: 0 -dashedName: step-96 +dashedName: step-98 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md index 4996b696517..8681e4154ca 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d49bfff9079d4b38df115.md @@ -1,8 +1,8 @@ --- id: 646d49bfff9079d4b38df115 -title: Крок 97 +title: Step 99 challengeType: 0 -dashedName: step-97 +dashedName: step-99 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md index 28b6ff5ea4e..71179e09e30 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a07a8fb14d55cd70e09.md @@ -1,8 +1,8 @@ --- id: 646d4a07a8fb14d55cd70e09 -title: Крок 98 +title: Step 100 challengeType: 0 -dashedName: step-98 +dashedName: step-100 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md index 612e78ea1f6..58e725e5b83 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a5b32a1cad6165df286.md @@ -1,8 +1,8 @@ --- id: 646d4a5b32a1cad6165df286 -title: Крок 100 +title: Step 102 challengeType: 0 -dashedName: step-100 +dashedName: step-102 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md index e43d9e1d409..09fa6e09302 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4a8dbc04c6d6bb0001f8.md @@ -1,8 +1,8 @@ --- id: 646d4a8dbc04c6d6bb0001f8 -title: Крок 101 +title: Step 103 challengeType: 0 -dashedName: step-101 +dashedName: step-103 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md index a9211ff004b..d45b098a9f0 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4ab9b3b4c5d74fdd2154.md @@ -1,8 +1,8 @@ --- id: 646d4ab9b3b4c5d74fdd2154 -title: Крок 102 +title: Step 104 challengeType: 0 -dashedName: step-102 +dashedName: step-104 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md index 44cd60f0485..d4a39cfe678 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/646d4b3d80ea98d824c8a4f9.md @@ -1,8 +1,8 @@ --- id: 646d4b3d80ea98d824c8a4f9 -title: Крок 103 +title: Step 105 challengeType: 0 -dashedName: step-103 +dashedName: step-105 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md index db4e6525c61..8f792e97252 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/6491d38f5b09a021c4b5d5fe.md @@ -1,8 +1,8 @@ --- id: 6491d38f5b09a021c4b5d5fe -title: Крок 99 +title: Step 101 challengeType: 0 -dashedName: step-99 +dashedName: step-101 --- # --description-- diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md new file mode 100644 index 00000000000..7c2489b5b09 --- /dev/null +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f48f412d7631a1d9c30e6.md @@ -0,0 +1,159 @@ +--- +id: 661f48f412d7631a1d9c30e6 +title: Step 75 +challengeType: 0 +dashedName: step-75 +--- + +# --description-- + +You should use `console.log()` to print the result of calling the `highPrecedence` function with the string `"5*3"`. + +# --hints-- + +You should call `console.log()`. + +```js + +assert.match(code, /console\.log\(/); + +``` + +You should call your `highPrecedence` function. + +```js + +assert.match(code, /console\.log\(highPrecedence\(/); + + +``` + +Pass `5*3` as the argument + +```js + +assert.match(code, /console\.log\(highPrecedence\(["']5\*3["']\)\);?/); + +``` + + + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} + +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md new file mode 100644 index 00000000000..a36def51c9b --- /dev/null +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-functional-programming-by-building-a-spreadsheet/661f49650572031c6ebdb8e3.md @@ -0,0 +1,148 @@ +--- +id: 661f49650572031c6ebdb8e3 +title: Step 76 +challengeType: 0 +dashedName: step-76 +--- + +# --description-- + +Remove both the `console.log()` with your `highPrecedence` call, and the `return` statement from your `highPrecedence` function. + +# --hints-- + +Your code should not log the result of `highPrecedence("5*3")`. + +```js + +assert.notMatch(code, /console\.log\(highPrecedence\("5\*3"\)\)/); + +``` + +Your `highPrecedence` function should not return a value. + +```js + +assert.isUndefined(highPrecedence("5*3")); + +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + Functional Programming Spreadsheet + + +
+
+
+ + + +``` + +```css +#container { + display: grid; + grid-template-columns: 50px repeat(10, 200px); + grid-template-rows: repeat(11, 30px); +} + +.label { + background-color: lightgray; + text-align: center; + vertical-align: middle; + line-height: 30px; +} +``` + +```js +const infixToFunction = { + "+": (x, y) => x + y, + "-": (x, y) => x - y, + "*": (x, y) => x * y, + "/": (x, y) => x / y, +} + +const infixEval = (str, regex) => str.replace(regex, (_match, arg1, operator, arg2) => infixToFunction[operator](parseFloat(arg1), parseFloat(arg2))); + +--fcc-editable-region-- +const highPrecedence = str => { + const regex = /([\d.]+)([*\/])([\d.]+)/; + return regex.test(str); +} +console.log(highPrecedence("5*3")); +--fcc-editable-region-- + +const isEven = num => num % 2 === 0; +const sum = nums => nums.reduce((acc, el) => acc + el, 0); +const average = nums => sum(nums) / nums.length; + +const median = nums => { + const sorted = nums.slice().sort((a, b) => a - b); + const length = sorted.length; + const middle = length / 2 - 1; + return isEven(length) + ? average([sorted[middle], sorted[middle + 1]]) + : sorted[Math.ceil(middle)]; +} + +const spreadsheetFunctions = { + sum, + average, + median +} + +const range = (start, end) => Array(end - start + 1).fill(start).map((element, index) => element + index); +const charRange = (start, end) => range(start.charCodeAt(0), end.charCodeAt(0)).map(code => String.fromCharCode(code)); + +const evalFormula = (x, cells) => { + const idToText = id => cells.find(cell => cell.id === id).value; + const rangeRegex = /([A-J])([1-9][0-9]?):([A-J])([1-9][0-9]?)/gi; + const rangeFromString = (num1, num2) => range(parseInt(num1), parseInt(num2)); + const elemValue = num => character => idToText(character + num); + const addCharacters = character1 => character2 => num => charRange(character1, character2).map(elemValue(num)); + const rangeExpanded = x.replace(rangeRegex, (_match, char1, num1, char2, num2) => rangeFromString(num1, num2).map(addCharacters(char1)(char2))); + const cellRegex = /[A-J][1-9][0-9]?/gi; + const cellExpanded = rangeExpanded.replace(cellRegex, match => idToText(match.toUpperCase())); +} + +window.onload = () => { + const container = document.getElementById("container"); + const createLabel = (name) => { + const label = document.createElement("div"); + label.className = "label"; + label.textContent = name; + container.appendChild(label); + } + const letters = charRange("A", "J"); + letters.forEach(createLabel); + range(1, 99).forEach(number => { + createLabel(number); + letters.forEach(letter => { + const input = document.createElement("input"); + input.type = "text"; + input.id = letter + number; + input.ariaLabel = letter + number; + input.onchange = update; + container.appendChild(input); + }) + }) +} + +const update = event => { + const element = event.target; + const value = element.value.replace(/\s/g, ""); + if (!value.includes(element.id) && value.startsWith('=')) { + + } +} +``` diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md index 035126503c4..e90506c129f 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-introductory-javascript-by-building-a-pyramid-generator/660f07d231941bc11719f664.md @@ -14,6 +14,7 @@ For example, this code would assign the number `25` to the second element in the ```js let array = [1, 2, 3]; array[1] = 25; +console.log(array); // prints [1, 25, 3] ``` Update the **third** element of your `rows` array to be the number `10`. Then print the `rows` array to your console. diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md index 08b283f65e4..47b58025670 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec94f0de20c086e09b0fc3.md @@ -7,7 +7,7 @@ dashedName: step-25 # --description-- -Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `"Title:"`. +Create a `p` element and use template strings to set its content to the `title` you destructured. Right before the content of the `p` element, create a `strong` element with the text `Title:`. # --hints-- @@ -29,7 +29,7 @@ You should create a `strong` element after the opening tag of your `p` element. assert.match(code, /

/) ``` -Your `strong` element should have the text `"Title:"`. +Your `strong` element should have the text `Title:`. ```js assert.match(code, /

Title:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md index 6f104a6b68d..4535f1a4330 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec959a76336c8767f5cd4d.md @@ -7,7 +7,7 @@ dashedName: step-26 # --description-- -Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `"Date:"`. +Similarly to the previous step, create another `p` element, and interpolate the `date` you destructured as the text content. Inside this paragraph, create a `strong` element with the text `Date:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element and interpolate `${date}` as the text. assert.match(code, /

.*\$\{date\}<\/p>/) ``` -You should create a `strong` element with the text `"Date:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Date:` after the opening tag of your `p` element. ```js assert.match(code, /

Date:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md index 03cba96db5c..1f8aa88d063 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ec96761156a187ed32b274.md @@ -9,7 +9,7 @@ dashedName: step-28 To allow for task management, you need to include both a delete and an edit button for each task. -Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `"Edit"` and the text of the second button to `"Delete"`. +Create two `button` elements with the `type` attribute set to `button` and the `class` attribute set to `btn`. Set the text of the first button to `Edit` and the text of the second button to `Delete`. # --hints-- @@ -19,7 +19,7 @@ You should create a `button` element of type `button`, a class `btn` and `"Edit" assert.match(code, /Edit<\/button/) ``` -You should create a `button` element of type `button` a class `btn` and `"Delete"` as the text, in that order. +You should create a `button` element of type `button` a class `btn` and `Delete` as the text, in that order. ```js assert.match(code, /Delete<\/button/) diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md index fd1945e43d0..1bca79335e1 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb1c4dc0feb219149a7c7d.md @@ -1,8 +1,8 @@ --- id: 64fb1c4dc0feb219149a7c7d -title: Step 53 +title: Step 52 challengeType: 0 -dashedName: step-53 +dashedName: step-52 --- # --description-- @@ -307,7 +307,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md index 0c5aef4f9a2..cb787162942 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb285637fa1e1c222033e3.md @@ -1,8 +1,8 @@ --- id: 64fb285637fa1e1c222033e3 -title: Step 54 +title: Step 53 challengeType: 0 -dashedName: step-54 +dashedName: step-53 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md index 27538cc5ecf..53c055a2e6d 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fb29348a60361ccd45c1e2.md @@ -1,8 +1,8 @@ --- id: 64fb29348a60361ccd45c1e2 -title: Step 55 +title: Step 54 challengeType: 0 -dashedName: step-55 +dashedName: step-54 --- # --description-- @@ -304,7 +304,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md index 42de45bd160..349a1226355 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64fefebad99209211ec30537.md @@ -1,8 +1,8 @@ --- id: 64fefebad99209211ec30537 -title: Step 56 +title: Step 55 challengeType: 0 -dashedName: step-56 +dashedName: step-55 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md index 42d6ed6ae2d..8c8c80db659 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff0313700dad264d19dfe4.md @@ -1,8 +1,8 @@ --- id: 64ff0313700dad264d19dfe4 -title: Step 57 +title: Step 56 challengeType: 0 -dashedName: step-57 +dashedName: step-56 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md index 1ca2784a3cc..89f8f555a63 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff04cc33779427a6412449.md @@ -1,8 +1,8 @@ --- id: 64ff04cc33779427a6412449 -title: Step 58 +title: Step 57 challengeType: 0 -dashedName: step-58 +dashedName: step-57 --- # --description-- @@ -296,7 +296,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md index 49f4240707d..ae847c9b4ab 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff068e0426eb288874ed79.md @@ -1,8 +1,8 @@ --- id: 64ff068e0426eb288874ed79 -title: Step 59 +title: Step 58 challengeType: 0 -dashedName: step-59 +dashedName: step-58 --- # --description-- @@ -288,7 +288,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md index df55f88ac55..a69e6d3f98a 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff23daf176a92de95f24dc.md @@ -1,8 +1,8 @@ --- id: 64ff23daf176a92de95f24dc -title: Step 60 +title: Step 59 challengeType: 0 -dashedName: step-60 +dashedName: step-59 --- # --description-- @@ -294,7 +294,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md index 8f51f137e15..2d43ea0abaf 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/64ff24b80431f62ec6b93f65.md @@ -1,8 +1,8 @@ --- id: 64ff24b80431f62ec6b93f65 -title: Step 61 +title: Step 60 challengeType: 0 -dashedName: step-61 +dashedName: step-60 --- # --description-- @@ -286,7 +286,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md index 651b7fef4e1..defd194933a 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65003986d17d1e1865b269c0.md @@ -1,8 +1,8 @@ --- id: 65003986d17d1e1865b269c0 -title: Step 62 +title: Step 61 challengeType: 0 -dashedName: step-62 +dashedName: step-61 --- # --description-- @@ -302,7 +302,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md index a0508d09fd1..1504db737a7 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650046832f92c01a35834bca.md @@ -1,8 +1,8 @@ --- id: 650046832f92c01a35834bca -title: Step 63 +title: Step 62 challengeType: 0 -dashedName: step-63 +dashedName: step-62 --- # --description-- @@ -303,7 +303,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md index 0103dc8d732..2759f899e93 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/650048b0764f9c1b798200e2.md @@ -1,8 +1,8 @@ --- id: 650048b0764f9c1b798200e2 -title: Step 64 +title: Step 63 challengeType: 0 -dashedName: step-64 +dashedName: step-63 --- # --description-- @@ -290,7 +290,6 @@ const taskData = []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md index a4b34f17043..304cbb31463 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65004ba581d03d1d5628b41c.md @@ -1,8 +1,8 @@ --- id: 65004ba581d03d1d5628b41c -title: Step 65 +title: Step 64 challengeType: 0 -dashedName: step-65 +dashedName: step-64 --- # --description-- @@ -23,8 +23,6 @@ In that example, if `arr` has a length greater than `0`, the code inside the `if Check if there's a task inside `taskData`, then call the `updateTaskContainer()` inside the `if` statement block. -With that, you've completed this project. - # --hints-- You should create an `if` statement with `(taskData.length)` as the condition. As a reminder, `0` is a falsy value. @@ -308,7 +306,6 @@ const taskData = JSON.parse(localStorage.getItem("data")) || []; let currentTask = {}; const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); const taskObj = { id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, @@ -413,377 +410,3 @@ taskForm.addEventListener("submit", (e) => { addOrUpdateTask(); }); ``` - -# --solutions-- - -```html - - - - - - - - Learn localStorage by Building a Todo App - - - - -

-

Todo App

-
- - - -
-

Discard unsaved changes?

-
- - -
-
-
-
-
-
- - - - -``` - -```css -:root { - --white: #fff; - --light-grey: #f5f6f7; - --dark-grey: #0a0a23; - --yellow: #f1be32; - --golden-yellow: #feac32; -} - -*, -*::before, -*::after { - margin: 0; - padding: 0; - box-sizing: border-box; -} - -body { - background-color: var(--dark-grey); -} - -main { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -h1 { - color: var(--light-grey); - margin: 20px 0 40px 0; -} - -.todo-app { - background-color: var(--white); - width: 300px; - height: 350px; - border: 5px solid var(--yellow); - border-radius: 8px; - padding: 15px; - position: relative; - display: flex; - flex-direction: column; - gap: 10px; -} - -.btn { - cursor: pointer; - width: 100px; - margin: 10px; - color: var(--dark-grey); - background-color: var(--golden-yellow); - background-image: linear-gradient(#fecc4c, #ffac33); - border-color: var(--golden-yellow); - border-width: 3px; -} - -.btn:hover { - background-image: linear-gradient(#ffcc4c, #f89808); -} - -.large-btn { - width: 80%; - font-size: 1.2rem; - align-self: center; - justify-self: center; -} - -.close-task-form-btn { - background: none; - border: none; - cursor: pointer; -} - -.close-icon { - width: 20px; - height: 20px; -} - -.task-form { - display: flex; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - background-color: var(--white); - border-radius: 5px; - padding: 15px; - width: 300px; - height: 350px; - flex-direction: column; - justify-content: space-between; - overflow: auto; -} - -.task-form-header { - display: flex; - justify-content: flex-end; -} - -.task-form-body { - display: flex; - flex-direction: column; - justify-content: space-around; -} - -.task-form-footer { - display: flex; - justify-content: center; -} - -.task-form-label, -#title-input, -#date-input, -#description-input { - display: block; -} - -.task-form-label { - margin-bottom: 5px; - font-size: 1.3rem; - font-weight: bold; -} - -#title-input, -#date-input, -#description-input { - width: 100%; - margin-bottom: 10px; - padding: 2px; -} - -#confirm-close-dialog { - padding: 10px; - margin: 10px auto; - border-radius: 15px; -} - -.confirm-close-dialog-btn-container { - display: flex; - justify-content: center; - margin-top: 10px; -} - -.discard-message-text { - font-weight: bold; - font-size: 1.5rem; -} - -#tasks-container { - height: 100%; - overflow-y: auto; -} - -.task { - margin: 5px 0; -} - -.hidden { - display: none; -} - -@media (min-width: 576px) { - .todo-app, - .task-form { - width: 400px; - height: 450px; - } - - .task-form-label { - font-size: 1.5rem; - } - - #title-input, - #date-input { - height: 2rem; - } - - #title-input, - #date-input, - #description-input { - padding: 5px; - margin-bottom: 20px; - } -} -``` - -```js -const taskForm = document.getElementById("task-form"); -const confirmCloseDialog = document.getElementById("confirm-close-dialog"); -const openTaskFormBtn = document.getElementById("open-task-form-btn"); -const closeTaskFormBtn = document.getElementById("close-task-form-btn"); -const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); -const cancelBtn = document.getElementById("cancel-btn"); -const discardBtn = document.getElementById("discard-btn"); -const tasksContainer = document.getElementById("tasks-container"); -const titleInput = document.getElementById("title-input"); -const dateInput = document.getElementById("date-input"); -const descriptionInput = document.getElementById("description-input"); - -const taskData = JSON.parse(localStorage.getItem("data")) || []; -let currentTask = {}; - -const addOrUpdateTask = () => { - addOrUpdateTaskBtn.innerText = "Add Task"; - const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); - const taskObj = { - id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, - title: titleInput.value, - date: dateInput.value, - description: descriptionInput.value, - }; - - if (dataArrIndex === -1) { - taskData.unshift(taskObj); - } else { - taskData[dataArrIndex] = taskObj; - } - - localStorage.setItem("data", JSON.stringify(taskData)); - updateTaskContainer() - reset() -}; - -const updateTaskContainer = () => { - tasksContainer.innerHTML = ""; - - taskData.forEach( - ({ id, title, date, description }) => { - (tasksContainer.innerHTML += ` -
-

Title: ${title}

-

Date: ${date}

-

Description: ${description}

- - -
- `) - } - ); -}; - - -const deleteTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - buttonEl.parentElement.remove(); - taskData.splice(dataArrIndex, 1); - localStorage.setItem("data", JSON.stringify(taskData)); -} - -const editTask = (buttonEl) => { - const dataArrIndex = taskData.findIndex( - (item) => item.id === buttonEl.parentElement.id - ); - - currentTask = taskData[dataArrIndex]; - - titleInput.value = currentTask.title; - dateInput.value = currentTask.date; - descriptionInput.value = currentTask.description; - - addOrUpdateTaskBtn.innerText = "Update Task"; - - - taskForm.classList.toggle("hidden"); -} - -const reset = () => { - titleInput.value = ""; - dateInput.value = ""; - descriptionInput.value = ""; - taskForm.classList.toggle("hidden"); - currentTask = {}; -} - -if (taskData.length) { - updateTaskContainer(); -} - -openTaskFormBtn.addEventListener("click", () => - taskForm.classList.toggle("hidden") -); - -closeTaskFormBtn.addEventListener("click", () => { - const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; - const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; - - if (formInputsContainValues && formInputValuesUpdated) { - confirmCloseDialog.showModal(); - } else { - reset(); - } -}); - -cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); - -discardBtn.addEventListener("click", () => { - confirmCloseDialog.close(); - reset() -}); - -taskForm.addEventListener("submit", (e) => { - e.preventDefault(); - - addOrUpdateTask(); -}); -``` diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md index 8a982fe77be..e1223fd9b03 100644 --- a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/65099dbd8f137d58e5c0ff16.md @@ -7,7 +7,7 @@ dashedName: step-27 # --description-- -Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `"Description:"`. +Create one more `p` element and interpolate the `description` you destructured as the text. Also, create a `strong` element inside the paragraph with the text `Description:`. # --hints-- @@ -17,7 +17,7 @@ You should create a `p` element with `${description}` as the text. assert.match(code, /

.*\$\{description\}<\/p>/) ``` -You should create a `strong` element with the text `"Description:"` after the opening tag of your `p` element. +You should create a `strong` element with the text `Description:` after the opening tag of your `p` element. ```js assert.match(code, /

Description:\s*<\/strong>\s*/) diff --git a/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md new file mode 100644 index 00000000000..8f2a57bf4e0 --- /dev/null +++ b/curriculum/challenges/ukrainian/15-javascript-algorithms-and-data-structures-22/learn-localstorage-by-building-a-todo-app/6632420f81f3cc554a5e540b.md @@ -0,0 +1,774 @@ +--- +id: 6632420f81f3cc554a5e540b +title: Step 65 +challengeType: 0 +dashedName: step-65 +--- + +# --description-- + +If you try to add a new task, edit that task, and then click on the `Add New Task` button, you will notice a bug. + +The form button will display the incorrect text of `"Update Task"` instead of `"Add Task"`. To fix this, you will need to assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText` inside your `reset` function. + +With that, you've completed this project. + +# --hints-- + +You should assign the string `"Add Task"` to `addOrUpdateTaskBtn.innerText`. + +```js +assert.match(code, /addOrUpdateTaskBtn\.innerText\s*=\s*('|")Add Task\1\s*/) +``` + +# --seed-- + +## --seed-contents-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +

+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + --fcc-editable-region-- + + --fcc-editable-region-- + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` + + +# --solutions-- + +```html + + + + + + + + Learn localStorage by Building a Todo App + + + + +
+

Todo App

+
+ + + +
+

Discard unsaved changes?

+
+ + +
+
+
+
+
+
+ + + + +``` + +```css +:root { + --white: #fff; + --light-grey: #f5f6f7; + --dark-grey: #0a0a23; + --yellow: #f1be32; + --golden-yellow: #feac32; +} + +*, +*::before, +*::after { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + background-color: var(--dark-grey); +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +h1 { + color: var(--light-grey); + margin: 20px 0 40px 0; +} + +.todo-app { + background-color: var(--white); + width: 300px; + height: 350px; + border: 5px solid var(--yellow); + border-radius: 8px; + padding: 15px; + position: relative; + display: flex; + flex-direction: column; + gap: 10px; +} + +.btn { + cursor: pointer; + width: 100px; + margin: 10px; + color: var(--dark-grey); + background-color: var(--golden-yellow); + background-image: linear-gradient(#fecc4c, #ffac33); + border-color: var(--golden-yellow); + border-width: 3px; +} + +.btn:hover { + background-image: linear-gradient(#ffcc4c, #f89808); +} + +.large-btn { + width: 80%; + font-size: 1.2rem; + align-self: center; + justify-self: center; +} + +.close-task-form-btn { + background: none; + border: none; + cursor: pointer; +} + +.close-icon { + width: 20px; + height: 20px; +} + +.task-form { + display: flex; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background-color: var(--white); + border-radius: 5px; + padding: 15px; + width: 300px; + height: 350px; + flex-direction: column; + justify-content: space-between; + overflow: auto; +} + +.task-form-header { + display: flex; + justify-content: flex-end; +} + +.task-form-body { + display: flex; + flex-direction: column; + justify-content: space-around; +} + +.task-form-footer { + display: flex; + justify-content: center; +} + +.task-form-label, +#title-input, +#date-input, +#description-input { + display: block; +} + +.task-form-label { + margin-bottom: 5px; + font-size: 1.3rem; + font-weight: bold; +} + +#title-input, +#date-input, +#description-input { + width: 100%; + margin-bottom: 10px; + padding: 2px; +} + +#confirm-close-dialog { + padding: 10px; + margin: 10px auto; + border-radius: 15px; +} + +.confirm-close-dialog-btn-container { + display: flex; + justify-content: center; + margin-top: 10px; +} + +.discard-message-text { + font-weight: bold; + font-size: 1.5rem; +} + +#tasks-container { + height: 100%; + overflow-y: auto; +} + +.task { + margin: 5px 0; +} + +.hidden { + display: none; +} + +@media (min-width: 576px) { + .todo-app, + .task-form { + width: 400px; + height: 450px; + } + + .task-form-label { + font-size: 1.5rem; + } + + #title-input, + #date-input { + height: 2rem; + } + + #title-input, + #date-input, + #description-input { + padding: 5px; + margin-bottom: 20px; + } +} +``` + +```js +const taskForm = document.getElementById("task-form"); +const confirmCloseDialog = document.getElementById("confirm-close-dialog"); +const openTaskFormBtn = document.getElementById("open-task-form-btn"); +const closeTaskFormBtn = document.getElementById("close-task-form-btn"); +const addOrUpdateTaskBtn = document.getElementById("add-or-update-task-btn"); +const cancelBtn = document.getElementById("cancel-btn"); +const discardBtn = document.getElementById("discard-btn"); +const tasksContainer = document.getElementById("tasks-container"); +const titleInput = document.getElementById("title-input"); +const dateInput = document.getElementById("date-input"); +const descriptionInput = document.getElementById("description-input"); + +const taskData = JSON.parse(localStorage.getItem("data")) || []; +let currentTask = {}; + +const addOrUpdateTask = () => { + const dataArrIndex = taskData.findIndex((item) => item.id === currentTask.id); + const taskObj = { + id: `${titleInput.value.toLowerCase().split(" ").join("-")}-${Date.now()}`, + title: titleInput.value, + date: dateInput.value, + description: descriptionInput.value, + }; + + if (dataArrIndex === -1) { + taskData.unshift(taskObj); + } else { + taskData[dataArrIndex] = taskObj; + } + + localStorage.setItem("data", JSON.stringify(taskData)); + updateTaskContainer() + reset() +}; + +const updateTaskContainer = () => { + tasksContainer.innerHTML = ""; + + taskData.forEach( + ({ id, title, date, description }) => { + (tasksContainer.innerHTML += ` +
+

Title: ${title}

+

Date: ${date}

+

Description: ${description}

+ + +
+ `) + } + ); +}; + + +const deleteTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + buttonEl.parentElement.remove(); + taskData.splice(dataArrIndex, 1); + localStorage.setItem("data", JSON.stringify(taskData)); +} + +const editTask = (buttonEl) => { + const dataArrIndex = taskData.findIndex( + (item) => item.id === buttonEl.parentElement.id + ); + + currentTask = taskData[dataArrIndex]; + + titleInput.value = currentTask.title; + dateInput.value = currentTask.date; + descriptionInput.value = currentTask.description; + + addOrUpdateTaskBtn.innerText = "Update Task"; + + + taskForm.classList.toggle("hidden"); +} + +const reset = () => { + addOrUpdateTaskBtn.innerText = "Add Task"; + titleInput.value = ""; + dateInput.value = ""; + descriptionInput.value = ""; + taskForm.classList.toggle("hidden"); + currentTask = {}; +} + +if (taskData.length) { + updateTaskContainer(); +} + +openTaskFormBtn.addEventListener("click", () => + taskForm.classList.toggle("hidden") +); + +closeTaskFormBtn.addEventListener("click", () => { + const formInputsContainValues = titleInput.value || dateInput.value || descriptionInput.value; + const formInputValuesUpdated = titleInput.value !== currentTask.title || dateInput.value !== currentTask.date || descriptionInput.value !== currentTask.description; + + if (formInputsContainValues && formInputValuesUpdated) { + confirmCloseDialog.showModal(); + } else { + reset(); + } +}); + +cancelBtn.addEventListener("click", () => confirmCloseDialog.close()); + +discardBtn.addEventListener("click", () => { + confirmCloseDialog.close(); + reset() +}); + +taskForm.addEventListener("submit", (e) => { + e.preventDefault(); + + addOrUpdateTask(); +}); +``` diff --git a/curriculum/challenges/ukrainian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md b/curriculum/challenges/ukrainian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md new file mode 100644 index 00000000000..1e918708d4c --- /dev/null +++ b/curriculum/challenges/ukrainian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-a.md @@ -0,0 +1,61 @@ +--- +id: 6619240f46cec8e04d77e03a +title: Basic Functions Exercise A +challengeType: 1 +dashedName: top-basic-functions-exercise-a +--- + +# --description-- + +Create a function that takes in an integer. This function should return the given `integer + 7` if the integer is less than `10`. If the integer is greater than or equal to `10`, it should return the given `integer - 3`. + +The name of the function should be `addOrSubtract`. + +# --hints-- + +You should have a function called `addOrSubtract`. + +```js +assert.isFunction(addOrSubtract); +``` + +Your function should take in an integer as an argument. + +```js +assert.match(addOrSubtract.toString(), /\s*addOrSubtract\(\s*\w+\s*\)/); +``` + +You should return the given integer + 7 if the integer is less than 10. + +```js +assert.strictEqual(addOrSubtract(5), 12); +``` + +You should return the given integer - 3 if the integer is greater than or equal to 10. + +```js +assert.strictEqual(addOrSubtract(10), 7); +``` + + + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function addOrSubtract(num) { + if (num < 10) { + return num + 7; + } else { + return num - 3; + } +} +``` diff --git a/curriculum/challenges/ukrainian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md b/curriculum/challenges/ukrainian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md new file mode 100644 index 00000000000..4dbba976428 --- /dev/null +++ b/curriculum/challenges/ukrainian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-b.md @@ -0,0 +1,47 @@ +--- +id: 661e131f068359c3ccf2f4d6 +title: Basic Functions Exercise B +challengeType: 1 +dashedName: top-basic-functions-exercise-b +--- + +# --description-- + +Write a function, named `multiply`, that takes two parameters and returns their product. + +# --hints-- + +You should have a function named `multiply`. + +```js +assert.isFunction(multiply); +``` + +Your function should take in two integers as arguments. + +```js +assert.match(multiply.toString(), /\s*multiply\(\s*\w+\s*,\s*\w+\s*\)/); +``` + +You should return the product of the two integers. + +```js +assert.strictEqual(multiply(10, 10), 100); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function multiply(a, b) { + return a * b; +} +``` diff --git a/curriculum/challenges/ukrainian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md b/curriculum/challenges/ukrainian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md new file mode 100644 index 00000000000..0c0640ae277 --- /dev/null +++ b/curriculum/challenges/ukrainian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-c.md @@ -0,0 +1,47 @@ +--- +id: 661e151f068359c3ccf2f4d7 +title: Basic Functions Exercise C +challengeType: 1 +dashedName: top-basic-functions-exercise-c +--- + +# --description-- + +Write a function, named `capitalize`, that takes a string as an parameter and returns a new string with the first letter capitalized. + +# --hints-- + +You should have a function named `capitalize`. + +```js +assert.isFunction(capitalize); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(capitalize.toString(), /\s*capitalize\(\s*\w+\s*\)/); +``` + +Your function should return a new string with the first letter capitalized. + +```js +assert.strictEqual(capitalize('sem'), 'Sem'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function capitalize(str) { + return str[0].toUpperCase() + str.slice(1); +} +``` diff --git a/curriculum/challenges/ukrainian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md b/curriculum/challenges/ukrainian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md new file mode 100644 index 00000000000..79d9031b2d9 --- /dev/null +++ b/curriculum/challenges/ukrainian/16-the-odin-project/top-basic-function-projects/top-basic-functions-exercise-d.md @@ -0,0 +1,47 @@ +--- +id: 661e17c6068359c3ccf2f4d8 +title: Basic Functions Exercise D +challengeType: 1 +dashedName: top-basic-functions-exercise-d +--- + +# --description-- + +Write a function, named `lastLetter`, that takes a string as a parameter and returns the last letter of the string. + +# --hints-- + +You should have a function named `lastLetter`. + +```js +assert.isFunction(lastLetter); +``` + +Your function should take in a string as a parameter. + +```js +assert.match(lastLetter.toString(), /\s*lastLetter\(\s*\w+\s*\)/); +``` + +You should return the last letter of the string. + +```js +assert.strictEqual(lastLetter('Sem'), 'm'); +``` + + +# --seed-- + +## --seed-contents-- + +```js + +``` + +## --solutions-- + +```js +function lastLetter(str) { + return str[str.length - 1]; +} +``` diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-ask-and-share-about-educational-and-professional-background/657b2be1b19500c63fc1a467.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-ask-and-share-about-educational-and-professional-background/657b2be1b19500c63fc1a467.md index c670d75fd70..9113286e4e9 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-ask-and-share-about-educational-and-professional-background/657b2be1b19500c63fc1a467.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-ask-and-share-about-educational-and-professional-background/657b2be1b19500c63fc1a467.md @@ -23,7 +23,7 @@ dashedName: task-75 ### --feedback-- -Auxiliary verb for questions in the past. This word should be capitalized. +Auxiliary verb for questions in the past. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/6556c24670683b8d6d80bb32.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/6556c24670683b8d6d80bb32.md index deb5e339727..12739a690cd 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/6556c24670683b8d6d80bb32.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/6556c24670683b8d6d80bb32.md @@ -33,7 +33,7 @@ Sarah describes two activities in her morning routine. Notice the word that come ### --feedback-- -This word should be capitalized. Notice the word that comes before `I go`. +Напишіть це слово з великої літери. Notice the word that comes before `I go`. # --scene-- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/6557b68486fe9bb7b52a4308.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/6557b68486fe9bb7b52a4308.md index 08ed7682553..ba9d890f2bb 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/6557b68486fe9bb7b52a4308.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/6557b68486fe9bb7b52a4308.md @@ -54,7 +54,7 @@ This word is used here to mean 'start' or 'begin'. `T-shirt` ### --feedback-- -The first letter of this word should be capitalized. A casual top typically made of cotton, with short sleeves and no collar. +Напишіть це слово з великої літери. A casual top typically made of cotton, with short sleeves and no collar. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/655a39242197c9040ddedef2.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/655a39242197c9040ddedef2.md index 6a3f1098e2b..7dca6f182f7 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/655a39242197c9040ddedef2.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/655a39242197c9040ddedef2.md @@ -27,7 +27,7 @@ The imperative form is used to give orders, instructions, or advice. It often st ### --feedback-- -Base form of the verb used for giving a positive command. This word is capitalized. +Base form of the verb used for giving a positive command. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/655a52d92a586612be333b16.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/655a52d92a586612be333b16.md index 5c862d079cb..687a719d951 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/655a52d92a586612be333b16.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-discuss-your-morning-or-evening-routine/655a52d92a586612be333b16.md @@ -31,7 +31,7 @@ Used here for a negative command, advising against rushing.This word is not capi ### --feedback-- -An imperative verb used to instruct someone to allow themselves something. This word is capitalized. +An imperative verb used to instruct someone to allow themselves something. Напишіть це слово з великої літери. # --scene-- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/658147bb3dbda824437fd6f9.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/658147bb3dbda824437fd6f9.md index 6524def9457..a4bdd417b7d 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/658147bb3dbda824437fd6f9.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/658147bb3dbda824437fd6f9.md @@ -32,7 +32,7 @@ The word `professionally` relates to your job or career. For instance, `He behav ### --feedback-- -This word is about gaining new knowledge or skills. Think about what you do at school or when you study something new. This word is capitalized. +This word is about gaining new knowledge or skills. Think about what you do at school or when you study something new. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/6581950a4e5ca237a17d1a02.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/6581950a4e5ca237a17d1a02.md index c961240f2bf..b385da5d6b5 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/6581950a4e5ca237a17d1a02.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/6581950a4e5ca237a17d1a02.md @@ -28,7 +28,7 @@ Listen to Tom's statement and fill in the missing words about what else is troub ### --feedback-- -This word means one more or an extra thing. This word is capitalized. +This word means one more or an extra thing. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/65a391fe39a2997ea4c0e980.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/65a391fe39a2997ea4c0e980.md index 2bd771dd229..387e5d45799 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/65a391fe39a2997ea4c0e980.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/65a391fe39a2997ea4c0e980.md @@ -28,7 +28,7 @@ Lisa is talking about the joy of working with different people. ### --feedback-- -This word means working together with others. Notice it ends with `-ing`, indicating an action is happening. This word is capitalized. +This word means working together with others. Notice it ends with `-ing`, indicating an action is happening. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/65a50441ea961ee157da6ff3.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/65a50441ea961ee157da6ff3.md index 1dc7063c212..96494eba598 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/65a50441ea961ee157da6ff3.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/65a50441ea961ee157da6ff3.md @@ -44,4 +44,4 @@ This word is used to talk about the current period of time or the present days. ### --feedback-- -This noun refers to remote-controlled flying machines, often used for photography, racing, or recreation. This word is capitalized. +This noun refers to remote-controlled flying machines, often used for photography, racing, or recreation. Напишіть це слово з великої літери. diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/65fc9417738a7e5cd2bf317e.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/65fc9417738a7e5cd2bf317e.md index 93ed01726f7..43b3b373f28 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/65fc9417738a7e5cd2bf317e.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-have-a-conversation-about-preferences-and-motivations/65fc9417738a7e5cd2bf317e.md @@ -26,7 +26,7 @@ Listen and fill in the missing words. ### --feedback-- -This word means working together with others to achieve a goal. This word is capitalized. +This word means working together with others to achieve a goal. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-a-typical-workday-and-tasks/657e270fae538dd663360e65.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-a-typical-workday-and-tasks/657e270fae538dd663360e65.md index e3224fb58d5..5b3f5ea58fb 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-a-typical-workday-and-tasks/657e270fae538dd663360e65.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-a-typical-workday-and-tasks/657e270fae538dd663360e65.md @@ -33,7 +33,7 @@ Anna: After that, you'll probably attend the daily team meeting at 9:30. --> ### --feedback-- -A phrase indicating the next step in a sequence. This word should be capitalized. +A phrase indicating the next step in a sequence. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-a-typical-workday-and-tasks/657e2c02a685f4ec9ec951ff.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-a-typical-workday-and-tasks/657e2c02a685f4ec9ec951ff.md index aa6dd8d17d6..f8b902b0622 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-a-typical-workday-and-tasks/657e2c02a685f4ec9ec951ff.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-a-typical-workday-and-tasks/657e2c02a685f4ec9ec951ff.md @@ -46,7 +46,7 @@ A term for midday or 12 PM. ### --feedback-- -A verb meaning to take something with you. This word should be capitalized. +A verb meaning to take something with you. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-a-typical-workday-and-tasks/657e6ffb22adc44942ceb5d4.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-a-typical-workday-and-tasks/657e6ffb22adc44942ceb5d4.md index 2f949509416..443f3feddf6 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-a-typical-workday-and-tasks/657e6ffb22adc44942ceb5d4.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-a-typical-workday-and-tasks/657e6ffb22adc44942ceb5d4.md @@ -29,7 +29,7 @@ See if you can get these words right. ### --feedback-- -Means not always but on certain occasions. This word should be capitalized. +Means not always but on certain occasions. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-hobbies-and-interests/657e77615bb8dec146e91f96.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-hobbies-and-interests/657e77615bb8dec146e91f96.md index 29df6ba2561..6a3c86a28b7 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-hobbies-and-interests/657e77615bb8dec146e91f96.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-how-to-talk-about-hobbies-and-interests/657e77615bb8dec146e91f96.md @@ -23,7 +23,7 @@ dashedName: task-32 ### --feedback-- -Think of a word that begins a polite question, usually used to offer a choice or ask for a decision. This word is capitalized. +Think of a word that begins a polite question, usually used to offer a choice or ask for a decision. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657cd7778a28e4099f0ca6e9.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657cd7778a28e4099f0ca6e9.md index 02a652adc7e..88fc0adbf6d 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657cd7778a28e4099f0ca6e9.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657cd7778a28e4099f0ca6e9.md @@ -26,7 +26,7 @@ This sentence is commonly used in professional environments to announce the arri ### --feedback-- -This word indicates the specific time when the action is happening. This word should be capitalized. +This word indicates the specific time when the action is happening. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657cd8d94290160a8732893d.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657cd8d94290160a8732893d.md index 84d15b33795..5c0b86d9076 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657cd8d94290160a8732893d.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657cd8d94290160a8732893d.md @@ -28,7 +28,7 @@ The word `brief` means short in duration or length. When people say something is ### --feedback-- -This word is used to give permission or to allow an action to happen. This word is capitalized. +This word is used to give permission or to allow an action to happen. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657cd938cf0b0c0ad751ac23.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657cd938cf0b0c0ad751ac23.md index 85e4784784a..b9b2eb4db9d 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657cd938cf0b0c0ad751ac23.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657cd938cf0b0c0ad751ac23.md @@ -26,7 +26,7 @@ This is Sarah, the senior developer. ### --feedback-- -It is used to introduce someone or something in the present context. This word is capitalized. +It is used to introduce someone or something in the present context. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657ce5caa3e1460ff657c6b0.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657ce5caa3e1460ff657c6b0.md index 5e5013d474a..8ed507895cf 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657ce5caa3e1460ff657c6b0.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657ce5caa3e1460ff657c6b0.md @@ -23,7 +23,7 @@ The sentence below doesn't have an audio, you need to deduct the correct words b ### --feedback-- -This is used for asking about a singular item or concept. This word is capitalized. +This is used for asking about a singular item or concept. Напишіть це слово з великої літери. --- @@ -31,4 +31,4 @@ This is used for asking about a singular item or concept. This word is capitaliz ### --feedback-- -This is used for inquiring about multiple items or concepts. This word is capitalized. +This is used for inquiring about multiple items or concepts. Напишіть це слово з великої літери. diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657df21cc45b1f66112fb8fc.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657df21cc45b1f66112fb8fc.md index d1b4e728c45..24e9fa60914 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657df21cc45b1f66112fb8fc.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657df21cc45b1f66112fb8fc.md @@ -26,7 +26,7 @@ Bob: Excellent! Lisa, it’s great to have you join our team, even if just onlin ### --feedback-- -This word is used to express happiness or satisfaction with something. This word is capitalized. +This word is used to express happiness or satisfaction with something. Напишіть це слово з великої літери. --- diff --git a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657e51218ff18f8191b76ea9.md b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657e51218ff18f8191b76ea9.md index adb82657993..41be8da5973 100644 --- a/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657e51218ff18f8191b76ea9.md +++ b/curriculum/challenges/ukrainian/21-a2-english-for-developers/learn-introductions-in-an-online-team-meeting/657e51218ff18f8191b76ea9.md @@ -30,7 +30,7 @@ David: Wonderful to meet you all. I'm David, the project manager from FCC Corp. ### --feedback-- -Expresses David's positive feeling about meeting the group. This word is capitalized. +Expresses David's positive feeling about meeting the group. Напишіть це слово з великої літери. --- @@ -54,7 +54,7 @@ Indicates David's role or position within his company. ### --feedback-- -Short for `corporation`, denoting the type of organization David represents. This word is capitalized. +Short for `corporation`, denoting the type of organization David represents. Напишіть це слово з великої літери. # --scene--