Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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);
Source by javascript.info #
 
PREVIOUS NEXT
Tagged: #class #declaration #javascript
ADD COMMENT
Topic
Name
8+3 =