Lesson 5


#1

what is wrong with the code???

// 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)))}


#2

you need to make your badly written code:

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

good, so you need to fix all the bugs in it. And believe me, there are quit a few bugs in the badly written code


#3

greeting var func((name)(console.log(name)));

???


#4

no, take a look at the nice function, the var keyword should come first, then the function parameter (with brackets (()), then the function, which use curly brackets ({})

and the var greeting is (=) a function (function, not func), there are so many syntax problems in this code


#5

i cant understand:

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

???


#6

var greeting = function(name)
{
console.log("mt name is" + " " +name);
};
greeting("shai");

tnx stetim94