Class Variable In Javascript Code Example
Example 1: es6 class example
class Polygon { constructor(height, width) { this.height = height; this.width = width; } }
Example 2: variables in js class
constructor(){ this.foo = bar }
Example 3: class declaration in javascript
class NameOfClass { //class declaration first letter should be capital it's a convention obj="text"; obj2="some other text"; } //always call class with "new" key word console.log(new NameOfClass);
Example 4: how to create class in javascript
class ClassName { }
Comments
Post a Comment