fork download
  1. var emp= new Object();
  2. emp["name"]="pooja";
  3. emp["salary"]=725;
  4.  
  5. emp["paycheck"]=function()
  6. {
  7. var monthly=this["salary"]/12;
  8. alert(this["name"]+":"+monthly);
  9. };
  10.  
  11. emp["paycheck"]();
  12. document.write("<br/>");
  13. var f=emp["paycheck"];
  14.  
  15. function makeDelegate(obj, function) {
  16. return function() {
  17. function.apply(obj, arguments);
  18. };
  19. }
  20.  
  21. var f = makeDelegate(emp, emp["paycheck"]);
  22. f();
Runtime error #stdin #stdout 0.01s 4980KB
stdin
1
2
10
42
11
stdout
Standard output is empty