create function that accept an array
