What is the best practice to create JavaScript object? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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 Réponse
+ 9
first one allows more control
28th Aug 2017, 6:51 PM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar