Sheffield| 26-ITP-Jan| Mona-Eltantawy | Sprint 2 | Sprint 2 course-work tasks#1195
Sheffield| 26-ITP-Jan| Mona-Eltantawy | Sprint 2 | Sprint 2 course-work tasks#1195Mona-Eltantawy wants to merge 15 commits intoCodeYourFuture:mainfrom
Conversation
…at passed the npm try in treminal.
cjyuan
left a comment
There was a problem hiding this comment.
Some of the code is not consistently formatted.
Have you installed the prettier VSCode extension and enabled "Format on save/paste" on VSCode,
as recommended in
https://github.com/CodeYourFuture/Module-Structuring-and-Testing-Data/blob/main/readme.md
?
If you have enabled "Format on save" but it is not working, it is likely that you haven't assign a formatter for JS file. This could happen if you have zero or multiple extensions that can format .js file.
If you have installed "Prettier" extension. To assign it as the formatter of JS code, you can try:
- Use "Format document" to format the JS file. Sometimes, VSCode will ask you to choose a formatter, and you can manually select "Prettier".
- Edit
settings.jsonand set Prettier as the default formatter for JS.
See: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
| function contains(obj, key) { | ||
| return key in obj; | ||
| } |
There was a problem hiding this comment.
Consider the following two approaches for determining if an object contains a property:
let obj = {}, propertyName = "toString";
console.log( propertyName in obj ); // true
console.log( Object.hasOwn(obj, propertyName) ); // false
Which of these approaches suits your needs better?
For more info, you can look up JS "in" operator vs Object.hasOwn.
There was a problem hiding this comment.
I understand your point her but the function used still give the required output, so I'm not sure if I have to change it to Object.hasOwn( ) method or to keep it.
There was a problem hiding this comment.
Have you found out the difference between key in object and Object.hasOwn(object, key)?
As long as you know their differences, you can use either approach in your implementation because the spec is not clear exactly how the function should behave.
There was a problem hiding this comment.
as you said I can use either I kept the key in object in the function implemented already
cjyuan
left a comment
There was a problem hiding this comment.
Can you also address the two unaddressed comments from the previous review?
I already install and use it. |
cjyuan
left a comment
There was a problem hiding this comment.
Changes look good enough.
Can you address this commenet?
#1195 (comment)
| console.log(text); | ||
|
|
||
| // or: | ||
| const values = Object.values(author) .join (""); |
There was a problem hiding this comment.
You need to join using "\n" if you want each value to appear on a new line.
There was a problem hiding this comment.
do I have to do that If the function implementation already giving the expected output?
There was a problem hiding this comment.
No need to change. I just need you to take note.
|
Can you address this commenet? |
yeah I did, thank you for re-mention. . |
|
All good now. |
Self checklist