Put if statement around slice in cards.js