diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1a8ddda21..7b5b4cdcc 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -52,7 +52,7 @@ Here's what you can do to help:
### Additional guidelines and conventions regarding snippets
-- When describing snippets, refer to methods, using their full name. For example, use `Array.reduce()`, instead of `reduce()`.
+- When describing snippets, refer to methods, using their full name. For example, use `Array.prototype.reduce()`, instead of `reduce()`.
- If your snippet contains argument with default parameters, explain what happens if they are omitted when calling the function and what the default case is.
- If your snippet uses recursion, explain the base cases.
- Always use `const functionName` for function definitions.
@@ -64,13 +64,13 @@ Here's what you can do to help:
- `num` or `n` for a numeric value (usually as the snippet function's argument).
- `el` for DOM elements (usually as the snippet function's argument).
- `val` or `v` for value (usually when iterating a list, mapping, sorting etc.).
- - `acc` for accumulators in `Array.reduce()`.
- - `(a,b)` for the two values compared when using `Array.sort()`.
+ - `acc` for accumulators in `Array.prototype.reduce()`.
+ - `(a,b)` for the two values compared when using `Array.prototype.sort()`.
- `i` for indexes.
- `fn` for function arguments.
- `nums` for arrays of numbers.
- Use `()` if your function takes no arguments.
-- Use `_` if an argument inside some function (e.g. `Array.reduce()`) is not used anywhere in your code.
+- Use `_` if an argument inside some function (e.g. `Array.prototype.reduce()`) is not used anywhere in your code.
- Specify default parameters for arguments, if necessary. It is preferred to put default parameters last unless you have pretty good reason not to.
- If your snippet's function takes variadic arguments, use `...args` (although in certain cases, it might be needed to use a different name).
- If your snippet function's body is a single statement, omit the `return` keyword and use an expression instead.
@@ -79,7 +79,7 @@ Here's what you can do to help:
- Always use single quotes for string literals. Use template literals, instead, if necessary.
- If your snippet's code is short enough (around 80 characters), you can make it a single-line function (although not mandatory). Otherwise, use multiple lines.
- Prefer using `Array` methods whenever possible.
-- Prefer `Array.concat()` instead of `Array.push()` when working with `Array.reduce()`.
+- Prefer `Array.prototype.concat()` instead of `Array.prototype.push()` when working with `Array.prototype.reduce()`.
- Use strict equality checking (`===` and `!==` instead of `==` and `!=`), unless you specifically have reason not to.
- Prefer using the ternary operator (`condition ? trueResult : falseResult`) instead of `if else` statements whenever possible.
- Avoid nesting ternary operators (but you can do it if you feel like you should).
diff --git a/README.md b/README.md
index 3bec56352..adec6adb1 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@
#### Related projects
- [30 Seconds of CSS](https://30-seconds.github.io/30-seconds-of-css/)
-- [30 Seconds of Interviews](https://30secondsofinterviews.org/)
+- [30 Seconds of Interviews](https://30secondsofinterviews.org/)
- [30 Seconds of Python](https://github.com/kriadmin/30-seconds-of-python-code) *(unofficial)*
- [30 Seconds of PHP](https://github.com/appzcoder/30-seconds-of-php-code) *(unofficial)*
@@ -521,12 +521,12 @@ const firstTwoMax = ary(Math.max, 2);
[⬆ Back to top](#table-of-contents)
-### call
-
-Given a key and a set of arguments, call them when given a context. Primarily useful in composition.
-
-Use a closure to call a stored key with stored arguments.
-
+### call
+
+Given a key and a set of arguments, call them when given a context. Primarily useful in composition.
+
+Use a closure to call a stored key with stored arguments.
+
```js
const call = (key, ...args) => context => context[key](...args);
```
@@ -542,18 +542,18 @@ const map = call.bind(null, 'map');
Promise.resolve([1, 2, 3])
.then(map(x => 2 * x))
.then(console.log); //[ 2, 4, 6 ]
-```
+```
[⬆ Back to top](#table-of-contents)
-### collectInto
-
-Changes a function that accepts an array into a variadic function.
-
-Given a function, return a closure that collects all inputs into an array-accepting function.
-
+### collectInto
+
+Changes a function that accepts an array into a variadic function.
+
+Given a function, return a closure that collects all inputs into an array-accepting function.
+
```js
const collectInto = fn => (...args) => fn(args);
```
@@ -567,18 +567,18 @@ let p1 = Promise.resolve(1);
let p2 = Promise.resolve(2);
let p3 = new Promise(resolve => setTimeout(resolve, 2000, 3));
Pall(p1, p2, p3).then(console.log); // [1, 2, 3] (after about 2 seconds)
-```
+```
[⬆ Back to top](#table-of-contents)
-### flip
-
-Flip takes a function as an argument, then makes the first argument the last.
-
-Return a closure that takes variadic inputs, and splices the last argument to make it the first argument before applying the rest.
-
+### flip
+
+Flip takes a function as an argument, then makes the first argument the last.
+
+Return a closure that takes variadic inputs, and splices the last argument to make it the first argument before applying the rest.
+
```js
const flip = fn => (first, ...rest) => fn(...rest, first);
```
@@ -594,7 +594,7 @@ let mergePerson = mergeFrom.bind(null, a);
mergePerson(b); // == b
b = {};
Object.assign(b, a); // == b
-```
+```
@@ -757,12 +757,12 @@ rearged('b', 'c', 'a'); // ['a', 'b', 'c']
[⬆ Back to top](#table-of-contents)
-### spreadOver
-
-Takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function.
-
-Use closures and the spread operator (`...`) to map the array of arguments to the inputs of the function.
-
+### spreadOver
+
+Takes a variadic function and returns a closure that accepts an array of arguments to map to the inputs of the function.
+
+Use closures and the spread operator (`...`) to map the array of arguments to the inputs of the function.
+
```js
const spreadOver = fn => argsArr => fn(...argsArr);
```
@@ -773,7 +773,7 @@ const spreadOver = fn => argsArr => fn(...argsArr);
```js
const arrayMax = spreadOver(Math.max);
arrayMax([1, 2, 3]); // 3
-```
+```
@@ -1448,7 +1448,7 @@ head([1, 2, 3]); // 1
### indexOfAll
-Returns all indices of `val` in an array.
+Returns all indices of `val` in an array.
If `val` never occurs, returns `[]`.
Use `Array.reduce()` to loop over elements and store indices for matching elements.
@@ -1718,7 +1718,7 @@ isSorted([4, 3, 5]); // 0
### join
-Joins all elements of an array into a string and returns this string.
+Joins all elements of an array into a string and returns this string.
Uses a separator and an end separator.
Use `Array.reduce()` to combine elements into a string.
@@ -1812,7 +1812,7 @@ Takes any number of iterable objects or objects with a `length` property and ret
If multiple objects have the same length, the first one will be returned.
Returns `undefined` if no arguments are provided.
-Use `Array.reduce()`, comparing the `length` of objects to find the longest one.
+Use `Array.reduce()`, comparing the `length` of objects to find the longest one.
```js
const longestItem = (val, ...vals) =>
@@ -1861,7 +1861,7 @@ squareIt([1, 2, 3]); // { 1: 1, 2: 4, 3: 9 }
### maxN
-Returns the `n` maximum elements from the provided array.
+Returns the `n` maximum elements from the provided array.
If `n` is greater than or equal to the provided array's length, then return the original array (sorted in descending order).
Use `Array.sort()` combined with the spread operator (`...`) to create a shallow clone of the array and sort it in descending order.
@@ -1886,7 +1886,7 @@ maxN([1, 2, 3], 2); // [3,2]
### minN
-Returns the `n` minimum elements from the provided array.
+Returns the `n` minimum elements from the provided array.
If `n` is greater than or equal to the provided array's length, then return the original array (sorted in ascending order).
Use `Array.sort()` combined with the spread operator (`...`) to create a shallow clone of the array and sort it in ascending order.
@@ -2175,7 +2175,7 @@ pullBy(myArray, [{ x: 1 }, { x: 3 }], o => o.x); // myArray = [{ x: 2 }]
Filter an array of objects based on a condition while also filtering out unspecified keys.
-Use `Array.filter()` to filter the array based on the predicate `fn` so that it returns the objects for which the condition returned a truthy value.
+Use `Array.filter()` to filter the array based on the predicate `fn` so that it returns the objects for which the condition returned a truthy value.
On the filtered array, use `Array.map()` to return the new object using `Array.reduce()` to filter out the keys which were not supplied as the `keys` argument.
```js
@@ -2558,10 +2558,10 @@ sortedLastIndexBy([{ x: 4 }, { x: 5 }], { x: 4 }, o => o.x); // 1
### stableSort 
-Performs stable sorting of an array, preserving the initial indexes of items when their values are the same.
+Performs stable sorting of an array, preserving the initial indexes of items when their values are the same.
Does not mutate the original array, but returns a new array instead.
-Use `Array.map()` to pair each element of the input array with its corresponding index.
+Use `Array.map()` to pair each element of the input array with its corresponding index.
Use `Array.sort()` and a `compare` function to sort the list, preserving their initial order if the items compared are equal.
Use `Array.map()` to convert back to the initial array items.
@@ -3253,7 +3253,7 @@ bottomVisible(); // true
⚠️ **NOTICE:** The same functionality can be easily implemented by using the new asynchronous Clipboard API, which is still experimental but should be used in the future instead of this snippet. Find out more about it [here](https://github.com/w3c/clipboard-apis/blob/master/explainer.adoc#writing-to-the-clipboard).
-Copy a string to the clipboard.
+Copy a string to the clipboard.
Only works as a result of user action (i.e. inside a `click` event listener).
Create a new `