Answer:
Step-by-step explanation:
To create a new array filterednames that only contains the names of students who are 17 or older, you can use a for loop and an if statement to iterate through the ages array and check the age of each student. If the age is 17 or older, you can add the corresponding name to the filterednames array using the push() method. Here is an example program that would achieve this:
var ages = [16, 17, 18, 17];
var names = ["beni", "analise", "ricardo", "tanya"];
var filterednames = [];
for (var i = 0; i < ages.length; i++) {
if (ages[i] >= 17) {
filterednames.push(names[i]);
}
}
After running this program, the filterednames array will contain the names "analise", "ricardo", and "tanya", since they are the students who are 17 or older.