Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

268
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!