Fix formatting
This commit is contained in:
@ -7,7 +7,7 @@ lastUpdated: 2021-10-13T19:29:39+02:00
|
||||
|
||||
Creates an array of numbers in the arithmetic progression, starting with the given positive integer and up to the specified limit.
|
||||
|
||||
- Use `Array.from()` to create an array of the desired length, `lim/n`. Use a map function to fill it with the desired values in the given range.
|
||||
- Use `Array.from()` to create an array of the desired length, `lim / n`. Use a map function to fill it with the desired values in the given range.
|
||||
|
||||
```js
|
||||
const arithmeticProgression = (n, lim) =>
|
||||
|
||||
@ -8,7 +8,7 @@ lastUpdated: 2021-01-04T13:04:15+02:00
|
||||
|
||||
Converts Fahrenheit to Celsius.
|
||||
|
||||
- Follow the conversion formula `C = (F - 32) * 5/9`.
|
||||
- Follow the conversion formula `C = (F - 32) * 5 / 9`.
|
||||
|
||||
```js
|
||||
const fahrenheitToCelsius = degrees => (degrees - 32) * 5 / 9;
|
||||
|
||||
@ -9,7 +9,7 @@ Calculates the greatest common divisor between two or more numbers/arrays.
|
||||
|
||||
- The inner `_gcd` function uses recursion.
|
||||
- Base case is when `y` equals `0`. In this case, return `x`.
|
||||
- Otherwise, return the GCD of `y` and the remainder of the division `x/y`.
|
||||
- Otherwise, return the GCD of `y` and the remainder of the division `x / y`.
|
||||
|
||||
```js
|
||||
const gcd = (...arr) => {
|
||||
|
||||
@ -8,7 +8,7 @@ lastUpdated: 2020-10-22T20:23:47+03:00
|
||||
Initializes an array containing the numbers in the specified range where `start` and `end` are inclusive with their common difference `step`.
|
||||
|
||||
- Use `Array.from()` to create an array of the desired length.
|
||||
- Use `(end - start + 1)/step` and a map function to fill the array with the desired values in the given range.
|
||||
- Use `(end - start + 1) / step` and a map function to fill the array with the desired values in the given range.
|
||||
- Omit the second argument, `start`, to use a default value of `0`.
|
||||
- Omit the last argument, `step`, to use a default value of `1`.
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ lastUpdated: 2020-10-20T23:02:01+03:00
|
||||
|
||||
Initializes an array containing the numbers in the specified range (in reverse) where `start` and `end` are inclusive with their common difference `step`.
|
||||
|
||||
- Use `Array.from()` to create an array of the desired length, `(end - start + 1)/step`.
|
||||
- Use `Array.from()` to create an array of the desired length, `(end - start + 1) / step`.
|
||||
- Use `Array.prototype.map()` to fill the array with the desired values in the given range.
|
||||
- Omit the second argument, `start`, to use a default value of `0`.
|
||||
- Omit the last argument, `step`, to use a default value of `1`.
|
||||
|
||||
@ -7,7 +7,7 @@ lastUpdated: 2020-10-18T13:49:49+03:00
|
||||
|
||||
Checks if the provided string is a valid JSON.
|
||||
|
||||
- Use `JSON.parse()` and a `try... catch` block to check if the provided string is a valid JSON.
|
||||
- Use `JSON.parse()` and a `try...catch` block to check if the provided string is a valid JSON.
|
||||
|
||||
```js
|
||||
const isValidJSON = str => {
|
||||
|
||||
@ -7,7 +7,7 @@ lastUpdated: 2021-01-06T22:47:48+02:00
|
||||
|
||||
Calculates the nth root of a given number.
|
||||
|
||||
- Use `Math.pow()` to calculate `x` to the power of `1/n` which is equal to the nth root of `x`.
|
||||
- Use `Math.pow()` to calculate `x` to the power of `1 / n` which is equal to the nth root of `x`.
|
||||
|
||||
```js
|
||||
const nthRoot = (x, n) => Math.pow(x, 1 / n);
|
||||
|
||||
Reference in New Issue
Block a user