One possible way:
const result = doSomething(),
{ a, b } = result;
You still have to duplicate the name, though. const
token isn’t quite right-handy. )
More Related Contents:
- Unable to use Arrow functions inside React component class [duplicate]
- One-liner to take some properties from object in ES 6
- Unable to access React instance (this) inside event handler [duplicate]
- Using Node.js require vs. ES6 import/export
- Why does babel rewrite imported function call to (0, fn)(…)?
- Call async/await functions in parallel
- Getting Unexpected Token Export
- Extending built-in natives in ES6 with Babel
- How can I clone a JavaScript object except for one key?
- Can’t require() default export value in Babel 6.x
- Browserify, Babel 6, Gulp – Unexpected token on spread operator
- Is there any one-line analogy in ES6 for ES5 `module.exports = require(‘./inner.js’)`?
- Why doesn’t instanceof work on instances of Error subclasses under babel-node?
- SyntaxError: ‘import’ and ‘export’ may appear only with ‘sourceType: module’ – Gulp
- Extending Error in Javascript with ES6 syntax & Babel
- What are “class fields” in JavaScript?
- How to publish a module written in ES6 to NPM?
- Best way to polyfill ES6 features in React app that uses create-react-app
- ES6 `export * from import`?
- Error: Missing class properties transform
- JavaScript object destructuring and aliasing
- VSCode Linter ES6 ES7 Babel linter
- Difference between import X and import * as X in node.js (ES6 / Babel)?
- “unexpected token import” in Nodejs5 and babel?
- How to run Node.js app with ES6 features enabled?
- Transpile Async Await proposal with Babel.js?
- require(‘babel/register’) doesn’t work
- Re-export default in ES 6 modules
- gulp babel, exports is not defined
- Exporting functions with reactjs and babel