Separate the declaration to 3 lines because the 2nd and the 3rd declarations depend on each other. Keeping them on the same line makes the reader think this is a simply declarative code but in fact it's the opposite.
Avoid using the slice shift combo but use slice with a start of 1 plus direct index access to the arguments[0] to get the first argument. this way i'm not mutating the args array and that makes the code easier to follow.
Rename the object variable to '_this'. Giving the reader a hint as to what it is used for.
And of course if this is actually to be used in production I assume it will be wrapped inside a check to see if the bind function is already defined.
Separate the declaration to 3 lines because the 2nd and the 3rd declarations depend on each other. Keeping them on the same line makes the reader think this is a simply declarative code but in fact it's the opposite.
Avoid using the slice shift combo but use slice with a start of 1 plus direct index access to the arguments[0] to get the first argument. this way i'm not mutating the args array and that makes the code easier to follow.
Rename the object variable to '_this'. Giving the reader a hint as to what it is used for.
And of course if this is actually to be used in production I assume it will be wrapped inside a check to see if the bind function is already defined.