Skip to content

Instantly share code, notes, and snippets.

@nsonnad
Created October 4, 2013 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsonnad/6827571 to your computer and use it in GitHub Desktop.
Save nsonnad/6827571 to your computer and use it in GitHub Desktop.
Gist from mistakes.io
categories = ["funny", "stupid", "sad", "embarassing"];
tabData = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]];
mapped = categories.map(function(cat) {
return tabData.map(function(d) {
return {
name: cat, value: d[categories.indexOf(cat)]
};
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment