JavaScript : Count unique items in an array