forked from soyHenry/WILL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02.js
executable file
·25 lines (18 loc) · 838 Bytes
/
02.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
Importante:
No modificar ni el nombre ni los argumetos que reciben las funciones, sólo deben escribir
código dentro de las funciones ya definidas.
No comentar la funcion
*/
function stringMasLarga(strings) {
// La función llamada 'stringMasLarga', recibe como argumento un arreglo de strings llamado 'strings'
// y debe devolver el string más largo que hay en el arreglo (Es decir el de mayor cantidad de caracteres)
// Ej:
// stringMasLarga(['hi', 'hello', 'ni hao', 'guten tag']); debe retornar 'guten tag'
// stringMasLarga(['JavaScript', 'HTML', 'CSS']); debe retornar 'JavaScript'
// Tu código aca
let largeWord = strings.reduce((acc, val) => acc.length > val.length ? acc : val, '');
return largeWord;
}
// No modifiques nada debajo de esta linea //
module.exports = stringMasLarga