Write a method that takes in an array and an object. The method should return a new array where elements of the original array are replaced with their corresponding values