mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-26 22:01:30 -04:00
fix(curriculum): external comma external link in CIP (#46388)
* fix(curriculum): external comma link in CIP * Removed blog text * Changed the output and the input * swapped list/squence to an array * added a little description * Add spaced Co-authored-by: Jeremy L Thompson <jeremy@jeremylt.org> * Shaun got our back part 1 Co-authored-by: Shaun Hamilton <shauhami020@gmail.com> * Shaun got our back part 2 Co-authored-by: Shaun Hamilton <shauhami020@gmail.com> * Shaun got our back part 3💚 Co-authored-by: Shaun Hamilton <shauhami020@gmail.com> * Typo fix Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> * reverted the variables * Update comma-quibbling.md * Goodbye table, I fought hard for you * Nice catch 👍 * fix: solution Co-authored-by: Jeremy L Thompson <jeremy@jeremylt.org> Co-authored-by: Shaun Hamilton <shauhami020@gmail.com> Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
@@ -8,7 +8,7 @@ dashedName: comma-quibbling
|
||||
|
||||
# --description--
|
||||
|
||||
Comma quibbling is a task originally set by Eric Lippert in his [blog](https://blogs.msdn.com/b/ericlippert/archive/2009/04/15/comma-quibbling.aspx).
|
||||
[Comma quibbling](https://rosettacode.org/wiki/Comma_quibbling) is a task originally set by Eric Lippert in his 2009 blog. In this challenge, you will create a `string` from an `array`. You have to account for the `array` having no items, a single item, or multiple items in it.
|
||||
|
||||
# --instructions--
|
||||
|
||||
@@ -52,19 +52,19 @@ assert(typeof quibble(['ABC']) === 'string');
|
||||
assert.equal(quibble(testCases[0]), results[0]);
|
||||
```
|
||||
|
||||
`quibble(["ABC"])` should return "{ABC}".
|
||||
`quibble(["ABC"])` should return `"{ABC}"`.
|
||||
|
||||
```js
|
||||
assert.equal(quibble(testCases[1]), results[1]);
|
||||
```
|
||||
|
||||
`quibble(["ABC", "DEF"])` should return "{ABC and DEF}".
|
||||
`quibble(["ABC", "DEF"])` should return `"{ABC and DEF}"`.
|
||||
|
||||
```js
|
||||
assert.equal(quibble(testCases[2]), results[2]);
|
||||
```
|
||||
|
||||
`quibble(["ABC", "DEF", "G", "H"])` should return "{ABC,DEF,G and H}".
|
||||
`quibble(["ABC", "DEF", "G", "H"])` should return `"{ABC, DEF, G and H}"`.
|
||||
|
||||
```js
|
||||
assert.equal(quibble(testCases[3]), results[3]);
|
||||
@@ -76,7 +76,7 @@ assert.equal(quibble(testCases[3]), results[3]);
|
||||
|
||||
```js
|
||||
const testCases = [[], ["ABC"], ["ABC", "DEF"], ["ABC", "DEF", "G", "H"]];
|
||||
const results = ["{}", "{ABC}", "{ABC and DEF}", "{ABC,DEF,G and H}"];
|
||||
const results = ["{}", "{ABC}", "{ABC and DEF}", "{ABC, DEF, G and H}"];
|
||||
```
|
||||
|
||||
## --seed-contents--
|
||||
@@ -93,7 +93,7 @@ function quibble(words) {
|
||||
```js
|
||||
function quibble(words) {
|
||||
return "{" +
|
||||
words.slice(0, words.length - 1).join(",") +
|
||||
words.slice(0, words.length - 1).join(", ") +
|
||||
(words.length > 1 ? " and " : "") +
|
||||
(words[words.length - 1] || '') +
|
||||
"}";
|
||||
|
||||
Reference in New Issue
Block a user