Skip to content

Commit

Permalink
[CI] Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 2, 2023
1 parent 1788dfb commit 18c315f
Show file tree
Hide file tree
Showing 22 changed files with 60 additions and 60 deletions.
4 changes: 2 additions & 2 deletions concepts/array-transformations/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ console.log(arr);
// => ['a', 'b', 'c', 'z']
```

~~~~exercism/caution
````exercism/caution
This default behavior leads to wrong results when you try to sort numbers.
```javascript
Expand All @@ -153,7 +153,7 @@ arr.sort();
// => [1, 10, 2, 3]
// Because the string '10' comes before '2' in dictionary order.
```
~~~~
````

To customize the sorting behavior, you can pass a comparison function as an argument.
The comparison function itself is called with two arguments which are two elements of the array.
Expand Down
8 changes: 4 additions & 4 deletions concepts/classes/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ Before that, it was accessible via the key `__proto__` in many environments.

Do not confuse the prototype of an object (`[[prototype]]`) with the `prototype` property of the constructor function.

~~~~exercism/note
```exercism/note
To summarize:
- Constructors in JavaScript are regular functions.
- Constructing a new instance creates an object with a relation to its constructor called its _prototype_.
- Functions are objects (callable objects) and therefore they can have properties.
- The constructor's (function) `prototype` property will become the instance's _prototype_.
~~~~
```

### Instance Fields

Expand Down Expand Up @@ -124,11 +124,11 @@ The `[[prototype]]` of `Object` is usually `null` so the prototype chain ends th
In conclusion, you can call `myCar.toString()` and that method will exist because JavaScript searches for that method throughout the whole prototype chain.
You can find a detailed example in the [MDN article "Inheritance and the prototype chain"][mdn-prototype-chain-example].

~~~~exercism/caution
```exercism/caution
Note that the prototype chain is only travelled when retrieving a value.
Setting a property directly or deleting a property of an instance object only targets that specific instance.
This might not be what you would expect when you are used to a language with class-based inheritance.
~~~~
```

### Dynamic Methods (Adding Methods to All Existing Instances)

Expand Down
8 changes: 4 additions & 4 deletions concepts/classes/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ Every instance object includes a hidden, internal property referred to as `[[pro
It holds a reference to the value of the `prototype` key of the constructor function.
Yes, you read that correctly, a JavaScript function can have key/value pairs because it is also an object behind the scenes.

~~~~exercism/note
```exercism/note
To summarize:
- Constructors in JavaScript are regular functions.
- Constructing a new instance creates an object with a relation to its constructor called its _prototype_.
- Functions are objects (callable objects) and therefore they can have properties.
- The constructor's (function) `prototype` property will become the instance's _prototype_.
~~~~
```

### Instance Fields

Expand Down Expand Up @@ -117,11 +117,11 @@ The `[[prototype]]` property of `Car.prototype` (`myCar.[[prototype]].[[prototyp
It contains general methods that are available for all JavaScript objects, e.g. `toString()`.
In conclusion, you can call `myCar.toString()` and that method will exist because JavaScript searches for that method throughout the whole prototype chain.

~~~~exercism/caution
```exercism/caution
Note that the prototype chain is only travelled when retrieving a value.
Setting a property directly or deleting a property of an instance object only targets that specific instance.
This might not be what you would expect when you are used to a language with class-based inheritance.
~~~~
```

## Class Syntax

Expand Down
12 changes: 6 additions & 6 deletions concepts/dates/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ However, different types of arguments can also be used to create date object, as
>
> [^1]
~~~~exercism/note
```exercism/note
> January 1st, 1970 at 00:00:00 UTC is referred to as the Unix epoch.
> Unix is an operating system originally developed in the 1960s.
> Early Unix engineers picked that date arbitrarily because they needed to set a uniform date for the start of time, and > New Year's Day, 1970, seemed most convenient. [^2]
~~~~
```
### Timestamp string
Expand Down Expand Up @@ -115,9 +115,9 @@ const d3 = Date.parse('2019-01-01T00:00:00.000');
// it is set to your local time zone.
```
~~~~exercism/caution
```exercism/caution
The use of `Date.parse()` (and the timestamp string method which works similarly) is strongly discouraged due to browser differences and inconsistencies. [^5]
~~~~
```
## Accessing `Date` components
Expand All @@ -141,12 +141,12 @@ const date1 = new Date(2020, 11, 13, 5); // Dec 13 2020 5:00:00
let millsecs = date1.getTime(); // find out how many have milliseconds passed since Jan 1 1890!
```
~~~~exercism/caution
```exercism/caution
Many JavaScript engines implement a non-standard method `getYear()`.
**This method is deprecated.**
It returns a 2-digit year sometimes.
Hence, `getFullYear()` must always be used instead.
~~~~
```
## Modifying `Date` components
Expand Down
4 changes: 2 additions & 2 deletions concepts/dates/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ const date2 = new Date(2013, 12, 5, 13, 24, 0);
Shorter variants are also possible, like `YYYY-MM-DD` or `YYYY-MM` or even `YYYY`. However, note that these variants **set the `Date` to UTC**, even though `Z` not mentioned.
To understand what exactly happens check out [this section][mdn-diff-assumed-timezone] of a MDN page.

~~~~exercism/caution
```exercism/caution
The use of `Date.parse()` (and the timestamp string method which works similarly) is strongly discouraged due to browser differences and inconsistencies. [^4]
~~~~
```

## Accessing `Date` components

Expand Down
4 changes: 2 additions & 2 deletions exercises/concept/bird-watcher/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ You already digitalized the bird counts per day for the past weeks that you kept

Now you want to determine the total number of birds that you counted, calculate the bird count for a specific week and correct a counting mistake.

~~~~exercism/note
```exercism/note
To practice, use a for loop to solve each of the tasks below.
~~~~
```

## 1. Determine the total number of birds that you counted so far

Expand Down
4 changes: 2 additions & 2 deletions exercises/concept/elyses-enchantments/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ of a certain card corresponds to the index in the array. That means
position 0 refers to the first card, position 1 to the second card
etc.

~~~~exercism/note
```exercism/note
All functions should update the array of cards and then return the modified array - a common way of working known as the Builder pattern, which allows you to nicely daisy-chain functions together.
~~~~
```

## 1. Retrieve a card from a stack

Expand Down
8 changes: 4 additions & 4 deletions exercises/concept/translation-service/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ api.request('majQa’', callback);

**⚠ Warning! ⚠**

~~~~exercism/caution
```exercism/caution
The API works its magic by teleporting in the various translators when a `request` comes in.
This is a very costly action, so it shouldn't be called when a translation *is* available.
Unfortunately, not everyone reads the manual, so there is a system in place to kick-out bad actors.
If an `api.request` is called for `text` is available, the API throws an `AbusiveClientError` for this call, **and every call after that**.
Ensure that you *never* request a translation if something has already been translated.
~~~~
```

## 1. Fetch a translation, ignoring the quality

Expand Down Expand Up @@ -131,6 +131,6 @@ service.premium("'arlogh Qoylu'pu'?", 40);

**N.B.**

~~~~exercism/note
```exercism/note
The correct translation of `'arlogh Qoylu'pu'?` is **How many times has it been heard?**.
~~~~
```
8 changes: 4 additions & 4 deletions exercises/concept/windowing-system/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ Every instance object includes a hidden, internal property referred to as `[[pro
It holds a reference to the value of the `prototype` key of the constructor function.
Yes, you read that correctly, a JavaScript function can have key/value pairs because it is also an object behind the scenes.

~~~~exercism/note
```exercism/note
To summarize:
- Constructors in JavaScript are regular functions.
- Constructing a new instance creates an object with a relation to its constructor called its _prototype_.
- Functions are objects (callable objects) and therefore they can have properties.
- The constructor's (function) `prototype` property will become the instance's _prototype_.
~~~~
```

### Instance Fields

Expand Down Expand Up @@ -117,11 +117,11 @@ The `[[prototype]]` property of `Car.prototype` (`myCar.[[prototype]].[[prototyp
It contains general methods that are available for all JavaScript objects, e.g. `toString()`.
In conclusion, you can call `myCar.toString()` and that method will exist because JavaScript searches for that method throughout the whole prototype chain.

~~~~exercism/caution
```exercism/caution
Note that the prototype chain is only travelled when retrieving a value.
Setting a property directly or deleting a property of an instance object only targets that specific instance.
This might not be what you would expect when you are used to a language with class-based inheritance.
~~~~
```

## Class Syntax

Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/bob/.approaches/answer-array/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ The correct answer is selected from the array by using the score as the array in
The [`String`][string] [trimEnd][trimend] method is applied to the input to eliminate any whitespace at the end of the input.
If the string has no characters left, it returns the response for saying nothing.

~~~~exercism/caution
```exercism/caution
Note that a `null` or `undefined` `String` would be different from a `String` of all whitespace.
A `null` or `undefined` `String` would raise a `TypeError` if `trimEnd` were applied to it.
~~~~
```

The first half of the shout condition

Expand Down
8 changes: 4 additions & 4 deletions exercises/practice/bob/.approaches/if-statements/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ export function hey(message) {
In this approach you have a series of `if` statements using the private methods to evaluate the conditions.
As soon as the right condition is found, the correct response is returned.
~~~~exercism/note
```exercism/note
Note that there are no `else if` or `else` statements.
If an `if` statement can return, then an `else if` or `else` is not needed.
Execution will either return or will continue to the next statement anyway.
~~~~
```
The [`String`][string] [trimEnd][trimend] method is applied to the input to eliminate any whitespace at the end of the input.
If the string has no characters left, it returns the response for saying nothing.
The `String` method [endsWith][endswith] is used to determine if the input ends with a question mark.
~~~~exercism/caution
```exercism/caution
Note that a `null` or `undefined` `String` would be different from a `String` of all whitespace.
A `null` or `undefined` `String` would raise a `TypeError` if `trimEnd` were applied to it.
~~~~
```
The first half of the shout condition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ The `switch` returns the right response for a question, shout, shouted question,
The [`String`][string] [trimEnd][trimend] method is applied to the input to eliminate any whitespace at the end of the input.
If the string has no characters left, it returns the response for saying nothing.

~~~~exercism/caution
```exercism/caution
Note that a `null` or `undefined` `String` would be different from a `String` of all whitespace.
A `null` or `undefined` `String` would raise a `TypeError` if `trimEnd` were applied to it.
~~~~
```

The first half of the shout condition

Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/etl/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ This needs to be changed to store each individual letter with its score in a one

As part of this change, the team has also decided to change the letters to be lower-case rather than upper-case.

~~~~exercism/note
```exercism/note
If you want to look at how the data was previously structured and how it needs to change, take a look at the examples in the test suite.
~~~~
```
4 changes: 2 additions & 2 deletions exercises/practice/gigasecond/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ Then we can use metric system prefixes for writing large numbers of seconds in m
- Perhaps you and your family would travel to somewhere exotic for two megaseconds (that's two million seconds).
- And if you and your spouse were married for _a thousand million_ seconds, you would celebrate your one gigasecond anniversary.

~~~~exercism/note
```exercism/note
If we ever colonize Mars or some other planet, measuring time is going to get even messier.
If someone says "year" do they mean a year on Earth or a year on Mars?
The idea for this exercise came from the science fiction novel ["A Deepness in the Sky"][vinge-novel] by author Vernor Vinge.
In it the author uses the metric system as the basis for time measurements.
[vinge-novel]: https://www.tor.com/2017/08/03/science-fiction-with-something-for-everyone-a-deepness-in-the-sky-by-vernor-vinge/
~~~~
```
4 changes: 2 additions & 2 deletions exercises/practice/grains/.approaches/bit-shifting/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export function total() {

Instead of using math to calculate the number of grains on a square, you can set a bit in the correct position of a [`BigInt`][bigint] value.

~~~~exercism/note
```exercism/note
Note that a `BigInt` literal can be specified by appending `n` to the value.
~~~~
```

To understand how this works, consider just two squares that are represented in binary bits as `00`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ JavaScript uses the [exponential operator][exponentiation] to raise a number by
Exponentiation is nicely suited to the problem, since we start with one grain and keep doubling the number of grains on each successive square.
`1` grain is `2n ** 0`, `2` grains is `2n ** 1`, `4` is `2n ** 2`, and so on.

~~~~exercism/note
```exercism/note
Note that a [`BigInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) literal can be specified by appending `n` to the value.
~~~~
```

So, to get the right exponent, we subtract `1` from the square number `num`.

Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/isogram/.approaches/bitfield/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ The ASCII value for `A` is `65`.
- The `string` loops through its characters and looks for a character being `a` through `z` or `A` through `Z`.
- If a letter is found, then its ASCII value is taken by the [`charCodeAt`][charcodeat] method.

~~~~exercism/note
```exercism/note
`charCodeAt` actually returns the UTF-16 code unit for the character, which is an integer between `0` and `65535`.
For the letters `a`-`z` and `A`-`Z`, the UTF-16 number is the same value as the ASCII value.
~~~~
```

- If the lowercase letter is subtracted by `97`, then `a` will result in `0`, because `97` minus `97` equals `0`.
`z` would result in `25`, because `122` minus `97` equals `25`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ export function isLeap(year) {
}
```

~~~~exercism/caution
```exercism/caution
This approach may be considered a "cheat" for this exercise.
~~~~
```

By creating a `new` [`Date`][date] from February 29th for the year, you can see if the month is still February.
If it is, then the year is a leap year.
This is checked by using the [getMonth][getmonth] method of the `Date` object.

~~~~exercism/note
```exercism/note
Note that the value returned from the `getMonth` method is zero-based, meaning that February is `1`, not `2`.
~~~~
```

## Shortening

Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/linked-list/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Sometimes a station gets closed down, and in that case the station needs to be r

The size of a route is measured not by how far the train travels, but by how many stations it stops at.

~~~~exercism/note
```exercism/note
The linked list is a fundamental data structure in computer science, often used in the implementation of other data structures.
As the name suggests, it is a list of nodes that are linked together.
It is a list of "nodes", where each node links to its neighbor or neighbors.
Expand All @@ -23,4 +23,4 @@ In a **doubly linked list** each node links to both the node that comes before,
If you want to dig deeper into linked lists, check out [this article][intro-linked-list] that explains it using nice drawings.
[intro-linked-list]: https://medium.com/basecs/whats-a-linked-list-anyway-part-1-d8b7e6508b9d
~~~~
```
4 changes: 2 additions & 2 deletions exercises/practice/pangram/.approaches/bitfield/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ The value for all of the rightmost 26 bits being set is `67108863`.
- The `Array` method [`forEach`][foreach] loops through the characters and looks for a character being `a` through `z` or `A` through `Z`.
- If a letter is found, then its ASCII value is taken by the [`charCodeAt`][charcodeat] method.

~~~~exercism/note
```exercism/note
`charCodeAt` actually returns the UTF-16 code unit for the character, which is an integer between `0` and `65535`.
For the letters `a`-`z` and `A`-`Z`, the UTF-16 number is the same value as the ASCII value.
~~~~
```

- If the lowercase letter is subtracted by `97`, then `a` will result in `0`, because `97` minus `97` equals `0`.
`z` would result in `25`, because `122` minus `97` equals `25`.
Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/pangram/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ To give a comprehensive sense of the font, the random sentences should use **all
They're running a competition to get suggestions for sentences that they can use.
You're in charge of checking the submissions to see if they are valid.

~~~~exercism/note
```exercism/note
Pangram comes from Greek, παν γράμμα, pan gramma, which means "every letter".
The best known English pangram is:
> The quick brown fox jumps over the lazy dog.
~~~~
```
Loading

0 comments on commit 18c315f

Please sign in to comment.