Skip to content

Instantly share code, notes, and snippets.

View ardalanamini's full-sized avatar
🏠
Working from home

Ardalan Amini ardalanamini

🏠
Working from home
View GitHub Profile
@ardalanamini
ardalanamini / LetVsVar.js
Created February 24, 2018 20:22
'let' vs 'var' performance. just run the code below to see the magic
/**
* Finds the performance for a given function
* function fn the function to be executed
* int n the amount of times to repeat
* return array [time for n iterations, average execution frequency (executions per second)]
*/
const getPerf = (fn, n) =>{
let start = new Date().getTime()
for (let i = 0; i < n; i++) fn(i)