DEV Community

Discussion on: 5 things that might surprise a JavaScript beginner/ OO Developer

 
wulymammoth profile image
David

Whoops — misread. I don’t see any reason anyone would write code like this. Moreover, your particular example doesn’t even quite express to the next programmer reading it why this is even needed. The exception being that you are debugging and wondering about what values are falsy. For the scenario that I illustrated, it’s better to write an if-expression checking the object key’s value for zero leaving absolutely no ambiguity

Some comments have been hidden by the post's author - find out more