Manchester | 26-ITP-Jan | Liban Jama | Sprint 2 | Data Groups #1050
Open
libanj0161 wants to merge 12 commits intoCodeYourFuture:mainfrom
Open
Manchester | 26-ITP-Jan | Liban Jama | Sprint 2 | Data Groups #1050libanj0161 wants to merge 12 commits intoCodeYourFuture:mainfrom
libanj0161 wants to merge 12 commits intoCodeYourFuture:mainfrom
Conversation
cjyuan
reviewed
Mar 25, 2026
Contributor
|
Can you also respond to each comment to let me know what you did? |
cjyuan
reviewed
Mar 26, 2026
Contributor
cjyuan
left a comment
There was a problem hiding this comment.
Thanks for the clear explanations.
Changes look good.
I will mark this PR as complete first.
Sprint-2/implement/contains.js
Outdated
| @@ -1,3 +1,9 @@ | |||
| function contains() {} | |||
| function contains(object, propertyName) { | |||
| if (Object.prototype.toString.call(object) !== "[object Object]") { | |||
Contributor
There was a problem hiding this comment.
This check will reject other kinds of objects such as Map and Set objects.
Can you change it to reject only arrays or any value that is not an object?
Author
There was a problem hiding this comment.
Added a rejection for null and array, and added test.
Made contains work with map/set.
cjyuan
reviewed
Mar 27, 2026
Sprint-2/implement/contains.js
Outdated
Comment on lines
+2
to
+4
| if (object instanceof Map || object instanceof Set) { | ||
| return object.has(propertyName); | ||
| } |
Contributor
There was a problem hiding this comment.
This is unnecessary because of the check on line 5.
Sprint-2/implement/contains.test.js
Outdated
| expect(contains(obj, "name")).toEqual(true); | ||
| }); | ||
|
|
||
| test("should throw an error when input is an array even if propertyName is a valid key", () => { |
Contributor
There was a problem hiding this comment.
The function does not throw any error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
Completed Sprint 2 of Module Data Groups.
Questions
N/A.