Avoid confusing prototype methods for static methods
Correct: `Array.from()` (it’s a static method) Incorrect: `Array.join()` (doesn’t exist; it’s a prototype method) This patch uses the common `#` syntax to denote `.prototype.`.
This commit is contained in:
@ -2,8 +2,8 @@
|
||||
|
||||
Removes elements from the end of an array until the passed function returns `true`. Returns the removed elements.
|
||||
|
||||
Loop through the array, using a `for...of` loop over `Array.keys()` until the returned value from the function is `true`.
|
||||
Return the removed elements, using `Array.reverse()` and `Array.slice()`.
|
||||
Loop through the array, using a `for...of` loop over `Array.prototype.keys()` until the returned value from the function is `true`.
|
||||
Return the removed elements, using `Array.prototype.reverse()` and `Array.prototype.slice()`.
|
||||
|
||||
```js
|
||||
const takeRightWhile = (arr, func) => {
|
||||
|
||||
Reference in New Issue
Block a user