Skip to content

Instantly share code, notes, and snippets.

@docentedev
Created August 21, 2019 05:42
Show Gist options
  • Save docentedev/e3bda273d16169c7edaf00248739c7cd to your computer and use it in GitHub Desktop.
Save docentedev/e3bda273d16169c7edaf00248739c7cd to your computer and use it in GitHub Desktop.
Functions and refactor to Arrow Functions
// 01
// funcion
function a(n1, n2) {
return n1 + n2;
}
// funcion flecha refactorizada
const a = (n1, n2) => {
return n1 + n2;
};
// 02
// funcion
[1,2,3,4,5].map(function(e) {
return {
numero: e,
};
})
// funcion flecha refactorizada
[1,2,3,4,5].map(e => ({ numero: e }));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment