Intro to Functions: Typing it all together


Here i don't know what I am doing wrong, can someone help me out here please

// Nicely written function:

var calculate = function (number) {
    var val = number * 10;

// Badly written function with syntax errors!

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

2. How to call the greeting function when the above is fixed?

3. What does SYNTAX ERROR: "missing before statement" mean

The answer I gave was

var greeting= function(name) {

I don't know what I am doing wrong here please help!!


Hi here

var greeting= function(name) {

after it you should call it (the function greeting)


what do you mean by "after it you should call it (the function greeting)"?


When you write a function you want that the function print or return something so for example

//Here I create a function planet
var planet = function(from) {
//here I will call the function so that it will print something



ohhh ok now i got it :slight_smile: thank you :slight_smile:


But when i type in my answer it says SYNTAX ERROR: missing before statement


can you post your new code?


var greeeting = function(name) {


HI thsi line

var greeeting = function(name)

you wrote greeeting instead of greeting


ohh oops ok ill fix it and try again


It's still saying the same thing after I fixed it

This is the instructions that was given for the above

  1. A big part of programming is debugging. That just means
    figuring out what the heck went wrong with your code. Why didn't it run?

  2. Look at line 9. It has many syntax errors. See how lack of spacing makes debugging hard?

  3. Fix the function on line 9. Make sure the syntax is right. Make sure it looks nice.

  4. Call the greeting function once it is fixed! Don't forget to pass in a specific name.


can you post all your code not just this part..


that was all i had given for the answer... I was stuck and i still am, and I don't know how to answer this question...


yes but can I see all your code..


All code? I'm not getting you...

because they are only telling me to fix this code here and call a "greeting" function

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


yes I know and you did it

var greeting = function(name) {

but maybe you change something (or it's still missing osmething) in the function that was already there the calculate function so that why I want to see all your code...


ohh ok, but when I am entering its giving the same syntax error and now I'm just a little bit confused...


I can't help you or pointing where the error is if I don't see the code..