3 Trying it al together


#1

var greeting = function (name) {
      var name = "Bob";
      console.log(name);
};

gives an error: you did not call the greeting fuction. Pass it a name

Where do I go wrong?


#2

remove this line:

var name = "Bob";

it overwrites the function parameter, then after the function add a function call, a function call exist out the function name + parentheses and between the parentheses supply the arguments needed to satisfy the function parameters.


#3

Thanks.

Removing the line
var name= "Bob";
does not solve the problem.

console.log(name) should give me the value of var (name),
which is set to Bob as far as I do understand it. So if changing that
value to Rick, the output should be Rick, if I'm right.


#4

this was step 1 in solveing the problem.

if you add a function cal with bob, then name is set to bob indeed:

greeting("Bob")

the function call should be after the function


#5

I'm dutch, so may be it's that I do not understand it because of that.

This is what I'm asked to do:

FIx the function on line 9:

greeting var func{name}9console.log(name))}

Unfortunately there are not, as usual, hints given for solving this problem.


#6

dit is de code die je in het begin van de oefening te zien krijgt:

// Below is the greeting function!
// See line 7
// We can join strings together using the plus sign (+)
// See the hint for more details about how this works.

var greeting = function (name) {
    console.log("Great to see you," + " " + name);
};

// On line 11, call the greeting function!

in de information van de oefening staat het volgende:
You can run this code by "calling" the function, like this:

sayHello("Emily");

Calling this function will print out Hello Emily

dus om een functie uit te voeren moet je de functie aanroepen (function call), hebben we de functie naam nodig, in jou geval greeting gevolgd door ronde haakjes met daar in het argument. dus bijvoorbeeld:

greeting("Bob")

"Bob" hier dus het argument. plaats de functie aanroep op regel 11


#7

Thanks. I was not looking where I should!


#8

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