Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

Class Example In TypeScript


 class Person{


  private name: string;


  public constructor(name: string)
  {
this.name = name

  }
  
  public getName():string{
  return this.name;
  }
 }
 
var p =  new Person("Jane Doe");
console.log(p.getName());
/*this example is more proper than the previous, though the previous example is syntax-wise correct*/
 
PREVIOUS NEXT
Tagged: #Class #Example #In #TypeScript
ADD COMMENT
Topic
Name
8+2 =