Last active
July 29, 2019 00:23
-
-
Save Gaafar/14feecc0965af13c9c5447e388c2717f to your computer and use it in GitHub Desktop.
record-time-async
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const recordTime = async (makeRequest) => { | |
const timeStart = Date.now(); | |
await makeRequest(); // works for any sync or async function | |
const timeEnd = Date.now(); | |
console.log('time take:', timeEnd - timeStart); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment