hasOwnPropery is a great way to prevent you from looping though the object prototype. Sorry, but I can't see any reason not to.
Where I agree with you, it's that you perform an unnecessary check. The best IMO, it not to avoid hasOwnPropery, but to prefer other loops like for( ... of ... ) or Object.keys().forEach().
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
hasOwnPropery
is a great way to prevent you from looping though the object prototype. Sorry, but I can't see any reason not to.Where I agree with you, it's that you perform an unnecessary check. The best IMO, it not to avoid
hasOwnPropery
, but to prefer other loops likefor( ... of ... )
orObject.keys().forEach()
.