Deep Merge Objectssource code

must create a function in JavaScript that performs a deep merge of two objects. The function should combine the properties of the two objects, including nested properties, into a new object.

Requiriments
  1. The function should take N parameters, but always objects.
  2. The function should return a new object that combines the properties of two parameters.
  3. If a property is present in many objects, the value of the property in the last parameter should overwrite the value in previous.
  4. If a property is an object and is present in many parameters, the function should recursively merge them.
  5. If the property is a number, sum the values
  6. If the property is an array, concat (Give the option of keep duplicateds)

Input 1


{ "a": "Test", "c": [ "a", "b" ], "d": { "e": "Test 1" }, "e": "Remove me", "h": "Show me 5", "i": { "j": 5, "k": { "l": 1, "m": 0, "n": [ { "key": "value" } ] } } }

Input 2


{ "b": 12.34, "c": [ "b", "c" ], "d": { "e1": "Test 2" }, "e": "Show me", "f": "Show me 2", "g": "Show me 3", "i": { "j": 5, "k": { "l": "1", "m": false, "n": [ { "key": "new value" } ] } } }

Output


{}