Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
callまたはそのapply上に実装するか、または他の方法でオブジェクトを呼び出し可能にすることは可能ですか? 例えば:
call
apply
var obj = {}; obj.call = function (context, arg1, arg2, ...) { ... }; ... obj (a, b);
ES6これに対するより良い解決策があります。別の方法でオブジェクトを作成する場合 ( 'Function' 型を使用)、呼び出し可能なインスタンスを持つことができますclass。extend
ES6
class
extend
参照: ES6 クラスで Function を拡張するには?