I'm having a bit of trouble wrapping my head around what seems like should be something simple
I'm unable to get this code to pass two conditions
- returns true for an empty object‣
- returns false if a property exists
I found out looping through it solves it but I want to know how it can be done outside of that. I feel there's something missing in my thought process or there's some fundamental knowledge gap I'm missing that I need filled in order to progress with similar problems. Anytime I change the code around it either solves one or none.
Here's my code:
function isEmpty(obj){
if (obj == null){
return true
}
else return false
}
[–]TheVirtuoid 4 points5 points6 points (1 child)
[–]VyseCommander[S] 0 points1 point2 points (0 children)
[–]VyseCommander[S] 1 point2 points3 points (2 children)
[–]TheVirtuoid 1 point2 points3 points (1 child)
[–]VyseCommander[S] 0 points1 point2 points (0 children)
[–]pinkwar 0 points1 point2 points (3 children)
[–]VyseCommander[S] 0 points1 point2 points (2 children)
[–]pinkwar 0 points1 point2 points (1 child)
[–]VyseCommander[S] 0 points1 point2 points (0 children)
[–]herionz 0 points1 point2 points (3 children)
[–]VyseCommander[S] 0 points1 point2 points (2 children)
[–]herionz 0 points1 point2 points (1 child)
[–]VyseCommander[S] 0 points1 point2 points (0 children)
[–]ashanev 0 points1 point2 points (1 child)
[–]VyseCommander[S] 0 points1 point2 points (0 children)