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

No menu could be recovered. Follow the blue links in the page.

This view

  • Original page
  • New address

GeezerVison is showing it.javascript.info — Secondo bind

  • Tutorial
  • Il linguaggio JavaScript
  • Gestione avanzata delle funzioni
  • Function binding
torna alle lezioni

Secondo bind

importanza: 5

Possiamo cambiare this con una associazione addizionale?

Quale sarà l’output?

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

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

f();

Risposta: John.

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

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

f(); // John

L’ exotic object bound function restituito da f.bind(...) memorizza il contesto (e gli argomenti, se forniti) solo in fase di creazione.

Una funzione non può essere riassegnata.

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.