Skip to main content
Participating Frequently
April 17, 2019
Question

Validating Two Numbers with Javascript

Hello guys, I am really rookie with Javascript but I'd like to know what is wrong with this code?

I get alerted but not exactly on the numbers. I have two TOTAL values that I compare and I want to be alerted if they're the same or different.
Can anyone take a look and perfect this code, will be appreciated.

var V1=Number(this.getField("A").value);

var V2=Number(this.getField("B").value);

if(V1==V2)

{

app.alert("EQUAL");

}

else if (V1 >> V2){

app.alert("First value is bigger");

}

else {

app.alert("First value is smaller");

}

This topic is closed to new replies. Start a new post to keep the conversation going.

11 replies

try67
Community Expert
Community Expert
April 17, 2019

Replace ">>" with ">".

Translate
Participating Frequently
April 17, 2019

Nope, same outcome.

Translate
try67
Community Expert
Community Expert
April 17, 2019

What is the outcome, exactly, and where did you place the code?

Translate