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:
@ -4,7 +4,7 @@ Creates a deep clone of an object.
|
||||
|
||||
Use recursion.
|
||||
Use `Object.assign()` and an empty object (`{}`) to create a shallow clone of the original.
|
||||
Use `Object.keys()` and `Array.forEach()` to determine which key-value pairs need to be deep cloned.
|
||||
Use `Object.keys()` and `Array.prototype.forEach()` to determine which key-value pairs need to be deep cloned.
|
||||
|
||||
```js
|
||||
const deepClone = obj => {
|
||||
|
||||
Reference in New Issue
Block a user