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.

Required fields*

10
  • const array1 = [1]; const array2 = [1, 1]; console.log(array1.join('') === array2.join('')) //returns true Commented May 7, 2017 at 17:58
  • it shouldn't: array1.join('') is '1' and array2.join('') is '11' Commented May 9, 2017 at 5:27
  • sorry, typo. The first array should be [11]. Pretty obvious as to why this happens and how to fix. Commented May 10, 2017 at 2:21
  • Not sure what you're about, it's pretty simple: [1].join() is "1" and [1,1].join() is "1,1", so they'll never be equal Commented May 11, 2017 at 15:01
  • 1
    Fails for [1,2] and ["1,2"]. Commented Jul 15, 2017 at 8:43