Math.trunc.js 378 B

12345678910111213141516
  1. try {
  2. assert(Math.trunc(13.37) === 13);
  3. assert(Math.trunc(42.84) === 42);
  4. assert(Math.trunc(0.123) === 0);
  5. assert(Math.trunc(-0.123) === -0);
  6. assert(isNaN(Math.trunc(NaN)));
  7. assert(isNaN(Math.trunc('foo')));
  8. assert(isNaN(Math.trunc()));
  9. assert(Math.trunc.length === 1);
  10. console.log("PASS");
  11. } catch (e) {
  12. console.log("FAIL: " + e);
  13. }