I need to fill 1 as an element of array FilteredRPeakThousandDataArray starting with index 500 in new array, and 0 for other index. Done like the following but the new array is getting filled only by 0. Explanation : at index 600,800,1200,1300 element in FilteredRPeakThousandDataArray should be 1 and 0 in all other indexes including for index 2(because 2 is less than 500)
var j = 500;
var FilteredRPeakDataArray = new Array();
var FilteredRPeakDataArray = [2, 600, 800, 1200, 1300];
var FilteredRPeakThousandDataArray = new Array();
for (var i = 0; i < 1500; i++) {
if (FilteredRPeakDataArray[j] == i) {
FilteredRPeakThousandDataArray[i] = 1;
} else {
FilteredRPeakThousandDataArray[i] = 0;
}
j++;
}
console.log("FilteredRPeakThousandDataArray " + FilteredRPeakThousandDataArray);
500onFilteredRPeakDataArray, so, just comparej==i