Skip to content

Instantly share code, notes, and snippets.

@hrajchert
Last active April 29, 2017 03:40
Show Gist options
  • Save hrajchert/f1d5fa96873728f7c8f9da750b4adf04 to your computer and use it in GitHub Desktop.
Save hrajchert/f1d5fa96873728f7c8f9da750b4adf04 to your computer and use it in GitHub Desktop.
// ES6 (arrow function)
var miArray = [1, 2, 3];
miArray
// mas corta
.map(function (v) {
return v * 2;
})
// Con parentesis
.filter(function (v) {
return v > 3;
})
// Multiples argumentos
.sort(function (a, b) {
return b - a;
})
// Bloque de codigo
.map(function (v) {
console.log('una cosa');
console.log('otra cosa');
return 'otra otra cosa';
});
// Ejercicio
var miFuncion = function (a, b, c) {
console.log('a', a);
return a - b * 2 + c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment