-1
I need to return with a function all the numbers of a array larger than the one reported by the user. With the function I did here it is only returning the first number of the array, and I need to return the array complete.
function maiorNumero(array, numero)
{
array = [70, 2, 9, 65, 5, -1, 0, 89, -5]
numero= 7
for(var i = 0; i < array.length; i++)
{
if(array[i] > numero)
{
return array[i]
}
}
}
console.log(maiorNumero())
This function returns 70. The return I need is 70, 9, 65, 89.
Have you tried using Map, Reduce or Filter?
– M. Bertolazo