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.
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 Simplifying JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.