Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

class function constructor

class country{
  constructor(name, independenceOn){

  this.name = name
  this.independenceOn = independenceOn
}
  describe = function () {
    console.log(this.name + " got its independence on " + this.independenceOn + " WHAHAHAHAH")
  }
}

const india = new country('The Country India', 1947)
india.describe()
 
PREVIOUS NEXT
Tagged: #class #function #constructor
ADD COMMENT
Topic
Name
8+5 =