Is a PhD visitor considered as a visiting scholar? It takes an element as argument and check if it is equal to the other element. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. Note: This method works only when both array objects are sorted in the same fashion. Regarding your comment, here is a solution: You could just iterate over a and use Array.prototype.indexOf to get the index of the element in b, if indexOf returns -1 b does not contain the element of a. Content available under a Creative Commons license. $('#a')[0] == $b[0] // not always true Every time you call the jQuery() function, a new object is created and returned. So even equality checks on the same selectors will fail.