Today I Learned

hashrocket A Hashrocket project

Default Arguments in JS Object Destructuring

JavasScript's ES6 object destructuring feature supports default arguments. Here's an example of this super cool syntax:

> const newObj = { one: 1 }
undefined
> const { one, two = 2 } = newObj;
undefined
> one
1
> two
2
See More #javascript TILs
Looking for help? At Hashrocket, our JavaScript experts launch scalable, performant apps on the Web, Android and iOS. Contact us and find out how we can help you.