DEV Community

Discussion on: Javascript ES6: Destructuring with default values

Collapse
 
athimannil profile image
Muhammed Athimannil

helpful information 👌

Is it possible to rename the destructured variable with the default value?

does it work?

const { amount  =  0 : bill } = options;
Enter fullscreen mode Exit fullscreen mode
Collapse
 
rafaacioly profile image
Rafael Acioly

This is not possible unfortunately

Collapse
 
athimannil profile image
Muhammed Athimannil

Got it

const  { amount : bill = 0 } = options;
Enter fullscreen mode Exit fullscreen mode