Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

class typescript constructor

public class Car{
 private maker: string;
 private model: string;
 private manufactureYear: Date;
 constructor(maker: string, model: string, manufactureYear: Date){
    this.maker = maker,
    this.model = model,
    this.manufactureYear = manufactureDate
 }
 
 carInfo(){
  return{
    this.maker,
    this.model,
    this.manufactureDate
  }
 }
}


const car = Car("Nissan", "GT-R", new Date(2007, 12, 6))
Source by www.typescriptlang.org #
 
PREVIOUS NEXT
Tagged: #class #typescript #constructor
ADD COMMENT
Topic
Name
9+3 =