Do the following two statements produce the same output? Is there any reason to prefer one way to the other?

 if (key in object)

 if (object.hasOwnProperty(key))

8 Answers
8

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *