Hi, I’m struggling to convert some JS code to NSB. The code I’m trying to convert subtracts values in one array from values in another array. Can anybody help here’s the code thanks in advance
var a = [1, 4, 3, 2],
b = [0, 2, 1, 2],
x = [];
for(var i = 0;i<=b.length-1;i++)
x.push(a[i] - b[i]);
console.log(x);
This is what I have come up with, (I get the first and last calculation of the array only -3,-3)
Dim a,b,C,d,e,f
a=1
b=2
C=3
d=4
e=5
f=6
Dim x=[]
array1 = Array(a, b, C)
array2 = Array(d, e, f)
For i=0 To UBound(array2)
If i<= array2.length-1 Then
i=i+1
x.push(array1[i]-array2[i])
End If
Next
NSB.Print(x)