Skip to content

Commit c7406b2

Browse files
committed
Implement contains function to check for object properties
1 parent dd5a43c commit c7406b2

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎Sprint-2/implement/contains.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
function contains() {}
1+
function contains() {
2+
if (typeof obj !== "object" || obj === null || Array.isArray(obj)) {
3+
return false;
4+
}
5+
return Object.prototype.hasOwnProperty.call(obj, prop);
6+
}
27

38
module.exports = contains;

0 commit comments

Comments
 (0)