Error: missing ) in parenthetical error

T

threepins

Hi,

Trying the following ...

function getCurrentVal(poValue)
{
var lcCurrentVal = 0;
if (isNaN(parseInt(poValue)))
{
var loValue = poValue.toUpperCase();
if (loValue == "/")
{
lcCurrentVal = "/";
}
if (loValue == "X")
(
lcCurrentVal = "X";
{
}
else
{
lcCurrentVal = parseInt(poValue);
}

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
 
R

RobB

Hi,

Trying the following ...

function getCurrentVal(poValue)
{
var lcCurrentVal = 0;
if (isNaN(parseInt(poValue)))
{
var loValue = poValue.toUpperCase();
if (loValue == "/")
{
lcCurrentVal = "/";
}
if (loValue == "X")
(
lcCurrentVal = "X";
{
}
else
{
lcCurrentVal = parseInt(poValue);
}

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


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

....be a curly brace? ;)

Rob
 
T

threepins

I love you!!

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

Douglas Crockford

Hi,

Trying the following ...

function getCurrentVal(poValue)
{
var lcCurrentVal = 0;
if (isNaN(parseInt(poValue)))
{
var loValue = poValue.toUpperCase();
if (loValue == "/")
{
lcCurrentVal = "/";
}
if (loValue == "X")
(
lcCurrentVal = "X";
{
}
else
{
lcCurrentVal = parseInt(poValue);
}

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.

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.

http://www.crockford.com/javascript/lint.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,233
Latest member
AlyssaCrai

Latest Threads

Top