Skip to content

Instantly share code, notes, and snippets.

@cosinekitty
Created June 10, 2020 02:08
Show Gist options
  • Save cosinekitty/ac609ce7c83fcfe6a0d50fce8f7db152 to your computer and use it in GitHub Desktop.
Save cosinekitty/ac609ce7c83fcfe6a0d50fce8f7db152 to your computer and use it in GitHub Desktop.

Revisions

  1. cosinekitty created this gist Jun 10, 2020.
    13 changes: 13 additions & 0 deletions verify_number.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    function v(x) {
    if (typeof x !== 'number') {
    console.trace();
    throw `Not a numeric type: ${x}`;
    }

    if (isNaN(x)) {
    console.trace();
    throw 'NAN result';
    }

    return x;
    }