I have a nested array that has subarrays with a length of 6 and string values. I also have 2 variables that have float values as below:
var test_array =[["06101123", "0", "0.2", "34011", "Cumberland", "Local", "Fernwood Avenue"],
["02271163", "0.1", "0.22", "34003", "Bergen", "Local", "Fernwood Avenue"],
["04351186", "0.3", "0.59", "34007", "Camden", "Local", "Fernwood Avenue"],
["07131150", "0", "0.3", "34013", "Essex", "Local", "Beacon Street"],
["03041026", "0", "0.13", "34005", "Burlington", "Local", "Beacon Street"],
["20121109", "0.18", "0.43", "34039", "Union", "Local", "Jones Lane"],
["15141139", "0", "0.27", "34029", "Ocean", "Local", "Jones Lane"]];
var pt_one = 0.1; var pt_two = 0.59; var street = "Fernwood Avenue";
I want to use pt_one and pt_two as a low-high range. I want to iterate through the subarrays and create a new array where subarray[1] is equal to or great than pt_one and subarray[2] is less than or equal to pt_two and subarray[6] = street and push that array to a new_array. For example, the output in this scenario would be:
new_array =[["02271163", "0.1", "0.22", "34003", "Bergen", "Local", "Fernwood Avenue"],
["04351186", "0.3", "0.59", "34007", "Camden", "Local", "Fernwood Avenue"]];
How can I achieve this?