Better way to define prototype properties | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Better way to define prototype properties

Which way to define prototype properties is better? pro.prototype.test = function() {}; or pro.prototype = { test: function() {}, ... };

14th Aug 2017, 7:26 AM
Grz
Grz - avatar
2 Answers
+ 3
I always used the first one as I liked it more.. But it is arbitrary!
14th Aug 2017, 8:53 AM
Drax
Drax - avatar
+ 2
thank you for answer, drax :-)
14th Aug 2017, 9:37 AM
Grz
Grz - avatar