JSFiddle - React, Tailwind, and code Playground
by hmahida
JavaScript
var User = function(){
this.UserName = null;
this.message = {
to : function(uname){
this.UserName = uname
alert('called to '+uname);
this.get = {
friendlist : function(callback){
console.log('called friendlist');
callback('Hello Callback friendlist ::'+ UserName);
}
}
return this;
}
};
}
//----------Use in Application--------------
var user1 = new User();
user1.message.to('name').get.friendlist(function(data){
alert('call back says '+ data);
});