JavaScript double colon (bind operator) JavaScript double colon (bind operator) javascript javascript

JavaScript double colon (bind operator)


No. The bind operator (spec proposal) comes in two flavours:

  • Method extraction

    ::obj.method     ≡ obj.method.bind(obj)
  • "virtual method" calls

    obj::functionfunction.bind(obj)obj::function() ≡ function.call(obj, …)

Neither of them feature partial application. For what you want, you should use an arrow function:

(...args) => this.handleStuff('stuff', ...args) ≡ this.handleStuff.bind(this, 'stuff')