-
Notifications
You must be signed in to change notification settings - Fork 39
I never could finish studying neither practicing #69
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
| * returns { 99: 2, 11: 1, 12: 1, 13: 1, 58: 1 } | ||
| */ | ||
|
|
||
| function countNumbers() { |
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.
This function should take in a parameter as indicated on line 5. So, we need to be mindful to include the parameter in the parenthesis of the function.
| let countNumbers = { }; | ||
| for (let i = 0; i < arr.length; i++) { | ||
| value = arr[i] | ||
| if (typeof countNumbers[value] === "undefined") { |
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.
Do we need to use typeof to figure out if a key/value pair exists in an object?
| countryPopulations.sort(function (a, b) { | ||
| return b.population - a.population; | ||
| //should return ['China', 'Egypt', 'Denmark'] only from the object??????!!! | ||
| }); |
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.
This is a great start! Which array method can we chain here that will allow us to return an array with just the information we need?
| */ | ||
| let n = 4; | ||
| function isOdd(n){ | ||
| if(n %2 === 1){ |
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.
Do we need an if-else statement here? Explore implicit return.
No description provided.