Lesson 5: tying it all together I'M STUCK HELP ME :D


#1

hi guys,

this is the exercise:

// Nicely written function:
var calculate = function (number) {
var val = number * 10;
console.log(val);
};

// Badly written function with syntax errors!

greeting var func{name}(console.log(name)))} ===> write this code nice is the exercise!

my answer:

var = greetings (name) {
console.log(name);
};

greetings("floris");

i get an error


#2

the name of the function, (greetings), needs to be on the left side of the equal sign, after var. You also need the word function before the parameter, name.


#3

thank you for your answer, but I still don't get it..

Can you write the code, because I still get an error..


#4

var greetings = function (name)


#5

look at

the syntax of this code ^.

it goes

var functionName = function(parameters) {
    //inside of the function you indent and write 
    //what you want to do, such as 
    console.log(name);
}

That means you just need to replace the words functionName and parameters with greetings and name respectively.


#6

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