Is it ok to assign the JavaScript prototype object instead of just its properties?

The biggest reason not to use the 2nd form is that you'll end up eliminating anything else that existed in the prototype before you assign it. If that isn't something you're concerned with there's no reason not to declare it the way you've demonstrated.


I think there is another drawback of using the "assignment" form to the prototype property: You will likely wipe out the prototype.__proto__ property (prototype chain) when you're dealing with the "pseudo-classical" inheritance.

Of course, one could argue there is a fishy way to remedy this, which is to attach the __proto__ property yourself to connect the chain again. But forgetting doing this will break the code if you call the parent method. See my fiddle here: http://jsfiddle.net/glenn/v5Yub/

Conclusion: The "assignment" form might look simpler / cleaner, but the "property" form is safer.