-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02.js
25 lines (23 loc) · 903 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
var masLarga = "";
for (var i = 0; i < strings.length; i++) {
if (strings[i].length > masLarga.length) {
masLarga = strings[i];
}
}
return masLarga;
}
// No modifiques nada debajo de esta linea //
module.exports = stringMasLarga