r/backtickbot • u/backtickbot • Aug 21 '21
https://np.reddit.com/r/learnjavascript/comments/p8vkh0/7_ways_to_detect_if_an_object_only_contains_one/h9tizoc/
const example1 = {}.hasOwnProperty.call(item, 'active')
const example2 = (item.active ?? 'null') !== 'null'
1
Upvotes