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>
 
var foo = {
  run: function() {
    this.action1();
    this.action2();
  },
  action1: function() {
    console.log('action1 '+this.objName);
  },
  action2: function() {
    console.log('action2 '+this.objName);
  },
  objName: 'foo'
};
var bar = Object.create(foo);
bar.run = function() {
  this.first();
  foo.run.call(this);
  this.last();
};
bar.first = function() {
  console.log('first '+this.objName);
};
bar.last = function() {
  console.log('last '+this.objName);
};
bar.objName = 'bar';
foo.run();
bar.run();
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers