Home:ALL Converter>Is there a difference in overhead between returning an object and returning the default value in a javascript function?

Is there a difference in overhead between returning an object and returning the default value in a javascript function?

Ask Time:2013-02-12T06:57:03         Author:fizban

Json Formatter

Javascript functions can return objects or undefined. I'm considering adopting a policy of always returning the object on which a function is called unless some other value is needed in order to facilitate method chaining. Is there overhead associated with doing this by default even when there isn't a perceived need to chain at the time the function is written?

Author:fizban,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/14822498/is-there-a-difference-in-overhead-between-returning-an-object-and-returning-the
yy