Class Autobind *15char*

What’s the difference between this (seemingly) excessive class method autobind function and my dumbed down autobind function

function BindClassMethods(Class) {
  const Prototype = Object.getPrototypeOf(Class);
  const Methods = Object.getOwnPropertyNames(Prototype)
    
  Methods.forEach((Method) => {
    Class[Method] = Class[Method].bind(Class)
  })
}

:face_with_monocle:

(I don’t like this hacky solution but is it still valid?)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.