Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var c = console.log;
c(Math.abs(.57));        // 0.57
c(Math.abs(4.65));       // 4.65
c(Math.abs('-1'));       // 1
c(Math.abs(-2));         // 2
c(Math.abs(null));       // 0
c(Math.abs(''));         // 0
c(Math.abs([]));         // 0
c(Math.abs([2]));        // 2
c(Math.abs(Infinity));   // Infinity
c(Math.abs(-Infinity));  // Infinity
c(Math.abs(3,000));      // 3 
c(Math.abs(3, 'd'));     // 3
c(Math.abs([1,2]));      // NaN
c(Math.abs({}));         // NaN
c(Math.abs('5abc'));     // NaN
c(Math.abs());           // NaN
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
ImpressiveWebspro
0viewers