Merging array of Objects in Javascript | Es6

We can use reduce function to merge array of objects in JavaScript, but you have to look out for a gotcha that is to provide an initialValue = {}; Here is the following code
function unproperMergeArrayofObjects(array){
    try{
       return array.reduce((a,b)=>Object.assign(a,b));
    }
    catch (err) {
        console.error(err);
        return null;
    }

}
function propermergeArrayofObject(array) {
    var initialValue={};
    return array.reduce((a,b)=>Object.assign(a,b),initialValue);
}

console.log('unproper',unproperMergeArrayofObjects([]));
var a={a:1};

Object Spread Operator | Cloning Object in Javascript

For cloning Javascript objects you can use following code,
var obj = { a: 1 };
var copy = Object.assign({}, obj);
console.log(copy); // { a: 1 }
A new term has been introduced the Object Spread Operator. It's not yet an official part of the language, but it did just recently reach Stage 3 proposal status, so it'll probably become official in ES2017 or ES2018. If you happen to be using the Create-React-App tool, that has the object spread Babel plugin already enabled.
var player = {score: 1, name: 'Jeff'};
var data=  {...player};