This is the first format.
it is closer to static methods in other programming languages.
var ClassName = { one: function() {}, two: function() {}, three: function() {} }
Example:
ClassName.one();
and the other:
function ClassName(){ this.one = function() {}; this.two = function() {}; this.three = function() {}; }
here you can:
var obj = new ClassName(); obj.one();
In this case, you need to instantiate the object before using the methods.
These are two ways for classes in javascript ... which I know.
source share