Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

270
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda