-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Manchester | Zabihollah Namazi | Module-Data-Flows | challenges | unit-testing | passing-tests #125
base: main
Are you sure you want to change the base?
Conversation
Toyota: 0, | ||
}; | ||
for(let key in totals){ | ||
for(let obj in carsSold){ |
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.
I would suggest to rename obj
to something more relevant here. Because for .. in
will not iterate over objects in carsSold
array. obj
will not contain the whole object from this array. It will contain something else.
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.
car would be better in my opinion
"Land Rover": 0, | ||
Toyota: 0, | ||
}; | ||
for(let key in totals){ |
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.
Can you think of a better name for key
? Hint: think what it will contain and how you are going to use its value (you will compare it to make
from array).
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.
i think makeCar would be better
|
||
function average(numbers) {} | ||
|
||
let numbers = [4, "-", 8, 11, "hello", "57", 0, 2, "hi", 22]; |
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.
I can't agree that numbers
variable contains array of numbers. Do you? Also, if you are not going to reassign this variable to a new array, what is a better variable type here instead of let
?
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.
updated
thanks sir
} | ||
} | ||
console.log(numCount); | ||
return numCount; |
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.
It looks to me that you are returning counter (how many numbers you have found in the given array). I think your task is to return average.
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.
fixed it
} | ||
|
||
myData = await response.json() | ||
//console.log(`${JSON.stringify(myData)} this is api`) |
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.
Please, don't leave commented out code in your final work.
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 commit is a mistake
sorry
|
||
async function fetchData() { | ||
try{ | ||
const response = await fetch("https://xkcd.now.sh/?comic=latest") |
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.
Please, always close your expressions with a semicolon ;
Thank you for the update. You can close this PR. |
just ignore the fetch commit please.
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.