Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Posible solucion a auto mas caro #18

Open
tefanga opened this issue Jun 27, 2019 · 1 comment
Open

Posible solucion a auto mas caro #18

tefanga opened this issue Jun 27, 2019 · 1 comment

Comments

@tefanga
Copy link
Contributor

tefanga commented Jun 27, 2019

function autoMasCaro(){
    var auto = [];
    auto[0] = autos[0];

    autos.forEach(function(elemento){
        if (elemento.precio > auto[0].precio)
        {
            auto[0] = elemento;
        }
    });

    return auto[0].marca + " ($" + auto[0].precio + ")"
}
@cabutia
Copy link
Owner

cabutia commented Jun 27, 2019

Auto no deberia ser un array, solo se usa el indice cero. Bien podria declararse asi:

var auto = {};

Si lo cambias y haces un PR te lo mergeo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants