+ 1

What is the best practice to create JavaScript object?

var a={};a.calc=function(){}; var a={calc: function(){}}; among the above two ways which one is best way to create object.

28th Aug 2017, 6:35 PM
Vinoth Kumar Muppudathy
Vinoth Kumar Muppudathy - avatar
1 ответ
+ 9
first one allows more control
28th Aug 2017, 6:51 PM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar