if(myCollection.length > 0){ versus if(myCollection.length){ would be the duel for the opposite JavaScript scenario I suppose. Which is best? Should you be idiomatic or explicit? At lunch today I asked coworkers what they thought and they agreed that idiomatic is ideal. It is certainly alright to do a truthy or falsey check around the length of an array.
No comments:
Post a Comment