Metoda .call(objekt) - wstrzykuje obiekt this do f-cji.
function upText() {
return this.name.toUpperCase();
}
function showTxt(txt) {
console.log('this ', this); //{name: 'Józek'}
return txt + upText.call(this);
}
var me = {
name: 'Józek'
}
upText.call(me) //'JÓZEK'
showTxt.call({name: 'Bartek'}, 'dużo się uczy ten ') //'dużo się uczy ten BARTEK'