Error: missing ) in parenthetical error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • threepins@gmail.com

    Error: missing ) in parenthetical error

    Hi,

    Trying the following ...

    function getCurrentVal(p oValue)
    {
    var lcCurrentVal = 0;
    if (isNaN(parseInt (poValue)))
    {
    var loValue = poValue.toUpper Case();
    if (loValue == "/")
    {
    lcCurrentVal = "/";
    }
    if (loValue == "X")
    (
    lcCurrentVal = "X";
    {
    }
    else
    {
    lcCurrentVal = parseInt(poValu e);
    }

    if(lcCurrentVal )
    {
    return lcCurrentVal;
    }
    }


    and am getting the error

    Error: missing ) in parenthetical
    Line: 189, Column: 23
    Source Code:
    lcCurrentVal = "X";

    I can't for the life of me figure it out. If i comment this line out it
    works fine (but then that check is removed). Any help would be most
    appreciated.

    Cheers
    Bj McGowan

  • RobB

    #2
    Re: Error: missing ) in parenthetical error

    threepins@gmail .com wrote:[color=blue]
    > Hi,
    >
    > Trying the following ...
    >
    > function getCurrentVal(p oValue)
    > {
    > var lcCurrentVal = 0;
    > if (isNaN(parseInt (poValue)))
    > {
    > var loValue = poValue.toUpper Case();
    > if (loValue == "/")
    > {
    > lcCurrentVal = "/";
    > }
    > if (loValue == "X")
    > (
    > lcCurrentVal = "X";
    > {
    > }
    > else
    > {
    > lcCurrentVal = parseInt(poValu e);
    > }
    >
    > if(lcCurrentVal )
    > {
    > return lcCurrentVal;
    > }
    > }
    >
    >
    > and am getting the error
    >
    > Error: missing ) in parenthetical
    > Line: 189, Column: 23
    > Source Code:
    > lcCurrentVal = "X";
    >
    > I can't for the life of me figure it out. If i comment this line out[/color]
    it[color=blue]
    > works fine (but then that check is removed). Any help would be most
    > appreciated.
    >
    > Cheers
    > Bj McGowan[/color]


    Hard to see this late in the day, but shouldn't this:
    if (loValue == "X")
    ( <----

    ....be a curly brace? ;)

    Rob

    Comment

    • threepins@gmail.com

      #3
      Re: Error: missing ) in parenthetical error

      I love you!!

      Thanks man.... been staring at this for ages and didn't even see that.
      Cheers
      Bj

      Comment

      • Douglas Crockford

        #4
        Re: Error: missing ) in parenthetical error

        threepins@gmail .com wrote:[color=blue]
        > Hi,
        >
        > Trying the following ...
        >
        > function getCurrentVal(p oValue)
        > {
        > var lcCurrentVal = 0;
        > if (isNaN(parseInt (poValue)))
        > {
        > var loValue = poValue.toUpper Case();
        > if (loValue == "/")
        > {
        > lcCurrentVal = "/";
        > }
        > if (loValue == "X")
        > (
        > lcCurrentVal = "X";
        > {
        > }
        > else
        > {
        > lcCurrentVal = parseInt(poValu e);
        > }
        >
        > if(lcCurrentVal )
        > {
        > return lcCurrentVal;
        > }
        > }
        >
        >
        > and am getting the error
        >
        > Error: missing ) in parenthetical
        > Line: 189, Column: 23
        > Source Code:
        > lcCurrentVal = "X";
        >
        > I can't for the life of me figure it out. If i comment this line out it
        > works fine (but then that check is removed). Any help would be most
        > appreciated.[/color]

        Of course you can't. When code is this ugly, it is impossible to reason
        about its correctness. First you should format it properly. Indent the
        contents of all of the blocks. If you still can't see the problem, then
        run it through JSLINT.


        Comment

        Working...