A question of coding


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?


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);


I believe you will find an answer here:


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