Skip to content

Instantly share code, notes, and snippets.

@YurkaninRyan
Created March 18, 2019 12:13
Show Gist options
  • Save YurkaninRyan/087f0b23759885a7af1d097b1768d8b8 to your computer and use it in GitHub Desktop.
Save YurkaninRyan/087f0b23759885a7af1d097b1768d8b8 to your computer and use it in GitHub Desktop.
function double(x, opts) {
if (!Number.isFinite(x)) {
const error = `double(x): ${x} is not a number`;
if (opts.onError) {
return opts.onError(error)
}
return console.error(error)
}
return x * 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment