Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

272
Visualizações
Function comes back undefined(javascript)

Good morning,

I hope I am asking this correctly per guidelines. I am taking a course and am stuck on exercise 6. I was given limited information but have to solve this code.

My task is -

Rocket Cars wants you to create a function to calculate how many weeks it would take to sell all their cars. Your function contains 2 parameters:

The average number of cars sold per day
The number of cars currently in the dealership

Your function must be named 'SalesCalculator' and has to return a number which represents the amount of weeks it would take to sell all their cars.

To do so: divide the number of cars in the dealership by the average number of cars sold per day Multiplied by 5. Your function must return the result of this equation.

I was given this code to start with -

function SalesCalculator(amountOfCars, averageSoldPerDay) {
    return //code goes here
}

I have tried a bunch of ways but keep coming back with multiple different errors depending on what coding I try.

I have tried-

function SalesCalculator(amountOfCars, averageSoldPerDay) {
            return (amountOfCars / averageSoldPerDay) * 5;
         }
function SalesCalculator(amountOfCars, averageSoldPerDay) {
    let amountOfCars = a;
    let averageSoldPerDay = b;
    return a / b * 5;
}
function SalesCalculator(amountOfCars, averageSoldPerDay) {
    console.log(a / b * 5);
}

None of these have been accepted and I have tried a thousand different ways but so far I seem to be wrong.

Any help would be greatly appreciated I have been trying to figure this out for a couple of days.

Thanks!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda