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

133
Views
Why exercism.org doesn't accept my solution JS?

I just started with exercism and doing Javascript exercise 2, Lucian's Luscious Lasagna.

I wrote all the code on my VSCode and it all worked fine. but when I insert it in the editor on exercise, it shows errors and doesn't accept it. It is also showing some things I haven't seen like 'export' before 'const' and 'throw new Error' inside the function. I'm really not sure how this works. How can I do it in a way that exercism editor would accept?

const PREPARATION_MINUTES_PER_LAYER = 2;
const EXPECTED_MINUTES_IN_OVEN = 40;

function remainingMinutesInOven(actualMinutesInOven) {
  return EXPECTED_MINUTES_IN_OVEN - actualMinutesInOven;
}

console.log(remainingMinutesInOven(30));

function preparationTimeInMinutes(numberOfLayers) {
  return numberOfLayers * 2;
}

console.log(preparationTimeInMinutes(2));

function totalTimeInMinutes(numberOfLayers, actualMinutesInOven) {
  return numberOfLayers * 2 + actualMinutesInOven;
}
console.log(totalTimeInMinutes(3, 20));

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your answer is correct, but as you wrote it in vs code and testing in exercism, it is not going to work, because you haven't exported anything. To test, you have to export your variables and function

This should work:

export const PREPARATION_MINUTES_PER_LAYER = 2;
export const EXPECTED_MINUTES_IN_OVEN = 40;

export function remainingMinutesInOven(actualMinutesInOven) {
  return EXPECTED_MINUTES_IN_OVEN - actualMinutesInOven;
}

console.log(remainingMinutesInOven(30));

export function preparationTimeInMinutes(numberOfLayers) {
  return numberOfLayers * 2;
}

console.log(preparationTimeInMinutes(2));

export function totalTimeInMinutes(numberOfLayers, actualMinutesInOven) {
  return numberOfLayers * 2 + actualMinutesInOven;
}
console.log(totalTimeInMinutes(3, 20));

about 4 years ago · Juan Pablo Isaza Report
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!