Tip 30: Simplify Key-Value Assignment

In this tip, you’ll learn how to make objects quickly with shortened key-value assignment.

You just learned how to pull apart objects in a clear and clean way. Now that you have all those pieces laying out on your proverbial work bench, you need to put them back together. It wouldn’t be any good if the writers of the spec gave you a clean interface to take objects apart while leaving you no way to put them back together.

Building objects

Well, you’re in luck. The same technique you’d use to take objects apart works in reverse. It’s time to build new objects using similar syntax that will leave your code clear and predictable.

Start with a similar object of photo information:

Get hands-on with 1200+ tech skills courses.