-
Notifications
You must be signed in to change notification settings - Fork 73
/
TypeScript.ts
35 lines (28 loc) · 919 Bytes
/
TypeScript.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Creates an instance of a Person.
* @param {string} who - The name of the person.
*/
const BROWSER = navigator.userAgent.search("Firefox") > -1;
export class Person {
who: string;
likesDogs: boolean;
constructor(who: string, likesDogs: boolean) {
this.who = who;
this.likesDogs = likesDogs;
}
about() {
const { who, likesDogs } = this;
let select = String(12345);
if (likesDogs) {
select = "dogs";
} else {
select = "cats";
}
return `${who} likes ${select}`;
}
}
var John = new Person("John", true);
class Someone extends Person { }
console.log(John.about().length, BROWSER);
console.log(Someone);
let a = () => { };