Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

class in javascript

/*
A class is a function of a factory that will be used to create many objects,
but no code will be duplicated in creating each object. In other words, 
the code will be written only once, using that code we can create a lot of 
objects again and again.
*/

//Class
class Person{
    constructor(){
        this.name = 'Bill Gates';
    }
}
var person1 = new Person();
console.log(person1.name); //Bill Gates
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #class #javascript
ADD COMMENT
Topic
Name
6+9 =