2/4 Somehow doesn't work

var bob = {
    firstName: "Bob",
    lastName: "Jones",
    phoneNumber: "(650) 777-7777",
    email: "bob.jones@example.com"

var mary = {
    firstName: "Mary",
    lastName: "Johnson",
    phoneNumber: "(650) 888-8888",
    email: "mary.johnson@example.com"

var contacts = [bob,mary];

// printPerson added here
var printPerson=function(person){
  return person.firstName+" "+person.lastName;


Tried this code on a webpage using alert instead of return and it worked, tried refreshing and still the same problem, it only shows "Mary Johnson"


The output you are seeing is the response from the command line interpreter to the last executed statement,

return person.firstName + " " + person.lastName;

What we see is the return value of printPerson(contacts[1]);. To fix this, have your function log the output, rather than return it.

console.log(person.firstName + " " + person.lastName);

It works, but it seems wrong

++++ function with 1 parameter using return-statement

var myFunction = function( param1 ) {
       //Begin of FUNCTION-BODY
       //myFunction =function= has 1 PARAMETER param1
       //this param1 PARAMETER is used as a -local- VARIABLE
       //throughout the FUNCTION-BODY

      return param1;

      //End of FUNCTION-BODY

you have defined a myFunction function
which takes 1 parameter param1
this param1 parameter is used
as a variable throughout the FUNCTION-BODY.

If you want to call/execute this myFunction function
and this myFunction function was defined
as having 1 parameter param1
you will have to provide 1 argument
in our case a "number VALUE" 4
myFunction( 4 );

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


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


As you are using the return-statement
you might try using
console.log( printPerson(contacts[0]) );
console.log( printPerson(contacts[1]) );


Thanks for the replies i understand better now.