Skip to content

Commit da516e3

Browse files
committed
objectPartOne done
1 parent 749d913 commit da516e3

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

02_basics/objectPartOne.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//console.log("hello world");
2+
const mysym = Symbol("key1"); //Capital S.
3+
const mysym2 = Symbol("key2"); //Capital S.
4+
const army = {
5+
cheif: "Hafiz syed Asim munir",
6+
dgisi: "sir nadeem anjam shb ",
7+
dgc: "lft general sir faisal naseer",
8+
core: ["army", "isi", "mi"],
9+
professional: true,
10+
forces: {
11+
first: "Pak Army",
12+
second: "pak air force",
13+
thrid: "pak navy",
14+
},
15+
mysym: "mykey1",
16+
[mysym2]: "mykey2",
17+
};
18+
//console.log(army);
19+
//console.log(army.core); // same output
20+
//console.log(army["core"]); // same output
21+
//console.log(army.forces.first);
22+
//console.log(army.mysym);
23+
//console.log(typeof army.mysym); // string .
24+
//console.log(army[mysym2]); // mykey2
25+
//console.log(typeof army[mysym2]); // mykey2
26+
27+
// you can use object.freeze() for freez so that they cannot be used by anyone ...
28+
29+
army.greeting=function(){
30+
console.log("hello sir");
31+
}
32+
army.greetingtwo=function(){
33+
console.log(`hello sir ${this.cheif}`);
34+
}
35+
console.log(army.greeting())//hello sir undefined..
36+
console.log(army.greetingtwo()); //hello sir hafiz syed asim munir .. undefined..

0 commit comments

Comments
 (0)