+ 6

Point 2.
The function calc take two parameters: number of adults and number of children. This is okay.
Now with it you need to calculate the total prices for adults as well for children.
After that you calculate the sum of them and return it.

+ 2

The point 2. is not solved. You return only the sum of people.

0

Functions are useful when we need to take inputs and generate an output.
Let's replace our price calculation with a function call!
Tasks:
1. Create a function called calc(), which takes two parameters, adults and children.
2. Calculate and return the ticket price from the function.
3. Replace the code that assigns the price variable to the price calculation formula with the function call.
Hint: This is how the price variable should be assigned a value, when the calc() function is defined:

0

I need help

0

Hi, I also had some issues with this question, but this is what I did to pass:
Looking at your code, you still have the price variable set to this:
let price = adults*12 + children*6;
This needs to be changed to what they have hinted which is:
let price = calc(adults, children);
Overall this is what my code looked like, and it passed through:
let adults = 42;
let children = 8;
// let price = adults*12 + children*6; <!--this was commented out, but you can delete this -->
let price = calc(adults, children); <!--Where I added the new code to replace the code above from the hint-->
if (adults < 0 && children < 0){
return 0
}
for(let i=1; i<=adults ; i++){
console.log("Ticket #" + i)
}
function calc(adults, children){
return adults + children
};
console.log(price)
I hope this helps. I also had issues with the website, where I had to log back in so the answer was finally accepted, as the console was fine.
If anyone has any improvements on this, please share!