I need to know what is wrong with this cmd


#1



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

TypeError: perimeterbox is not a function

Replace this line with your code. 
// Write your function starting on line 3

perimeterbox (5,6);
var perimeterbox = function (length,width){return length + length + width + width;};


#2

a function call should be after the function declaration, you can't call something that doesn't exist


#3

@skydestroyerv,
If you assign a so-called anonymous function to a variable
like
var perimeterbox = function (length,width){return length + length + width + width;};
you can only call the =function= AFTER the definition......
like

var perimeterbox = function (length,width){return length + length + width + width;};
perimeterbox (5,6);

You could however
define a so-called named-function
like
function perimeterbox(length,width){return length + length + width + width;};
then you could have used

perimeterbox (5,6);
function perimeterbox(length,width){return length + length + width + width;};

Have a read
http://stackoverflow.com/questions/336859/var-functionname-function-vs-function-functionname?rq=1

Reference

google search
== the Book ==
javascript [your question] site:developer.mozilla.org

== discussions / opinions ==
javascript [your question] site:stackoverflow.com

== guidance ==
www.crockford.com
http://javascript.crockford.com/code.html <---JavaScript code-convention
http://javascript.crockford.com/survey.html
https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript
www.developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
http://stackoverflow.com/questions/9549780/what-does-this-symbol-mean-in-javascript
http://stackoverflow.com/questions/3755606/what-does-the-exclamation-mark-do-before-the-function
http://stackoverflow.com/questions/6260475/how-to-the-operator


#4

how do i define the perimeterbox function. p.s thanks for the help


#5

@skydestroyerv,
Have a closer look at the Instructions,
concerning the required =function-name=

Then have a close look at

perimeterBox


#6

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