File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change
1
+ const Stack = require ( "../../src/js/data-structures/stack-symbol" ) ;
2
+
3
+ const stack = new Stack ( ) ;
4
+
5
+ stack . push ( 5 ) ;
6
+ stack . push ( 6 ) ;
7
+ stack . push ( 7 ) ;
8
+
9
+ console . log ( stack . peek ( ) ) ;
10
+ console . log ( stack ) ;
11
+
12
+ let objectSymbols = Object . getOwnPropertySymbols ( stack ) ;
13
+ console . log ( "size:" , objectSymbols . length ) ;
14
+ console . log ( "obj" , objectSymbols ) ;
15
+ console . log ( "push" , stack [ objectSymbols [ 0 ] ] . push ( 10 ) ) ;
16
+
17
+ stack [ objectSymbols [ 0 ] ] [ 0 ] = "joao" ;
18
+ console . log ( stack [ objectSymbols [ 0 ] ] ) ;
Original file line number Diff line number Diff line change @@ -7,5 +7,9 @@ stack.push(6);
7
7
stack . push ( 7 ) ;
8
8
9
9
console . log ( "Stack: " , stack . isEmpty ( ) ) ;
10
-
11
10
console . log ( "Stack: " , stack . toString ( ) ) ;
11
+
12
+ console . log ( Object . getOwnPropertyNames ( stack ) ) ;
13
+ console . log ( Object . keys ( stack ) ) ;
14
+ console . log ( stack . items ) ;
15
+ console . log ( stack . count ) ;
You can’t perform that action at this time.
0 commit comments