Hello! I am trying to convert an array that contains string values to Numbers, so the array contains something like
array = [0: "5", 1:"15", 2:"0", 3:"30"]
This array is also a value coming from a transformer, so transformer1.value returns the array above. Now, I need to convert all the values inside the array to numbers so I can do math operations with them
So far I tried a loop like this
var data = {{ transformer1.value }} //this is the transformer that contains the array
var Minutes = [] // an empty array
var i = 0
while(i<data.length){
Minutes[i] = {{ parseInt(data[i]) }}
i++
}
when I do the loop above, I get an error saying that 'i' is not defined but it is defined inside the loop, do you know what am I doing wrong or how can I accomplish to loop through the entire array to covert all values to numbers?