This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getCombinations = (availableNumbers = [], length = 0) => { | |
if(length === 0) { | |
return [] | |
} | |
if(availableNumbers.length < length) { | |
return [] | |
} | |
if(length === 1) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const numbers = [5, 8, 1, 0, 10, -4]; | |
// Tanto usingFunction como usingArrow resultan en [5, 8, 10] | |
const usingFunction = numbers.filter(function(number){ | |
return number > 3; | |
}); | |
const usingArrow = numbers.filter(number => number > 3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Son equivalentes | |
(/* argumentos */) => { return valor } | |
(/* argumentos */) => valor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Son equivalentes | |
(argumento) => { /* ... */ } | |
argumento => { /* ... */ } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Función anónima | |
function(/* parámetros */) { | |
/* cuerpo */ | |
} | |
// Función flecha | |
(/* parámetros */) => { | |
/* cuerpo */ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Bienvenido ' + nombre + ', son las ' + (new Date().getHours() + 1) + ' horas'; | |
`Bienvenido ${nombre}, son las ${new Date().getHours() + 1} horas`; |