Serenity Operating System
at hosted 16 lines 378 B view raw
1try { 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 7 assert(isNaN(Math.trunc(NaN))); 8 assert(isNaN(Math.trunc('foo'))); 9 assert(isNaN(Math.trunc())); 10 11 assert(Math.trunc.length === 1); 12 13 console.log("PASS"); 14} catch (e) { 15 console.log("FAIL: " + e); 16}