Skip to content

Instantly share code, notes, and snippets.

@macikokoro
Created August 1, 2014 03:00
Show Gist options
  • Save macikokoro/ac3a169c2be7068f280a to your computer and use it in GitHub Desktop.
Save macikokoro/ac3a169c2be7068f280a to your computer and use it in GitHub Desktop.
Mapping a function to unite first and last names into one cell.
var passengers = [ ["Thomas", "Meeks"],
["Gregg", "Pollack"],
["Christine", "Wong"],
["Dan", "McGaw"] ];
var modifiedNames = passengers.map(function(cell){ return cell[0] + ' ' + cell[1];});
console.log(modifiedNames);
//This will log: ["Thomas Meeks", "Gregg Pollack", "Christine Wong", "Dan McGaw"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment