66 */
77function Set ( ) {
88
9- var items = { } ;
9+ let items = { } ;
1010
1111 this . add = function ( value ) {
1212 if ( ! this . has ( value ) ) {
@@ -48,8 +48,8 @@ function Set() {
4848 * @returns {number }
4949 */
5050 this . sizeLegacy = function ( ) {
51- var count = 0 ;
52- for ( var key in items ) {
51+ let count = 0 ;
52+ for ( let key in items ) {
5353 if ( items . hasOwnProperty ( key ) )
5454 ++ count ;
5555 }
@@ -62,16 +62,16 @@ function Set() {
6262 * @returns {Array }
6363 */
6464 this . values = function ( ) {
65- var values = [ ] ;
66- for ( var i = 0 , keys = Object . keys ( items ) ; i < keys . length ; i ++ ) {
65+ let values = [ ] ;
66+ for ( let i = 0 , keys = Object . keys ( items ) ; i < keys . length ; i ++ ) {
6767 values . push ( items [ keys [ i ] ] ) ;
6868 }
6969 return values ;
7070 } ;
7171
7272 this . valuesLegacy = function ( ) {
73- var values = [ ] ;
74- for ( var key in items ) {
73+ let values = [ ] ;
74+ for ( let key in items ) {
7575 if ( items . hasOwnProperty ( key ) ) {
7676 values . push ( items [ key ] ) ;
7777 }
@@ -84,26 +84,26 @@ function Set() {
8484 } ;
8585
8686 this . union = function ( otherSet ) {
87- var unionSet = new Set ( ) ; //{1}
87+ let unionSet = new Set ( ) ; //{1}
8888
89- var values = this . values ( ) ; //{2}
90- for ( var i = 0 ; i < values . length ; i ++ ) {
89+ let values = this . values ( ) ; //{2}
90+ for ( let i = 0 ; i < values . length ; i ++ ) {
9191 unionSet . add ( values [ i ] ) ;
9292 }
9393
9494 values = otherSet . values ( ) ; //{3}
95- for ( var i = 0 ; i < values . length ; i ++ ) {
95+ for ( let i = 0 ; i < values . length ; i ++ ) {
9696 unionSet . add ( values [ i ] ) ;
9797 }
9898
9999 return unionSet ;
100100 } ;
101101
102102 this . intersection = function ( otherSet ) {
103- var intersectionSet = new Set ( ) ; //{1}
103+ let intersectionSet = new Set ( ) ; //{1}
104104
105- var values = this . values ( ) ;
106- for ( var i = 0 ; i < values . length ; i ++ ) { //{2}
105+ let values = this . values ( ) ;
106+ for ( let i = 0 ; i < values . length ; i ++ ) { //{2}
107107 if ( otherSet . has ( values [ i ] ) ) { //{3}
108108 intersectionSet . add ( values [ i ] ) ; //{4}
109109 }
@@ -113,10 +113,10 @@ function Set() {
113113 } ;
114114
115115 this . difference = function ( otherSet ) {
116- var differenceSet = new Set ( ) ; //{1}
116+ let differenceSet = new Set ( ) ; //{1}
117117
118- var values = this . values ( ) ;
119- for ( var i = 0 ; i < values . length ; i ++ ) { //{2}
118+ let values = this . values ( ) ;
119+ for ( let i = 0 ; i < values . length ; i ++ ) { //{2}
120120 if ( ! otherSet . has ( values [ i ] ) ) { //{3}
121121 differenceSet . add ( values [ i ] ) ; //{4}
122122 }
@@ -130,8 +130,8 @@ function Set() {
130130 if ( this . size ( ) > otherSet . size ( ) ) { //{1}
131131 return false ;
132132 } else {
133- var values = this . values ( ) ;
134- for ( var i = 0 ; i < values . length ; i ++ ) { //{2}
133+ let values = this . values ( ) ;
134+ for ( let i = 0 ; i < values . length ; i ++ ) { //{2}
135135 if ( ! otherSet . has ( values [ i ] ) ) { //{3}
136136 return false ; //{4}
137137 }
0 commit comments