You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Clément aec49bda47
clarify fusion subject with examples
4 years ago
..
README.md clarify fusion subject with examples 4 years ago

README.md

Fusion

Instructions

The objective of this exercise is to merge objects into a new object depending on the values type

With this create a function called fusion that:

  • If the type is an array you must concat it
fusion([1,2], [3,4]) // -> [1,2,3,4]
  • If it is a string you must concatenate with a space
fusion('Salem', 'alem') // -> 'Salem alem'
  • If it is numbers you must added them
fusion(4, 11) // -> 15
  • In case of type mismatch you must replace it with the value of the second object
fusion({ a: 'hello', b: [] }, { a: 4 })
// -> { a: 4, b: [] }
  • If it is an object you must fusion them recursively
fusion({ a: 1, b: { c: 'Salem' } }, { a: 10, x: [], b: { c: 'alem' } })
// -> { a: 11, x: [], b: { c: 'Salem alem' } }