ECMAScript-regrets icon indicating copy to clipboard operation
ECMAScript-regrets copied to clipboard

Non-intuitive if(!'property' in object)

Open DavidBruant opened this issue 12 years ago • 2 comments

!'property' in object is interpreted as (!'property') in object (=> false in object) which is not what people want the vast majority of the time. Where writing this, people want to know if a property is not present in an object (!('property' in object))

DavidBruant avatar Jun 08 '13 17:06 DavidBruant

I could definitely see having in bind tighter than !.

ghost avatar Jun 08 '13 18:06 ghost

Thanks eslint http://eslint.org/docs/rules/no-unsafe-negation

DavidBruant avatar Oct 19 '16 13:10 DavidBruant