File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,7 +44,6 @@ const reverseWordsInArray = strings => {
4444
4545const onlyEven = numbers => {
4646 return numbers . filter ( numbers => numbers % 2 === 0 ) ;
47-
4847} ;
4948
5049const removeNthElement2 = ( index , array ) => {
Original file line number Diff line number Diff line change 11function negate ( a ) {
2- if ( a === false ) {
3- return true ;
4- }
5- return false ;
2+ return ! a ;
63}
74
85function both ( a , b ) {
9- if ( a === true && b === true ) {
10- return true ;
11- }
12- return false ;
6+ return a && b ;
137}
148
159function either ( a , b ) {
16- if ( a === true || b === true ) {
17- return true ;
18- }
19- return false ;
10+ return a || b ;
2011}
2112
2213function none ( a , b ) {
23- if ( a === false && b === false ) {
24- return true ;
25- }
26- return false ;
14+ return ! a && ! b ;
2715}
2816
2917function one ( a , b ) {
30- if ( ( a === true && b === false ) || ( a === false && b === true ) ) {
31- return true ;
32- }
33- return false ;
18+ return ( a && ! b ) || ( ! a && b ) ;
3419}
3520
3621function truthiness ( a ) {
@@ -41,68 +26,39 @@ function truthiness(a) {
4126}
4227
4328function isEqual ( a , b ) {
44- if ( a === b ) {
45- return true ;
46- }
47- return false ;
29+ return a === b ;
4830}
4931
5032function isGreaterThan ( a , b ) {
51- if ( a > b ) {
52- return true ;
53- }
54- return false ;
33+ return a > b ;
5534}
5635
5736function isLessThanOrEqualTo ( a , b ) {
58- if ( a <= b ) {
59- return true ;
60- }
61- return false ;
37+ return a <= b ;
6238}
6339
6440function isOdd ( a ) {
65- if ( a % 2 !== 0 ) {
66- return true ;
67- }
68- return false ;
41+ return a % 2 !== 0 ;
6942}
7043
7144function isEven ( a ) {
72- if ( a % 2 === 0 ) {
73- return true ;
74- }
75- return false ;
45+ return a % 2 === 0 ;
7646}
7747
7848function isSquare ( a ) {
79- if ( a >= 0 && Math . sqrt ( a ) % 1 === 0 ) {
80- return true ;
81- }
82- return false ;
49+ return a >= 0 && Math . sqrt ( a ) % 1 === 0 ;
8350}
8451
8552function startsWith ( char , string ) {
86- if ( string . startsWith ( char ) ) {
87- return true ;
88- }
89- return false ;
53+ return string . startsWith ( char ) ;
9054}
9155
9256function containsVowels ( string ) {
93- // return string === string.match(/[aeiou]/gi);
94- if ( string . match ( / [ a e i o u ] / gi) ) {
95- return true ;
96- }
97- return false
57+ return ! ! string . match ( / [ a e i o u ] / i) ;
9858}
9959
10060function isLowerCase ( string ) {
10161 return string === string . toLowerCase ( ) ;
102- // if (string === string.toLowerCase()) {
103- // return true;
104- // }
105- // return false;
10662}
10763
10864module . exports = {
Original file line number Diff line number Diff line change 11const createPerson = ( name , age ) => {
2- return { name : name , age : age } ;
2+ return { name, age } ;
33} ;
44
55const getName = object => {
@@ -15,10 +15,7 @@ const hasProperty = (property, object) => {
1515} ;
1616
1717const isOver65 = person => {
18- if ( person . age > 65 ) {
19- return true ;
20- }
21- return false ;
18+ return person . age > 65 ;
2219} ;
2320
2421const getAges = people => {
@@ -43,8 +40,8 @@ const averageAge = people => {
4340
4441const createTalkingPerson = ( name , age ) => {
4542 return {
46- name : name ,
47- age : age ,
43+ name,
44+ age,
4845 introduce : introduce => {
4946 return `Hi ${ introduce } , my name is ${ name } and I am ${ age } !` ;
5047 }
You can’t perform that action at this time.
0 commit comments