var speak = function(what) {
console.log(what);
}
var saySomething = {normal: "meow", love: "purr"}
speak.call(saySomething, saySomething.normal);
Apply
var speak = function(what) {
console.log(what);
console.log(this.love);
}
var saySomething = {normal: "meow", love: "purr"}
speak.apply(saySomething, ['meouff']);
No hay comentarios:
Publicar un comentario