I am trying to really understand the details of how javascript works. During method chaining, sometimes one method returns to another method that has a named input parameter
If I understand correctly
what does this data refer to? How is it filled?
You mean how it works? It depends on how the callback gets called. For example:
function Lib() {}
Lib.prototype.text = function(callback) {
var data = 'hello world';
callback(data); // `data` is the first parameter
return this; // chain
};
var lib = new Lib();
lib.text(function(data){
console.log(data); //=> "hello world"
});