-
Notifications
You must be signed in to change notification settings - Fork 39
Functions done #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
src/index.js
Outdated
| let doubledArray = []; | ||
| for(i = 0; i < x.length; i++) { | ||
| doubledArray.push(x[i] * 2); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use higher order function instead, check out the map method of array in javascript
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback, I updated the function!
UmerSharif
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
| exports.oddOrEven = function oddOrEven(x) { | ||
| if(x % 2 == 0) { | ||
| return ('even') | ||
| } else { | ||
| return ('odd') | ||
| } | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work.
| // 1. ADD | ||
| const add = (x, y) => x + y; | ||
|
|
||
| // 2. MULTIPLY | ||
| const multiply = (x, y) => x * y; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may no need for spaces
No description provided.