What this wrong with this?


#1


https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/0/3?curriculum_id=506324b3a7dffd00020bf661


Oops, try again. There was a problem with your syntax.


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

// On line 11, call the greeting function!
greeting("Kathy");


#2

Problem is here:

var greeting = function("Kathy") {

What is the purpose of the function parameters? We use them to be able to send any data that we want to our function. Ok, you want to greet Kathy here, but what happens if in the future you will want to greet me? Will you create next function with the identical body? Nope.

In this exercise you have to define a parameter for your function, let's call it name and later use this parameter in the console.log to greet person with the name specified in the function call.


This is a scheme for you:

var greeting = function(name) {
    // console.log statement goes here, use name instead of "Kathy"
};

To test your function execute your function twice:

greeting("Kathy");
greeting("Maciej");

That's the power of functions.


#3

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