interface ts
https://www.geeksforgeeks.org/explain-type-assertions-in-typescript/
function fullName(person:{firstName:string,lastName:string}){
console.log(`${person.firstname} ${person.lastName}`);
}
let p={
firstName:'Bruce',
lastName?:'Wayne'//optional:registration....form
}
interface:-----
interface Person{
firstName:string,
lastName:string;
}
function fullName(person:Person){
console.log(`${person.firstName}${person.lastName}`);
}
let p={
firstname:'radhe'
}
fullName(p);
...access modifier public privat protected can be used.............
Comments
Post a Comment