File tree 6 files changed +30
-9
lines changed
6 files changed +30
-9
lines changed Original file line number Diff line number Diff line change 1
1
let calculator = {
2
2
read : function ( a , b ) {
3
- calculator . a = a ;
4
- calculator . b = b ;
3
+ this . a = a ;
4
+ this . b = b ;
5
5
} ,
6
6
sum : function ( ) {
7
- return calculator . a + calculator . b ;
7
+ return this . a + this . b ;
8
8
} ,
9
9
mul : function ( ) {
10
- return calculator . a * calculator . b ;
10
+ return this . a * this . b ;
11
11
}
12
12
} ;
13
13
Original file line number Diff line number Diff line change
1
+
1
2
function namify ( users ) {
2
- // ваш код...
3
+ return users . map ( user => user . name ) ;
4
+
5
+ /*const names = [];
6
+ for (const {name} of users) {
7
+ names.push(name);
8
+ }
9
+ return names;*/
3
10
}
11
+
12
+
Original file line number Diff line number Diff line change 1
1
function filterRange ( arr , a , b ) {
2
- // ваш код...
2
+ return arr . filter ( item => item >= a && item <= b ) ;
3
3
}
4
+
5
+
Original file line number Diff line number Diff line change 1
1
function camelize ( str ) {
2
- // ваш код...
2
+ return str . split ( '-' ) . map ( ( item , index ) => index == 0 ? item : item [ 0 ] . toUpperCase ( ) + item . slice ( 1 ) ) . join ( '' ) ;
3
3
}
4
+
5
+
Original file line number Diff line number Diff line change 1
1
function showSalary ( users , age ) {
2
- // ваш код...
2
+ return users . filter ( user => user . age <= age ) . map ( user => `${ user . name } , ${ user . balance } ` ) . join ( '\n' ) ;
3
+
3
4
}
5
+
6
+
7
+
8
+
9
+
Original file line number Diff line number Diff line change 1
1
function getMinMax ( str ) {
2
- // ваш код...
2
+ let a = str . split ( " " ) . map ( Number ) . filter ( item => ! isNaN ( item ) ) . sort ( ( a , b ) => a - b ) ;
3
+ const result = { min : a [ 0 ] , max : parseInt ( a . slice ( - 1 ) , 10 ) } ;
4
+ return result ;
3
5
}
You can’t perform that action at this time.
0 commit comments