Object.assign() is a method that permit to merge two or more variables.

A simple example taken from documentation of Google Chrome.

// Merge an object
let first = {name: 'Tony'};
let last = {lastName: 'Stark'};
let person = Object.assign(first, last);
You can use also to convert an array to object (with spread operator)

const hash = Object.assign({}, ...array)
Object.assign() is useful also for clone an object

let obj = {person: 'Thor Odinson'};
let clone = Object.assign({}, obj);
The syntax is something like:

Object.assign(target, elementsToMergeInsideTarget)