33/33 I get a weird return when I test my code


#1

So, the course is letting me pass, but when I try to declare a specific circle and test the function, I get a weird response in the console.

Here's my code:

function Circle (radius) {
this.radius = radius;
this.area = function () {
return Math.PI * this.radius * this.radius;

**};**
**// define a perimeter method here**
**this.perimeter = function() {**
    **return 2*Math.PI*this.radius;**
    **};**

};

var rex = new Circle (2);

console.log(rex.perimeter);

Again, the course is acting like this works, but [Function] is the only thing showing up in the console. Why won't it actually perform the math for my circle named "rex?"


#2

If you want to execute a *function** you use a pair-of-parentheses-( )
Thus
console.log( rex.perimeter() );


#3

the FUNCTION talk

var myFunc = function( param1, param2) {
       //Begin of  anonymous FUNCTION-BODY
       //VARIABLE -myFunc- has an -anonymous function- assigned
       //this -anonymous function- has 2 PARAMETERS param1 and param2
       //param1 and param2 PARAMETERS are used 
       //as -local- VARIABLES throughout the FUNCTION-BODY

      console.log( param1 + " and " + param2 ) ;

      //End of anonymous FUNCTION-BODY
};

If you want to call/execute the anonymous function
you will have to add a pair of parentheses to the variable myFunc
like
myFunc();
As the anonymous function was defined
as having 2 parameters
you have to provide 2 arguments
in our case 2 string VALUES "Alena" and "Lauren"
like
myFunc("Alena","Lauren");

some quotes from the outer-world:

**argument is the value/variable/reference being passed in,
parameter is the receiving variable used within the function/block**

OR

**"parameters" are called "formal parameters",
while "arguments" are called "actual parameters".**