Debugging bad function syntax


Here is the code given:

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

// Badly written function with syntax errors!

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

....Does anyone know how to debug line 9 -- greeting var func{name}(console.log(name)))} -- and fix the syntax?


can you gist your code? it looks to me as if there are some problems with the curly braces and the parenthesis bude i'd like to look at the line in context :wink:


to me without knowing seeing your code this would make sense:-

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


Just edited to use the preformatted text button. Try to always use it :smile:
As @paddydrum said it is missing an opening brace {

All functions need an opening and closing {} to show what code needs to be run when the function is called.


to add to that alex when I was taught to code my lecturer said when writing code if you create an open brace add the closing one to start with and write between so you don't get mixed up :wink: