Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
console.log("Define: Y")
function Y(bindFn) { 
  console.log("Y");
  return function () {
    console.log("Y-Annon");
    return bindFn(Y(bindFn)).apply(null, arguments);
  };
}
console.log("Define: Factorial");
var factorial = Y(function(recurs) { 
  console.log("Factorial Wrapper");
  return function(x) {
    console.log("Factorial " + x);
    return x === 0 ? 1 : x * recurs(x-1);
  };
});
console.log("===Start Trace===")
console.log(factorial(2));
console.log("===End Trace===")
Output

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

Dismiss x
public
Bin info
SergeiGolospro
0viewers