Function syntax problem with var and fuction



<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>


Replace this line with your code.

<do not remove the three backticks above>


Share your code, any errors that you are receiving, as well as any questions that you have. Then we’ll have the information we need to be able to help you.


var sayGreat to see you = function (Ali) {
console.log(“Great to see you,” + " " + “Ali”);
i really tried a lot of ways so i can succeed but nothing worked i really do need help
i am not going to proceed working till i finish this one because i think everything is attached to each other
help me please


First Problem - Variable Name

A variable is a symbol that represents (points to) some value or information. You create a variable using a contiguous string of characters. A typical coding standard is to use camelCase.

What do you notice about camelCase?

  1. It’s a contiguous string of characters, meaning no spaces between the characters.
  2. The first word’s character is in lowercase (as in camel), while the first character of other words is capitalized (as in Case).

Now look at your variable: sayGreat to see you. What’s wrong with your variable name? Try to fix it yourself.

Problem 2 - Make the Function Reusable

Instead of hard-coding a string literal of Ali, we make our function’s reusable by defining a function parameter. That parameter can accept different names. Then you use that parameter within the message that you are printing out.

Take a look at the example given to help you figure it out:

var sayHello = function(name) {
    console.log('Hello ' + name);

Finally, Call It

On line 11, call you function using the variable you gave it, followed by (, your name, and then the closing ).

Try it for yourself.


i tried it without say it didn’t work but i didn’t understand on line 11
what should i do??


How do you make a function run? The description in that lesson explains it to you.

Let’s look at the example:

var sayHello = function(name) {
    console.log('Hello ' + name);

and to make that run you do this:


Notice how you are calling the function by the variable sayHello. Then you wrap the name 'Emily' inside of the parentheses.

Okay, adapt that code pattern to your code.

Take a little time to reread the lesson. Look at the example code they give you. Then adapt that to your code.

Try it yourself.

If you get stuck, share what you have and we’ll keep working through it together.


I’m having trouble with function syntax in java script.
It will run. it seems to be correct but it continues to say you did not call the greeting function. Pass it a name.
Can you help.


Hey @jdimetric12,

Go ahead and create a new forum post just for your question. Make sure you share your code, any errors, and notes or questions for us too. That gives us the information we need to better help you out.

Cheers :slight_smile:


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