Spread Operator Object Array In Javascript Functions