Answers for "define variables in class javascript"

0

how to declare a variable inside a class in javascript

class MyClass {
    const MY_CONST = 'string';
    constructor(){
        this.MY_CONST;
    }
}
Posted by: Guest on July-15-2021
-1

create a class variable js

class foo {
  static myProp = 'bar'
  someFunction() {
    console.log(this.myProp)
  }
}
Posted by: Guest on October-02-2021

Code answers related to "define variables in class javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language