-3

I just want to know if those 2 statements are equals or not, JS makes me mad and its behavior remain too esoteric. Within my app, it occurs some strange results ...

value in item and item.hasOwnProperty(value)

Thanks in advance

Denys Séguret
  • 372,613
  • 87
  • 782
  • 758
benftwc
  • 434
  • 6
  • 19
  • https://stackoverflow.com/questions/13632999/if-key-in-object-or-ifobject-hasownpropertykey – justMe May 07 '18 at 14:12

1 Answers1

1

in also looks up the prototype tree while hasOwnProperty only checks the object itself.

Jonas Wilms
  • 132,000
  • 20
  • 149
  • 151
  • Oh ? Thanks for answer, so my problem should come from the prototype .. I'll check that, thanks again :) – benftwc May 07 '18 at 14:17