Update memoize.md
This commit is contained in:
@ -2,11 +2,8 @@
|
|||||||
|
|
||||||
Returns the memoized (cached) function.
|
Returns the memoized (cached) function.
|
||||||
|
|
||||||
Use `Object.create(null)` to create an empty object without Object.prototype
|
Use `Object.create(null)` to create an empty object without `Object.prototype` (so that those properties are not resolved if the input value is something like `'hasOwnProperty'`).
|
||||||
(so that those properties are not resolved if the input value is something like 'hasOwnProperty').
|
Return a function which takes a single argument to be supplied to the memoized function by first checking if the function's output for that specific input value is already cached, or store and return it if not.
|
||||||
Return a function which takes a single argument to be supplied to the memoized function
|
|
||||||
by first checking if the function's output for that specific input value is already cached, or
|
|
||||||
store and return it if not.
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const memoize = fn => {
|
const memoize = fn => {
|
||||||
|
|||||||
Reference in New Issue
Block a user