Skip to content

Instantly share code, notes, and snippets.

@sospedra
Created December 2, 2020 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sospedra/a3b7523c5d412aea3c9a3fe6162ed1f8 to your computer and use it in GitHub Desktop.
Save sospedra/a3b7523c5d412aea3c9a3fe6162ed1f8 to your computer and use it in GitHub Desktop.
console.log but outputs time differences
const time = (() => {
let mark
return (...msgs: any[]) => {
if (!mark) {
mark = new Date().getTime()
}
const now = new Date().getTime()
console.log(`${(now - mark) / 1000 % 60}s`, ...msgs)
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment