File tree 3 files changed +77
-4
lines changed
3 files changed +77
-4
lines changed Original file line number Diff line number Diff line change 5
5
" Chavda" ,
6
6
" Eich" ,
7
7
" iambrijeshtoo" ,
8
- " Monaspace"
8
+ " Monaspace" ,
9
+ " Monokai" ,
10
+ " Noctis" ,
11
+ " Obscuro"
9
12
],
10
13
"editor.tokenColorCustomizations" : {
11
14
"comments" : " " ,
Original file line number Diff line number Diff line change
1
+ // - In JavaScript there is Math object that gives PI values.
2
+ // - This PI value is constant at the core level of JavaScript.
3
+ // - Sometimes in interview they ask about how we can change the value of PI to whatever you want.
4
+
5
+ const descriptor = Object . getOwnPropertyDescriptor ( Math , "PI" ) ;
6
+ // console.log(descriptor);
7
+
8
+ // - Here you can see in the output that there are properties which we can't access it.
9
+ // - This properties are hard coded inside the JavaScript. Because of that we are not able to change the value.
10
+
11
+ // Output:
12
+ // {
13
+ // value: 3.141592653589793,
14
+ // writable: false,
15
+ // enumerable: false,
16
+ // configurable: false
17
+ // }
18
+
19
+ // How can we setup custom access for the object's properties.
20
+
21
+ // Step: 1
22
+ const object = {
23
+ key1 : "value1" ,
24
+ key2 : "value2" ,
25
+ key3 : "value3" ,
26
+
27
+ method : function ( ) {
28
+ console . log ( "I am method" ) ;
29
+ } ,
30
+ } ;
31
+
32
+ console . log ( Object . getOwnPropertyDescriptor ( object , "key" ) ) ;
33
+
34
+ // Output:
35
+ // {
36
+ // value: 'value',
37
+ // writable: true,
38
+ // enumerable: true,
39
+ // configurable: true
40
+ // }
41
+
42
+ // Step: 2
43
+ // - As you can see in the output we have properties that can help use to setup custom access for the object property -> `key`.
44
+
45
+ Object . defineProperty ( object , "key1" , {
46
+ // writable: false,
47
+ enumerable : false , // This will not iterate the `key1` property in for loop.
48
+ } ) ;
49
+
50
+ // console.log(Object.getOwnPropertyDescriptor(object, "key"));
51
+
52
+ for ( let [ key , value ] of Object . entries ( object ) ) {
53
+ if ( typeof value !== "function" ) {
54
+ console . log ( `${ key } :${ value } ` ) ;
55
+ }
56
+ }
Original file line number Diff line number Diff line change 147
147
1 . setTimeout()
148
148
2 . setInterval()
149
149
150
-
151
150
<!-- OOP -->
152
- 1 . Literal Object
151
+
152
+ 1 . Literal Object
153
153
2 . Constructor Function
154
- 3 .
154
+
155
+ # Monospace Font
156
+
157
+ 1 . MonoLisa
158
+ 2 . Fira Mono
159
+ 3 . Cascadia Code
160
+ 4 . JetBrains Mono
161
+ 5 . Commit Mono
162
+
163
+ # Theme - Pitch Dark Background
164
+
165
+ 1 . Ayu - Dark
166
+ 2 . Night Owl
167
+ 3 . Noctis - Obscuro
168
+ 4 . Monokai Pro - Spectrum
You can’t perform that action at this time.
0 commit comments