Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
Like Tree1Likes

Thread: help, javascript on codeacademy

  1. #1
    Senior Member
    Join Date
    Jan 2014
    Posts
    392
    Member #
    38172
    Liked
    4 times

    help, javascript on codeacademy

    Introduction to Functions in JS | Codecademy

    i need someone to spell this out for me. can someone post the finished code?

  2.  

  3. #2
    Senior Member
    Join Date
    Jan 2014
    Posts
    392
    Member #
    38172
    Liked
    4 times
    scrap that, have it sorted. stuck on this one
    Introduction to Functions in JS | Codecademy
    i have it displaying the correct answer but its saying i dont have orangecost defined, heres my code
    var orangecost = function(price)
    { console.log(price*5);
    };
    orangecost(3);

  4. #3
    Senior Member
    Join Date
    Jan 2014
    Posts
    392
    Member #
    38172
    Liked
    4 times
    capitals.....

  5. #4
    Senior Member
    Join Date
    Jan 2014
    Posts
    392
    Member #
    38172
    Liked
    4 times
    can someone actually just do this for me??

    Introduction to Functions in JS | Codecademy

    thanks guys

  6. #5
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,139
    Member #
    27197
    Liked
    959 times
    I think you know the answer to that question.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  7. #6
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,139
    Member #
    27197
    Liked
    959 times
    I'll give you a hint. The code will look almost the same as the code you posted a few replies up. You're just adding a second parameter and changing the equation inside the function, and they give you the equation in the instructions.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  8. #7
    Senior Member
    Join Date
    Jan 2014
    Posts
    392
    Member #
    38172
    Liked
    4 times
    this is the best i could do, im just not sure what its asking me to do here


    var perimiterBox = function(length, width)
    {return length * width;};

    perimiterbox(5,5);

  9. #8
    Member djitsz's Avatar
    Join Date
    Jan 2014
    Posts
    67
    Member #
    38199
    Liked
    17 times
    It seems like your answer calculates the surface area of a box rather than its perimeter...

    Also note that JavaScript is case sensitive so perimeterbox and perimeterBox are different function names for JavaScript.
    Last edited by djitsz; Feb 13th, 2014 at 08:13 AM.

  10. #9
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,139
    Member #
    27197
    Liked
    959 times
    Also, you've spelled "perimeter" incorrectly.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  11. #10
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,772
    Member #
    5580
    Liked
    723 times
    @coleio ...

    Those tutorials require you to do exactly as they say, and use the variable names they require.

    They require the perimeter of the box, not the area.
    They require you to use the function name: perimeterBox (spelled exactly like that).
    Finally, you have to display the answer someplace, so I send the answer to the black console log area.
    The answer on my example below is: 20

    // Write your function starting on line 3

    var perimeterBox = function(length, width){
    return length + width + length + width;
    };

    console.log(perimeterBox(5,5));

    *** It seems to me that the biggest frustration you're having is by not following their tutoral exactly. I discovered that if I use my own variable names, and "do my own thing", the answer in the console.log is correct, but the tutorial scolds me for not using their exact lesson material.

    You only need to get the correct results in the console.log

    I actually recommend that you stray from the exact tutorial lesson, experiment with it.
    Last edited by mlseim; Feb 13th, 2014 at 10:37 AM.
    Ronald Roe likes this.



Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:19 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com