-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobject.ts
55 lines (42 loc) · 778 Bytes
/
object.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
let employee: {
name: string;
age: number;
salary: number;
job: string;
};
employee = {
name: "Jane",
age: 23,
salary: 20000,
job: "developer",
//city : "Pune", // error : city is not present in the object employee
};
console.log(employee);
//we can combine the both
const person2: {
name: string;
age: number;
city: string;
isAdmin: boolean;
salary: number;
job: string;
} = {
name: "John",
age: 30,
city: "New York",
isAdmin: false,
salary: 50000,
job: "Software Developer",
};
person2.age = 56;
person2.city = "Pune";
console.log(person2);
let marks2 : Object;
marks2 = {
maths : 90,
science : 80,
english : 70
}
console.log((marks2 as any).maths)
let vacant: {} = {};
console.log(vacant.toString());