Grow your CSS skills. Land your dream job.

Function problems (scroll) NEW NAME

  • # June 24, 2013 at 8:24 pm

    http://www.codecademy.com/courses/javascript-beginner-en-6LzGd/0/3?curriculum_id=506324b3a7dffd00020bf661#

    I’m kinda stuck on this can someone help me?
    i’m thinking its this : but its not working. i know i’m wrong just dont know where

    var greeting;
    var name =”Attila”

    # June 24, 2013 at 9:03 pm

    You would call it like `greeting(‘Attila’);`

    # June 24, 2013 at 9:33 pm

    It would look like this:

    var greeting = function (name) {
    alert(‘Hello, ‘+name);
    }

    greeting(‘Jiggins’);

    # June 24, 2013 at 11:46 pm

    http://www.codecademy.com/courses/javascript-beginner-en-6LzGd/0/5?curriculum_id=506324b3a7dffd00020bf661#

    this confuses me. the variable’s name is a function but the function also has a name then they add in the variable as a value but that name call the name of the function and then calling the value?

    i’m getting confussed : this is what i have. but check the link

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

    # June 25, 2013 at 12:03 am

    What are you really asking here? In the example you provide above, you don’t need to create a new var for `val` because you can just console log `name` directly.

    # June 25, 2013 at 12:05 am

    with this code :

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

    it says “Oops, try again! You did not call the greeting function. Pass it a name!”

    instructions say : Call the greeting function once it is fixed! Don’t forget to pass in a specific name.

    # June 25, 2013 at 12:08 am

    Right, because all you’ve done is create a function. You then have to actually *call* the function, like this:

    greeting(‘Jiggins’);

    So the final correct answer would be:

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

    greeting(‘Jiggins’);

    # June 25, 2013 at 12:14 am

    man! i always forget that part. i guess i gotta keep at it . thanks doc. what’s jiggins mean?
    is this what you’re referring to?

    http://www.urbandictionary.com/define.php?term=jiggins

    (1st one)

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".