function abs( mixed_number ) { // Absolute value // // + original by: _argos // + improved by: Karol Kowalski return ( ( isNaN ( mixed_number ) ) ? 0 : Math.abs ( mixed_number ) ); }
abs(4.2);
abs(-4.2);
abs(-5);
abs('_argos');
набор методов напоминает - http://phpjs.org/ )
набор методов напоминает - http://phpjs.org/
)