Skip to content
Advertisement

Suitescript adds .0 to numbers in array

In Suitescript 2.0 I want to check if an ID does not match with one of the IDs in the array below:

JavaScript

In the debugger I see that .0 is added to every value in the array :

enter image description here

Now if my ID is 1 and I do the following check:

JavaScript

then this will always be true, because the numbers have .0 added.

Is there a way to remove the .0? I already tried Math.trunc, but Netsuite gives me this error:

JavaScript

I also reproduced the code in jsfiddle however in jsfiddle it works, because it gets into false: https://jsfiddle.net/7fnxoz1r/1/

I am quite new to Suitescript 2.0 but it also seems that suitescript 2.0 does not allow array.includes.

Advertisement

Answer

Why not set interfaceStatusArray1 as a string array? If needed you can turn them to number back/forward using the primitive classes String(val)/Number(val)

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement