A question of coding


#1

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

Hey, I'm not actually stuck but I did have a question about the following exercise. I was originally trying to code this function using the console.log function but when I did that, it would give me two printouts: one of the perimeter and one of just the width. I soon realized I was supposed to use the return function and everything went smoothly from there, but why does the console.log function produce those two printouts? https://www.codecademy.com/en/courses/javascript-beginner-en-6LzGd/2/1?curriculum_id=506324b3a7dffd00020bf661

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
I included the lines of code in question, but I did end up using the return function instead.

``` var perimeterBox = function(length, width) { console.log (length + width +length +width); }; perimeterBox(2,4)
<do not remove the three backticks above>

#2

I believe you will find an answer here:


closed #3

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