hi molily,
oder $myClass->myMethod();
Funktionen können natürlich auch Methoden haben, eingebaut sind u.a. apply, call und bind:
'use strict';
var f = function() { alert(this); }
f(); // undefinedf.call({ foo: 'bar' }); // [object Object]
f.apply({ foo: 'bar' }); // [object Object]var f1 = f.bind({ foo: 'bar' });
f1(); // [object Object]
>
> Das wird ständig in der objektorientierten wie der funktionalen JS-Programmierung verwendet (Stichworte: Method Binding, Currying/Partial Application, Higher-order Functions).
>
> Siehe Bibliotheken, die Function.prototype erweitern:
> [http://api.prototypejs.org/language/Function/](http://api.prototypejs.org/language/Function/)
> [http://sugarjs.com/api/Function](http://sugarjs.com/api/Function)
> Und die Lodash-Funktionen für Funktionen:
> [http://lodash.com/docs](http://lodash.com/docs) (links zu »Functions« scrollen)
>
> Siehe auch:
> [Function Binding](http://molily.de/js/organisation-verfuegbarkeit.html#binding)
> [Function.prototype](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/prototype)
> [apply](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply)
> [call](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call)
> [bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind)
Das klingt gut (<https://forum.selfhtml.org/?t=217720&m=1496904>). Les ich morgen weiter. Über Currying und Funktionales Programmieren sprachen wir auch in der Computer-AG, die ist wieder morgen ;-).
Aber doch was anderes, als mit eigenen Objekten und Eigenschaften und vielleicht (wenn man das will) noch "dazugehörigen" Methoden zu hantieren <https://forum.selfhtml.org/?t=217834&m=1497710>.
mfg
tami