I saw a video in which Crockford told us not to use the new
keyword. He said to use Object.create instead if I'm not mistaken. Why does he tell us not to use new
if he has used it in achieving prototypal inheritance in this article that he wrote: http://javascript.crockford.com/prototypal.html
I would expect him to use Object.create instead of new
, like this:
function object(o) {
return Object.create((function() {}).prototype = o);
}
So why is it that he still uses new
?