Functions with two parameters - Getting two outputs?


#1


Functions with two parameters


When I run my function, it comes out with two outputs of the same value, and brings up the error "Oops, try again. It looks like your perimeterBox function doesn't return the correct perimeter (4) for a width of 1 and a length of 1." What exactly is causing this?


var perimeterBox = function(l, w)
{
    console.log(w+w+l+l);
};
perimeterBox(1,1)


#2

Write a function called perimeterBox that returns the perimeter of a rectangle.

Your statement doesn't return any value, it's just print result. Try instead console.log use 'return'.


#3

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