Skip to content

Conversation

@Nora79
Copy link

@Nora79 Nora79 commented Jan 19, 2021

No description provided.

* returns { 99: 2, 11: 1, 12: 1, 13: 1, 58: 1 }
*/

function countNumbers() {

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") {

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??????!!!
});

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){

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants