File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
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..
You can’t perform that action at this time.
0 commit comments