Skip to content

Instantly share code, notes, and snippets.

@apolopena
Created January 15, 2019 09:17
Show Gist options
  • Save apolopena/26ed8d62c82270ea26680ad8e0481fc0 to your computer and use it in GitHub Desktop.
Save apolopena/26ed8d62c82270ea26680ad8e0481fc0 to your computer and use it in GitHub Desktop.
JavaScript: es6 destructuring an array of point arrays to and array of x, y location objects
const points = [
[1, 2],
[50, -10],
[110, 405]
];
points.map(([x, y]) => {
return { x, y };
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment