Why is it asking me if i have created a function? Im pretty sure i have!


#1

var list = function (friends) {
for (var key in object) {
console.log(object[key]);
}
};


#2

@epicrut,

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".**


#3

In the activity it is saying to have only one parameter and if this is the case, can u tell me how to solve it? thx


#4

@epicrut,

In your list function

var list = function (friends) {
    for (var key in object) {
          console.log(object[key]);
    }
};

you are using friends as parameter
but then in your FOR-loop you are using object
which should then be a variable of the type object.....

Change your code,
so that you use friends in your FOR-loop.

If you call the list =function=
you will have to provide 1 argument
which will be the object friends
like

list(friends);

#5

well dude. it requires us to put a FOR/IN loops btw and I tried doing for (friends) but now it giving an error saying it expects ' ; '


#6

it's because you have forgotten a ";" .
Look at the end of all your line.


#7

look at it again. I do have the ' ; ' so first look and then talk


#8

I can see why one would become combative in a given situation such as this. No answers have been forthcoming. The lesson asks for the key, not the value.

    console.log(key);

One might consider using more generic local variable names that give away their purpose, and let the program have free reign over custom names.

function list(obj) {
    for (var key in obj) {
        console.log(key);
    }
};
list(friends);