Constructor in TypeScript || String Concatenation Concept

In this video,I explained how to use constructor in TypeScript. Feel free to comment. For more, please subscribe and press the BELL icon. Please visit my Angular Playlist . Please visit my YouTube Videos. The code is as follows -

constructor.ts - 
class Point {
  x: number;
  y: number;

  constructor (x: number, y: number) {
    this.x = x;
    this.y = y;
  }

  draw(){
    console.log('The value of X :- ' + this.x + '  The value of Y :- ' + this.y);
    console.log('The addition of X & Y :- ' + (this.x + this.y) );
  }

}

let point = new Point(10,20);
point.draw();


Comments

Popular posts from this blog

Event Binding and Event Filtering || Displaying Data and Handling Events

Service in Angular || Dependency Injection || Angular Fundamentals

Property and Attribute Binding in Angular || Displaying Data and Handling Events