Copy link to clipboard
Copied
When is it appropriate to use the + sign with getField? I have seen it written these two ways and both seem to work the same:
var num = getField("num.CD.BPAC.01").value;
and
var num = +getField("num.CD.BPAC.01").value;
Copy link to clipboard
Copied
The result is often the same, but consider what happens if you type 0001.
getField("num.CD.BPAC.01").value, put back in another field, gives you "0001".
+getField("num.CD.BPAC.01").value gives you "1".
Copy link to clipboard
Copied
+ will get value as number.
Copy link to clipboard
Copied
Thank you, that makes sense.
Copy link to clipboard
Copied
The result is often the same, but consider what happens if you type 0001.
getField("num.CD.BPAC.01").value, put back in another field, gives you "0001".
+getField("num.CD.BPAC.01").value gives you "1".
Copy link to clipboard
Copied
Thank you for this clarification, of which I was unaware, but important to understand.