Serenity Operating System
at hosted 14 lines 380 B view raw
1try { 2 assert(Math.abs('-1') === 1); 3 assert(Math.abs(-2) === 2); 4 assert(Math.abs(null) === 0); 5 assert(Math.abs('') === 0); 6 assert(Math.abs([]) === 0); 7 assert(Math.abs([2]) === 2); 8 assert(isNaN(Math.abs([1, 2]))); 9 assert(isNaN(Math.abs({}))); 10 assert(isNaN(Math.abs('string'))); 11 assert(isNaN(Math.abs())); 12 console.log("PASS"); 13} catch { 14}