call, apply hakkında

Mehmet Yıldırım
Aug 28, 2017 · 1 min read

var nesne1 = { hangi : “nesne1” },
nesne2 = { hangi : “nesne2” };

function basla(arg1, arg2){
console.log(this.hangi, arg1, arg2);
}

//call kullanımı
basla.call(nesne1, “Mehmet”, “Yıldırım”);
//çıktı: nesne1 Mehmet Yıldırım

//apply kullanımı
basla.apply(nesne2, [“Mehmet”, “Yıldırım”]);
//çıktı: nesne2 Mehmet Yıldırım

//using old school
basla(“Mehmet”, “Yıldırım”);
//çıktı: undefined “Mehmet” “Yıldırım”

https://stackoverflow.com/users/415642/dan

)
Mehmet Yıldırım

Written by

Web Programlama gibi şeyler…

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade