Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Use a Variable's Result in Another Formula in Javascript?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 423
    Answer it

    Hi All,

     

    My first post and I'm not a programmer.

     

    I've already spent a lot of time on this without any success.

     

    I'm trying a retrieve the value of a variable, calculated earlier in the js, so I can plug it into a second calculation. Here's my code for the second calculation....

     

    <script>

    var a = Math.pow(8000000000000/c, 1/3);

    document.write("The answer is: " + a );

    </script>

     

    My variable of concern is "c". It already has a value from an earlier calculation in the same js. If I enter a value manually into the second line, "c=100" for example, it will correctly calculate and display the new value of "a". How do I get js to read the previously calculated value of "c"?

     

    This is the only thing holding me up from completing my new website!

     

    Saying thanks would be an understatement.

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: