Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

ES6 destructuring syntax #368

Closed
adidahiya opened this issue Apr 20, 2015 · 0 comments
Closed

ES6 destructuring syntax #368

adidahiya opened this issue Apr 20, 2015 · 0 comments
Assignees
Milestone

Comments

@adidahiya
Copy link
Contributor

microsoft/TypeScript#240

some test cases, from this Mozilla blog post:

var [,,third] = ["foo", "bar", "baz"];
var [head, ...tail] = [1, 2, 3, 4];
var robotA = { name: "Bender" };
var robotB = { name: "Flexo" };

// renaming properties
var { name: nameA } = robotA;
var { name: nameB } = robotB;

// default values
var { x = 3 } = {};

// default values in a function param
jQuery.ajax = function (url, {
  async = true,
  beforeSend = noop,
  cache = true,
  complete = noop,
  crossDomain = false,
  global = true,
  // ... more config
}) {
  // ... do stuff
};
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant