Today I learned the new way in ES6 to use a dynamic key to access or assign an object property.
ES6 enables developers to create or access an object by dynamic keys or names:
You can think of many ways you can apply this to your coding scenario. How about the case where you might need to create an object with an increasing number in the key name?
Or, when you want to replace an item in an array with a dynamic index 😉
Object.assign function is used to copy the values of all of the enumerable own properties from one or more source objects to a target object
Read more about it here: https://www.ecma-international.org/ecma-262/6.0/#sec-object.assign