Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Returns

  1. #1
    New Coder
    Join Date
    Dec 2005
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Returns

    Hi once again,

    Here's an exercise that I'm doing and don't just get it!

    <head>
    <title> Company Name </title>
    <script type="text/javascript">
    <!-- HIDE FROM INCOMPATIBLE BROWSERS

    function getCompanyName() {
    var companyName = "Course Technology";
    var retValue = companyName;
    return result;
    }
    // STOP HIDING FROM INCOMPATIBLE BROWSERS-->
    </script>

    Now according to the book I have to modify the getCompanyName() function so that it returns the company name to another calling function.

    And add statements after the getCompanyName() function definition that call the getCompanyName() function and assign the return value to a variable named retValue. (which I have done, i think)

    And finally write code that prints the contents of the retValue variable. Here's the code that I have put in the body section:

    document.write("retValue");

    I really have no idea what I am doing. I have tried for hours and just can't understand it. Maybe I should just give up!

    I would appreciate some aid!

    Thanks
    Michelle

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,731
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    function getCompanyName() {
    var companyName = "Course Technology";
    var retValue = companyName;
    return retValue;
    }

    The value you want to have returned is 'retValue', not 'result' which is undefined.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •