[ Web Proxy ]
URL:
Viewing: https://fr.javascript.info/task/second-bind [Back]  [Original]

Second bind
FR

Nous souhaitons rendre ce projet open source disponible pour les gens du monde entier.

Aidez-nous traduire le contenu de ce tutoriel dans votre langue!

    Rechercher sur Javascript.info:
    Rechercher dans le tutoriel:
    Light themeDark theme
    DanskEnglishEspaolFranaisIndonesiaItalianoTrkeOzbek
    retour au cours
    Ce contenu n'est disponible que dans les langues suivantes :Dansk, English, Espaol, , Indonesia, Italiano, , , , Trke, , Ozbek, . Merci de
    solution

    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.


    Web Proxy Viewer  |  New URL  |  Original Page