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 @@
|
||||
|
||||
Returns the index of the function in an array of functions which executed the fastest.
|
||||
|
||||
Use `Array.map()` to generate an array where each value is the total time taken to execute the function after `iterations` times. Use the difference in `performance.now()` values before and after to get the total time in milliseconds to a high degree of accuracy.
|
||||
Use `Math.min()` to find the minimum execution time, and return the index of that shortest time which corresponds to the index of the most performant function.
|
||||
Use `Array.prototype.map()` to generate an array where each value is the total time taken to execute the function after `iterations` times. Use the difference in `performance.now()` values before and after to get the total time in milliseconds to a high degree of accuracy.
|
||||
Use `Math.min()` to find the minimum execution time, and return the index of that shortest time which corresponds to the index of the most performant function.
|
||||
Omit the second argument, `iterations`, to use a default of 10,000 iterations. The more iterations, the more reliable the result but the longer it will take.
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user