Lodash _.memoize() Method
The _.memoize() method is used to memorize a given function by caching the result computed by the function. If resolver is issued, the cache key for store the result is determined based on the arguments given to the memoized method. By default, the first argument provided to the memoized function is used as the map cache key.
Parameters: This method accepts two parameters as mentioned above and described below:
- func: This parameter holds the function to have its output memoized.
- resolver: It is the function to resolve the cache key.
Return Value: This method returns the new memoized function.
Note: Here, const _ = require(‘lodash’) is used to import the lodash library into the file.
[5, 8] ['html', 'css']