#841 ✓resolved
Alexey Bass

Array#intersect return wrong result if array values has 0

Reported by Alexey Bass | October 22nd, 2009 @ 08:02 PM

// using Prototype v1.6.1

[0, 1, 2].intersect([1, 2])
// -> [1, 2] - OK

[0, 1, 2].intersect([0, 1])
// -> [1] - FAIL, should be [0, 1]

With blatyo's implementation from #794 it works as expected

// using Prototype v1.6.1

Array.prototype.oldIntersect = function(array){
  return this.without.apply(this, this.without.apply(this, array));
}

[0, 1, 2].oldIntersect([1, 2])
// -> [1, 2] - OK

[0, 1, 2].oldIntersect([0, 1])
// -> [0, 1] - OK

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

Attachments

Pages