Interface in TypeScript || Interface along with Arrow Function

In this video,I explained interface 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 -

interface.ts -
interface Chat {   // Chat is the interface name
  x: number,
  y: number
}

let doChat = (chat: Chat) => {  // doChat - arrow function
  console.log("The value of x:- " + chat.x);          // chat - parameter
  console.log("The value of y:- " + chat.y);
}

doChat({
  x: 20,
  y: 40
})

interface1.ts - 
interface anik {
  x: number,
  y: number
}


let singh = (abc: anik) => {
  console.log(abc.x);
  console.log(abc.y);
}

singh({
  x: 1,
  y: 2
})


Comments

Popular posts from this blog

Alert Dialog Box in JS || JavaScript Dialog Box

HTML - Frameset Tag in html

Indian Flag || Indian Flag using HTML CSS