fix: solution for checking if an object has a property (#19390)
Signed-off-by: Jonathan Grah <theflametrooper@gmail.com>
This commit is contained in:
parent
e6c9c6c124
commit
65d47b6eeb
@ -76,7 +76,12 @@ console.log(isEveryoneHere(users));
|
||||
|
||||
```js
|
||||
function isEveryoneHere(obj) {
|
||||
return users.hasOwnProperty('Alan', 'Jeff', 'Sarah', 'Ryan');
|
||||
return [
|
||||
'Alan',
|
||||
'Jeff',
|
||||
'Sarah',
|
||||
'Ryan'
|
||||
].every(i => obj.hasOwnProperty(i));
|
||||
}
|
||||
```
|
||||
</section>
|
||||
|
Loading…
x
Reference in New Issue
Block a user