Tying it all together



I am getting an error "SyntaxError: 'Expected ';'

var greeting = function(name){
console.log("Hello" + " " + name);


The code looks fine when I ran it the console accepted it as correct can you include a screen shot.


You may have altered some of the other code on the page rendering the error.


Sorry having problems uploading screen shot. I have tried by resting code several times but still does not work


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

// Badly written function with syntax errors!


And it worked!


Thanks but according to the question I have to rewrite this badly written code
greeting var func{name}(console.log(name)))}

I tried
var greeting = function (name){
console.log("Hello" + " " + name);

but keep getting syntax error


i see what your problem is now you need to comment out the original "badly" written code

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


or just delete that chunk all together. your code is good though


Thanks heaps for the help. I have been puzzling over this for sometime. I works now when I comment the badly written code


No problem glad I was able to help, I know I've been in the same position before staring for days trying to find out were I went wrong and usually it was some sort of typo or something I was missing.


you can use this if you have any problem
var greeting = function (name) {
console.log("hello," + " " + name);};


Here's mine and no error...

var greeting = function(name){

console.log("Hello" + " " + name);




Thanks for your help. Got it


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