Last active
July 29, 2019 00:23
-
-
Save Gaafar/de12a44a03ef9aa1028fbbc6f58f5d3c to your computer and use it in GitHub Desktop.
record-time-promise.js
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 = (makeRequest) => { | |
const timeStart = Date.now(); | |
makeRequest().then(() => { // throws error for sync functions (.then is not a 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