The modification you made does result in not equal , but you actually didn't have to change it all, because the first object is an array and the second one is a range. The two were already not equal before you modified the array.