Confusion with perimeterBox


So I'm on the exercise that tackles creating a perimeter box, and I've played around with it and eventually got it to work but I have no idea why and I'm certainly sure this is not what I should've done.

Can anyone explain why this works and what exactly I did here because I have no idea:

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

the root of my confusion is that the exercise tells me to create a parameter with length and width, however I'm not sure if it's asking me to write length, width or if it's asking me to actually put a number for length and width.

I've tried another code more in-line with what it's asking, but it's come back with an error and honestly I'm just not getting it or understanding this part at all:

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

"Oops, try again. Make sure to call your perimeterBox function with any value for length and width. "

This doesn't work, and I'm not sure why - in the info section it mentions adding length + length + width + width but that's just confusing.

at the end it asks me to call the function perimeterBox but I've not managed to figure out how to do that, I feel I'm missing something here.


Woah that code raises all sorts of red flags :smile: I would say you just confused the SCT until it let you pass,

This exercise is just based on the formula for perimeter which is P = 2l + 2w,
programmatically that would be written assuming you have thearguents length and width,

perimeter = (length *2) + (width * 2)


Hah, figured as much -
Thanks for the reply dude.

What you've said makes some sense to me, I'll read over it a few more times and give it another bash.



Ah! I get it now, okay. I'm slow - Thanks bandit.


Programming takes time and patience, so in a way we're all slow :smile:


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