I\'m a little new to JavaScript. I\'ve used it here and there on the client-side for a while, but now I am adventuring into server-side Javascript. This question is about Ja
Heed the advice of others about premature optimization - meaning don't focus on these sorts of implementation details which will likely vary greatly between different JavaScript interpreter implementations.
However, based on this JSPerf benchmark and a sample size of one (on Chrome/Mac OS X), the object literal form (o = {foo:'bar'}
) is much faster than setting properties after construction (o={}; o.foo='bar'
).