Hi i have this javascript, that takes a list of numbers input.input1 and another variable, duration and outputs a new list of numbers,
the thing is, that i cant figure out how to implement the output, because, now when i ran the script, even though i dont get any output, is automatically changes the input list with the 'new list.
Any help is appreciated
var arr= inputs.input1;
var begin, a;
var rantebou= inputs.duration;
begin=1;
var j;
a=1;
for (let i = 1; i < arr.length; i++) {
if(arr[i-1]+1==arr[i])
a++;
else{
if(a<rantebou)
j=begin;
else
j=i-(rantebou-1);
for(j;j<i;j++)
arr[j]=-1;
begin=i;
a=1;
}
}