9. Functions with 2 parameters


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-6LzGd/2/1?curriculum_id=506324b3a7dffd00020bf661#


I'm not really stuck but I believe there might be a bug or glitch.

So the instructions tells you to create a function called perimeterBox with two parameters that returns the perimeter of a rectangle. It then tells you to call the function and pass any value for width and length.

So my first instinct was to create the function using return rather than console.log and then call the function as seen in "1." in the code below. This results in the following error message:
"Oops, try again. Did you define a perimeterBox function?"

So I then repeat the code, this time using console.log as shown in "2." in the code below. This results in the same error message.

So now I'm thinking "Let me double check to see if the function code is done correctly..." I delete the line that calls the perimeter function as shown in "3." in the code below and the error message disappears and I am able to proceed.

This, in my opinion is a bug in the instructions or in the compiler since the instructions tell me to "Call the function and pass in any value for length and width you like."

Can someone please confirm this?
How do we notify codecademy? Since there is no area to report bugs...


1.
var perimeterBox = function(length, width) {
    return perimeterBox = length + length + width + width;
};

perimeterBox (4,5)

2.
var perimeterBox = function(length, width) {
    console.log(perimeterBox = length + length + width + width);
};

perimeterBox (4,5)

3.
var perimeterBox = function(length, width) {
    return perimeterBox = length + length + width + width;
};


#2

HI there are no glitch in these lines

1. return perimeterBox = length + length + width + width;
2. console.log(perimeterBox = length + length + width + width);
3. return perimeterBox = length + length + width + width;

in all these lines you don't need of the

perimeterBox =

if you remove it it will works


#3

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