Skip to content

Instantly share code, notes, and snippets.

@easierbycode
Created April 26, 2016 21:33
Show Gist options
  • Save easierbycode/ceb0d374f1c28177d3131db719bf8beb to your computer and use it in GitHub Desktop.
Save easierbycode/ceb0d374f1c28177d3131db719bf8beb to your computer and use it in GitHub Desktop.
destructuring and renaming from previously declared variables
'use strict';
let salary = {
low: '32000',
average: '50000',
high: '90000'
};
let newLow, newAverage, newHigh;
({ low: newLow, average: newAverage, high: newHigh } = salary);
console.log( newHigh );
// '90000'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment