Answers for "!() typescript"

0

this typescript

//The this keyword refers to the current object.
//The object which this keyword refers is different depending upon the context.
//Example:

class Employee{
	name:string;
	constructor(name:string) {
		this.name = name;//type of a is Employee
		alert(this.name);
		alert(this.getEmployeeName().name);
		}

getEmployeeName=function() {
	return this;//this is of any type
}
Posted by: Guest on February-07-2022
0

typescript syntax

interface User {
  name: string;
  id: number;
}
 
class UserAccount {
  name: string;
  id: number;
 
  constructor(name: string, id: number) {
    this.name = name;
    this.id = id;
  }
}
 
const user: User = new UserAccount("Murphy", 1);
Try
Posted by: Guest on March-18-2022

Code answers related to "TypeScript"

Browse Popular Code Answers by Language