Tell us what’s happening:
Describe your issue in detail here.
can someone help me with my approach for this solution?
**Your code so far**
let users = {
Alan: {
age: 27,
online: true
},
Jeff: {
age: 32,
online: true
},
Sarah: {
age: 48,
online: true
},
Ryan: {
age: 19,
online: true
}
};
function isEveryoneHere(userObj) {
// Only change code below this line
let props = []
for (let prop in users){
props.push(prop)
}
return props.every(name => userObj.hasOwnProperty(name))
// Only change code above this line
}
console.log(isEveryoneHere(users));
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.1 Safari/605.1.15
Challenge: Check if an Object has a Property
Link to the challenge:
What problems are you having?
I would look closely at the very first error message in the console below the editor.
2 Likes
Test cases are failing . I have attached test cases below
// running tests The
users
object should not be accessed directly The function
isEveryoneHere
should return
false
if
Alan
is not a property on the object passed to it. The function
isEveryoneHere
should return
false
if
Jeff
is not a property on the object passed to it. The function
isEveryoneHere
should return
false
if
Sarah
is not a property on the object passed to it. The function
isEveryoneHere
should return
false
if
Ryan
is not a property on the object passed to it. // tests completed // console output true true
This is the users
object being directly accessed in the function.
system
Closed
6
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.