0

im creating javascript class that looks like this :

function MyClass(val1) //constructure {
   this.val1 = val1; 
   var method1 = function() {
      //class method 
   }
   function method2() {
     // allso class method
   }
}

what is the proper way to write class methods? ( none es6 class )

user63898
  • 28,093
  • 80
  • 242
  • 473
  • If you need "the proper way" for ES5, then it'd be `MyClass.prototype.method = function() {/* ... */}` – VLAZ Jul 18 '21 at 05:11

0 Answers0