Reputation: 5653
In all of the demos I have seen thus far, Web Workers and Web Sockets apis seemed to use the "new" keyword in JavaScript. Is there another way to use these powerful tools without using the new keyword?
Upvotes: 1
Views: 639
Reputation: 22758
new
is not dangerous. It returns a new object settings its prototype to that objects prototype and calling its constructor.
No where in the Mozilla dev docs does it say it's dangerous.
As answered this so question: is new harmful
I wish crockford et al wouldn't have said that because it gets boiled down to saying new is harmful and don't use it.
Use new. But don't forget to use new.
Upvotes: 2