javascript tutorial 5: call, apply, bind, promises, and more
Sahifa ko'rinishi (5 sahifa)
Pastga aylantiring 👇
Ko'proq o'qimoqchimisiz?
Barcha 20 sahifani Telegram orqali bepul yuklab oling.
To'liq faylni yuklab olish"javascript tutorial 5: call, apply, bind, promises, and more" haqida
javascript tutorial 5: call, apply, bind, promises, and more 1. call, apply, and bind these three methods are used to explicitly set the value of this when calling a function. they allow you to control the context in which a function is executed. 1.1 call() the call() method calls a function with a given this value and arguments provided individually. syntax: function.call(thisarg, arg1, arg2, ...) example: const person = { name: 'alice', greet: function(greeting) { console.log(`${greeting}, my name is ${this.name}`); } }; const anotherperson = { name: 'bob' }; // using call to invoke greet with 'this' pointing to anotherperson person.greet.call(anotherperson, 'hello'); // output: hello, my name is bob 1.2 apply() the apply() method is similar to call(), but it …
Bu fayl PPTX formatida 20 sahifadan iborat (265,3 KB). "javascript tutorial 5: call, apply, bind, promises, and more"ni yuklab olish uchun chap tomondagi Telegram tugmasini bosing.