var type = "chance"; //or "chest" ;
var title = cards.type[0].title; //type is variable not an actual property of cards
Instead of typing the name of a property I want to use a variable, because it can be either cards.chance[0].title or cards.chest[0].title