creating a new array using each or map