added javascript code to split cards into array