From a0733dc85d64588fce0c9cb2d93155793c8bdcc7 Mon Sep 17 00:00:00 2001 From: Jagdish Prajapati Date: Mon, 25 Aug 2025 19:45:12 +0530 Subject: [PATCH 1/2] Run format.mjs --- concepts/callbacks/about.md | 3 +++ concepts/closures/about.md | 2 ++ exercises/concept/amusement-park/.meta/design.md | 4 ++++ exercises/concept/bird-watcher/.meta/design.md | 2 ++ exercises/concept/high-score-board/.meta/design.md | 5 +++++ exercises/concept/mixed-juices/.meta/design.md | 2 ++ exercises/concept/ozans-playlist/.meta/design.md | 1 + 7 files changed, 19 insertions(+) diff --git a/concepts/callbacks/about.md b/concepts/callbacks/about.md index 1899983a55..64fca0040f 100644 --- a/concepts/callbacks/about.md +++ b/concepts/callbacks/about.md @@ -81,6 +81,7 @@ You see this pattern often when dealing with asynchronous functions to assist wi Common `Array` functions use callback functions to define their behaviour: - `Array.prototype.forEach`: + - Accepts a callback, which applies the callback to each element of an array. ```javascript @@ -91,6 +92,7 @@ Common `Array` functions use callback functions to define their behaviour: ``` - `Array.prototype.map` + - Accepts a callback, which applies the callback to each element of an array using the result to create a new array. ```javascript @@ -101,6 +103,7 @@ Common `Array` functions use callback functions to define their behaviour: ``` - `Array.prototype.reduce` + - Accepts a callback, which applies the callback to each element of an array, passing the result forward to the next invocation. ```javascript diff --git a/concepts/closures/about.md b/concepts/closures/about.md index 23cf280315..957cac692a 100644 --- a/concepts/closures/about.md +++ b/concepts/closures/about.md @@ -18,6 +18,7 @@ The name _closure_ is historically derived from [_λ-calculus_][wiki-lambda-calc ## Reasons to use closures in JavaScript 1. Data Privacy / Data Encapsulation + - Unlike other languages, in 2020, there was no way to specify _private_ variables. So closures can be used to effectively emulate _private_ variables (there was a proposal to introduce private variable notation, which might have become standard by the time you read this). ```javascript @@ -36,6 +37,7 @@ The name _closure_ is historically derived from [_λ-calculus_][wiki-lambda-calc ``` 2. Partial Application + - Functions may return functions, and when a returned function uses the argument of the function that created it, this is an example of using a closure to perform partial application. Sometimes this is called _currying_ a function. ```javascript diff --git a/exercises/concept/amusement-park/.meta/design.md b/exercises/concept/amusement-park/.meta/design.md index d974fff324..ed3827a633 100644 --- a/exercises/concept/amusement-park/.meta/design.md +++ b/exercises/concept/amusement-park/.meta/design.md @@ -32,22 +32,26 @@ This exercise could benefit from the following rules in the [analyzer][analyzer] The comment types mentioned below only serve as a proposal. 1. `createVisitor` + - `actionable`: If the student used a helper variable, give feedback that the result can be returned directly. - `celebratory`: If the student used classes, celebrate but let them know it is not necessary throughout this exercise. - `informative`: If the student did not use the short-hand notation but wrote `name: name` etc instead, let them know how to shorten that. The solution should be accepted nevertheless. 2. `revokeTicket` + - `essential`: Check the ticketId field is not deleted and re-added. - `celebratory`: If they used a method on a visitor class, celebrate but let them know it is not necessary for this exercise. 3. `ticketStatus` + - `essential`: Using a type switch should be discouraged since it is confusing to read because of the `typeof null === 'object'` quirk. - `informative`: If the student did not use early returns, maybe let them know about this alternative. - `celebratory`: Congratulate if the student used a template string for the "sold" case - `celebratory`: Congratulate if the student used a `value` helper variable. 4. `simpleTicketStatus` + - `essential`: Check `??` was used and not an if-statement or something else. - `actionable`: If the student used a helper variable, give feedback that the result can be returned directly. diff --git a/exercises/concept/bird-watcher/.meta/design.md b/exercises/concept/bird-watcher/.meta/design.md index 1b297b64d0..191b005cd5 100644 --- a/exercises/concept/bird-watcher/.meta/design.md +++ b/exercises/concept/bird-watcher/.meta/design.md @@ -36,12 +36,14 @@ This exercise could benefit from the following rules in the [analyzer][analyzer] For all tasks check that the student actually used a for loop. 1. `totalBirdCount` + - Verify that the condition is written with `< x.length` instead of `<= y.length -1`. - Check whether a shorthand assignment `+=` was used to increase the sum (non-essential feedback). - Verify the total was properly initialized with `0` instead of e.g. `null` - Verify the increment operator was used in loop header step 2. `birdsInWeek` + - Verify a helper variable was used instead of duplicating the calculation in the initialization and condition of the loop - Other checks should be the same as for `totalBirdCount` diff --git a/exercises/concept/high-score-board/.meta/design.md b/exercises/concept/high-score-board/.meta/design.md index 9c425cb787..ee456ae780 100644 --- a/exercises/concept/high-score-board/.meta/design.md +++ b/exercises/concept/high-score-board/.meta/design.md @@ -40,22 +40,27 @@ The Concepts this exercise unlocks are: This exercise could benefit from the following rules in the [analyzer][analyzer]: 1. `createScoreBoard` + - `essential`: Make sure no class, map etc. was created, there should be just an object. - `actionable`: If the student created an empty object first and then added the value, give feedback to include the entry in the object literal directly. - `actionable`: Check that the object was returned directly, no intermediate assignment to a variable necessary. 2. `addPlayer` + - `essential`: Check the assignment operator was used and no additional variables were declared. 3. `removePlayer` + - `essential`: Make sure `delete` was used and not set to undefined or null. - `actionable`: If there is additional code to check whether the key is present before deleting it, give feedback that this is not necessary. 4. `updateScore` + - `actionable`: If the student used a separate variable to calculate the new value first, tell them it is not necessary. - `actionable`: If the student did not use the shorthand assignment operator, tell them about it. If they used it already, give a `celebratory` comment. 5. `applyMondayBonus` + - `essential`: Check the student actually used `for...in`. - Same feedback as in `updateScore` applies. - Using `updateScore` in the solution should be treated as equally correct as the exemplar solution. diff --git a/exercises/concept/mixed-juices/.meta/design.md b/exercises/concept/mixed-juices/.meta/design.md index de569e6e9e..9d63319c6d 100644 --- a/exercises/concept/mixed-juices/.meta/design.md +++ b/exercises/concept/mixed-juices/.meta/design.md @@ -38,6 +38,7 @@ This exercise could benefit from the following rules in the [analyzer][analyzer] The comment types mentioned below only serve as a proposal. 1. `timeToMixJuice` + - `essential`: Verify the student used a switch statement. Would be nice if we could give different feedback depending on what the student used instead. If it was if-else, comment that switch is better suited for so many different variants. @@ -52,6 +53,7 @@ The comment types mentioned below only serve as a proposal. ``` 2. `limesToCut` + - A solution that uses `if (limes.length < 0) break;` instead of combining the conditions should be considered equally correct to the exemplar solution. The version in the exemplar file is shorter but the break version emphasizes that there is a special edge case. - `essential`: Verify that `while` was used. diff --git a/exercises/concept/ozans-playlist/.meta/design.md b/exercises/concept/ozans-playlist/.meta/design.md index 0ae1f98a0f..ae318c9b7a 100644 --- a/exercises/concept/ozans-playlist/.meta/design.md +++ b/exercises/concept/ozans-playlist/.meta/design.md @@ -35,6 +35,7 @@ This exercise could benefit from the following rules in the [analyzer][analyzer] For all tasks, verify that the student actually used a `Set`. 1. `addTrack` + - Verify that there was no redundant `Set.has()` call 2. `deleteTrack` From 871adb0aa8df4549c1d453dfd2f0ee1dfca397a5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 26 Aug 2025 20:36:19 +0000 Subject: [PATCH 2/2] [CI] Format code --- concepts/callbacks/about.md | 3 --- concepts/closures/about.md | 2 -- exercises/concept/amusement-park/.meta/design.md | 4 ---- exercises/concept/bird-watcher/.meta/design.md | 2 -- exercises/concept/high-score-board/.meta/design.md | 5 ----- exercises/concept/mixed-juices/.meta/design.md | 2 -- exercises/concept/ozans-playlist/.meta/design.md | 1 - 7 files changed, 19 deletions(-) diff --git a/concepts/callbacks/about.md b/concepts/callbacks/about.md index 64fca0040f..1899983a55 100644 --- a/concepts/callbacks/about.md +++ b/concepts/callbacks/about.md @@ -81,7 +81,6 @@ You see this pattern often when dealing with asynchronous functions to assist wi Common `Array` functions use callback functions to define their behaviour: - `Array.prototype.forEach`: - - Accepts a callback, which applies the callback to each element of an array. ```javascript @@ -92,7 +91,6 @@ Common `Array` functions use callback functions to define their behaviour: ``` - `Array.prototype.map` - - Accepts a callback, which applies the callback to each element of an array using the result to create a new array. ```javascript @@ -103,7 +101,6 @@ Common `Array` functions use callback functions to define their behaviour: ``` - `Array.prototype.reduce` - - Accepts a callback, which applies the callback to each element of an array, passing the result forward to the next invocation. ```javascript diff --git a/concepts/closures/about.md b/concepts/closures/about.md index 957cac692a..23cf280315 100644 --- a/concepts/closures/about.md +++ b/concepts/closures/about.md @@ -18,7 +18,6 @@ The name _closure_ is historically derived from [_λ-calculus_][wiki-lambda-calc ## Reasons to use closures in JavaScript 1. Data Privacy / Data Encapsulation - - Unlike other languages, in 2020, there was no way to specify _private_ variables. So closures can be used to effectively emulate _private_ variables (there was a proposal to introduce private variable notation, which might have become standard by the time you read this). ```javascript @@ -37,7 +36,6 @@ The name _closure_ is historically derived from [_λ-calculus_][wiki-lambda-calc ``` 2. Partial Application - - Functions may return functions, and when a returned function uses the argument of the function that created it, this is an example of using a closure to perform partial application. Sometimes this is called _currying_ a function. ```javascript diff --git a/exercises/concept/amusement-park/.meta/design.md b/exercises/concept/amusement-park/.meta/design.md index ed3827a633..d974fff324 100644 --- a/exercises/concept/amusement-park/.meta/design.md +++ b/exercises/concept/amusement-park/.meta/design.md @@ -32,26 +32,22 @@ This exercise could benefit from the following rules in the [analyzer][analyzer] The comment types mentioned below only serve as a proposal. 1. `createVisitor` - - `actionable`: If the student used a helper variable, give feedback that the result can be returned directly. - `celebratory`: If the student used classes, celebrate but let them know it is not necessary throughout this exercise. - `informative`: If the student did not use the short-hand notation but wrote `name: name` etc instead, let them know how to shorten that. The solution should be accepted nevertheless. 2. `revokeTicket` - - `essential`: Check the ticketId field is not deleted and re-added. - `celebratory`: If they used a method on a visitor class, celebrate but let them know it is not necessary for this exercise. 3. `ticketStatus` - - `essential`: Using a type switch should be discouraged since it is confusing to read because of the `typeof null === 'object'` quirk. - `informative`: If the student did not use early returns, maybe let them know about this alternative. - `celebratory`: Congratulate if the student used a template string for the "sold" case - `celebratory`: Congratulate if the student used a `value` helper variable. 4. `simpleTicketStatus` - - `essential`: Check `??` was used and not an if-statement or something else. - `actionable`: If the student used a helper variable, give feedback that the result can be returned directly. diff --git a/exercises/concept/bird-watcher/.meta/design.md b/exercises/concept/bird-watcher/.meta/design.md index 191b005cd5..1b297b64d0 100644 --- a/exercises/concept/bird-watcher/.meta/design.md +++ b/exercises/concept/bird-watcher/.meta/design.md @@ -36,14 +36,12 @@ This exercise could benefit from the following rules in the [analyzer][analyzer] For all tasks check that the student actually used a for loop. 1. `totalBirdCount` - - Verify that the condition is written with `< x.length` instead of `<= y.length -1`. - Check whether a shorthand assignment `+=` was used to increase the sum (non-essential feedback). - Verify the total was properly initialized with `0` instead of e.g. `null` - Verify the increment operator was used in loop header step 2. `birdsInWeek` - - Verify a helper variable was used instead of duplicating the calculation in the initialization and condition of the loop - Other checks should be the same as for `totalBirdCount` diff --git a/exercises/concept/high-score-board/.meta/design.md b/exercises/concept/high-score-board/.meta/design.md index ee456ae780..9c425cb787 100644 --- a/exercises/concept/high-score-board/.meta/design.md +++ b/exercises/concept/high-score-board/.meta/design.md @@ -40,27 +40,22 @@ The Concepts this exercise unlocks are: This exercise could benefit from the following rules in the [analyzer][analyzer]: 1. `createScoreBoard` - - `essential`: Make sure no class, map etc. was created, there should be just an object. - `actionable`: If the student created an empty object first and then added the value, give feedback to include the entry in the object literal directly. - `actionable`: Check that the object was returned directly, no intermediate assignment to a variable necessary. 2. `addPlayer` - - `essential`: Check the assignment operator was used and no additional variables were declared. 3. `removePlayer` - - `essential`: Make sure `delete` was used and not set to undefined or null. - `actionable`: If there is additional code to check whether the key is present before deleting it, give feedback that this is not necessary. 4. `updateScore` - - `actionable`: If the student used a separate variable to calculate the new value first, tell them it is not necessary. - `actionable`: If the student did not use the shorthand assignment operator, tell them about it. If they used it already, give a `celebratory` comment. 5. `applyMondayBonus` - - `essential`: Check the student actually used `for...in`. - Same feedback as in `updateScore` applies. - Using `updateScore` in the solution should be treated as equally correct as the exemplar solution. diff --git a/exercises/concept/mixed-juices/.meta/design.md b/exercises/concept/mixed-juices/.meta/design.md index 9d63319c6d..de569e6e9e 100644 --- a/exercises/concept/mixed-juices/.meta/design.md +++ b/exercises/concept/mixed-juices/.meta/design.md @@ -38,7 +38,6 @@ This exercise could benefit from the following rules in the [analyzer][analyzer] The comment types mentioned below only serve as a proposal. 1. `timeToMixJuice` - - `essential`: Verify the student used a switch statement. Would be nice if we could give different feedback depending on what the student used instead. If it was if-else, comment that switch is better suited for so many different variants. @@ -53,7 +52,6 @@ The comment types mentioned below only serve as a proposal. ``` 2. `limesToCut` - - A solution that uses `if (limes.length < 0) break;` instead of combining the conditions should be considered equally correct to the exemplar solution. The version in the exemplar file is shorter but the break version emphasizes that there is a special edge case. - `essential`: Verify that `while` was used. diff --git a/exercises/concept/ozans-playlist/.meta/design.md b/exercises/concept/ozans-playlist/.meta/design.md index ae318c9b7a..0ae1f98a0f 100644 --- a/exercises/concept/ozans-playlist/.meta/design.md +++ b/exercises/concept/ozans-playlist/.meta/design.md @@ -35,7 +35,6 @@ This exercise could benefit from the following rules in the [analyzer][analyzer] For all tasks, verify that the student actually used a `Set`. 1. `addTrack` - - Verify that there was no redundant `Set.has()` call 2. `deleteTrack`