JavaScript 4/7 Parameters II i need help!


#1

For step one it asked me to use a parameter crustType so this is what i have:

function takeOrder(topping, crustType) {
console.log('Order: pizza topped with' + topping);
takeOrder('bacon');
}

takeOrder();

Can someone explain how this is wrong?


#2

I think it should be something like this:

function takeOrder(topping, crustType)
{
  console.log('Order: pizza topped with' + topping);
  console.log('And crust type' + crustType);
}
takeOrder(bacon, crust);

First, you wanna define the takeOrder function, who receives two parameters.
Check out your code, you called takeOrder('bacon') inside the function (and with the wrong params but still).
The same way you used the first parameter, you should use the second one.

When calling the function, you do it outside and after you finished defining it. Pay attention to the brackets! In the call, you should send two parameters of your liking (they are strings).
If the function has parameters, you have no choice but to use them when calling the function. Otherwise you're calling something that doesn't exist or a diferent one.
function dividing(a, b){//something} >>define it
dividing (10, 2) >> call it


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.