Create chaining object

An example showing how to create chaining object using Tizen 2.3.
var obj = {
  propA: '',
  propB: '',
  propC: '',

  methodA: function(a) {
    this.propA = a;
    return this;
  },

  methodB: function(b) {
    this.propB = b;
    return this;
  },

  methodC: function(c) {
    this.propC = c;
    return this;

  }
};

obj.methodA(1).methodB(4).methodC(10);

console.log(obj); // {propA: 1, propB: 4, propC: 10}

Responses

0 Replies