Rishav February 2016
Coffeescript `in` operator doesn't work with 2D array
Checking for values in 1D arrays works..
coffee> 1 in [1,2]
coffee> [1, 1] in [[1, 1], [1, 2]]
Checking for values in 2D arrays doesn't.
Am I missing something, is this a bug or is this intended?
tyler February 2016
[1,1] === [1,1]
[1,1] == [1,1]
So it would be counterintuitive for coffeescript to do what you're proposing.
You could write your own method to do the comparison, or you could use something like Lodash's
isEqual() method https://lodash.com/docs#isEqual
Asked in February 2016
Viewed 2,531 times
Answered 1 times
Leave an answer
Quote of the day: live life