You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Object.create doesn't assign anything to the prototype. There are 2 workarounds for this:
Option 1 use new (technically, this is faster since V8 optimizes for it, but used so infrequently it really doesn't matter)
Option 2 SCSocket.prototype.constructor = SCSocket + don't use anonymous function for creators (eg var SCSocket = function SCSocket(...`
use case:
user passes in either a socket or a channel into a function. If socket do x, if channel, do y.
The text was updated successfully, but these errors were encountered:
Object.create doesn't assign anything to the prototype. There are 2 workarounds for this:
Option 1 use
new
(technically, this is faster since V8 optimizes for it, but used so infrequently it really doesn't matter)Option 2
SCSocket.prototype.constructor = SCSocket
+ don't use anonymous function for creators (eg var SCSocket = function SCSocket(...`use case:
user passes in either a socket or a channel into a function. If socket do x, if channel, do y.
The text was updated successfully, but these errors were encountered: