Web Analytics Made Easy -
StatCounter Functions - CodingForum

Announcement

Collapse
No announcement yet.

Functions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Functions

    for one im kinda confused by functions

    Look at line 9. It has many syntax errors. See how lack of spacing makes debugging hard?
    Fix the function on line 9. Make sure the syntax is right. Make sure it looks nice.
    Call the greeting function once it is fixed! Don't forget to pass in a specific name.

    1: // Nicely written function:
    2: var calculate = function (number) {
    3: var val = number * 10;
    4: console.log(val);
    5: };
    6:
    7: // Badly written function with syntax errors!
    8:
    9: greeting var func{name}(console.log(name)))}


    i dont know how to call the greetings and to fix line 9 i think this is how but I'm pretty sure its wrong.
    9: calculate (20)

  • #2
    Rearrange the code in line 9 so it is the same way around as lines 2 thru 5.

    Note that you are not trying to call the calculate function you are trying to define the greeting function.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

    Comment

    Working...
    X