Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

9
  • 13
    It is generally advised not to modify/expand the existing global objects. Commented Sep 30, 2015 at 12:48
  • 4
    better to use === rather than == right? Commented Feb 19, 2016 at 15:41
  • 1
    @ChetPrickles Depends on what you want, like always :-) Do you want undefined to be equal to null, 0 etc. - or not. Commented Feb 22, 2016 at 20:40
  • 1
    Ok. I just raed this topic because I was searching for the same thing but without the index equality. But okay you're right. Commented Dec 19, 2020 at 14:32
  • 1
    you can add this == array || at the start of the return to exit early if the arrays are the same object Commented Jul 19, 2022 at 23:07