fork(2) download
  1. process.stdin.resume();
  2. process.stdin.setEncoding('utf8');
  3.  
  4. // your code goes here
  5.  
  6. process.stdin.resume();
  7. process.stdin.setEncoding('utf8');
  8.  
  9. // your code goes here
  10.  
  11. function bind(fu, obj)
  12. {
  13. return function()
  14. {
  15. return fu.call(obj);
  16. }
  17. }
  18.  
  19. global.x = 1;
  20. var ctx = { x: 2 };
  21.  
  22. function testThis() { console.log(this.x); }
  23. console.log(testThis()); // 1
  24. var boundFunction = bind(testThis, ctx);
  25. console.log(boundFunction()); // 2
  26.  
Success #stdin #stdout 0.06s 10968KB
stdin
Standard input is empty
stdout
1
undefined
2
undefined