GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • سلسلة
  • كورسات

This view

  • Original page
  • New address

GeezerVison is showing ar.javascript.info — Second bind

  • الدورة التعليمية
  • لغة جافا سكريبت
  • العمل مع التوابع بشكل متقدم
  • ربط الدوالّ Function binding
الرجوع الي الدرس
هذة المادة العلميه متاحه فقط باللغات الأتيه: Čeština, Dansk, English, Español, فارسی, Indonesia, Italiano, 日本語, 한국어, Русский, Türkçe, Українська, Oʻzbek, 简体中文. من فضلك, ساعدنا قم بالترجمه إلى عربي.

Second bind

الأهمية: 5

Can we change this by additional binding?

What will be the output?

function f() {
  alert(this.name);
}

f = f.bind( {name: "John"} ).bind( {name: "Ann" } );

f();

The answer: John.

function f() {
  alert(this.name);
}

f = f.bind( {name: "John"} ).bind( {name: "Pete"} );

f(); // John

The exotic bound function object returned by f.bind(...) remembers the context (and arguments if provided) only at creation time.

A function cannot be re-bound.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.