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>
 
function seal(fn, ctx) {
  var args = [].slice.call(arguments, 2);
  return function () {
    fn.apply(ctx, args);
  };
}
// seal in ES6 (for kicks): https://jsbin.com/qetal/1/edit?js,console
// var seal = (fn, ctx, ...args) => () => { fn.apply(ctx, args) }
function doit() {
  console.log('args: ' + arguments.length);
}
console.clear();
doit(1,2,3);
var a = doit.bind(null, 1, 2);
a(3); // allows more args
var b = seal(doit, null, 1, 2);
b(3); // expect 2, not 3
Output

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

Dismiss x
public
Bin info
rempro
0viewers