My goal is to display a deck of cards on a webpage. There will be one button on the page per suit of cards, so four buttons for Hearts, Diamonds, Clubs, Spades, respectively. Wh
You are checking for index
in displayedCards
which will always return -1 as you are pushing the object into it not the index. So the line of code
if(!$.inArray(index, displayedCards) > -1 && deck[index].suit == "Hearts")
Should be
if(!$.inArray(c, displayedCards) > -1 && deck[index].suit == "Hearts")