As a beginner in programming, my goal is to access the last position of element m within array n. The following code displays all positions of element m:
var n = [];
while (true) {
let input = prompt("Please enter a number for the array");
if (input == null || input == "c") {
break;
}
n.push(Number(input));
console.log(n);
}
var m = prompt("Enter the number to match");
console.log(m)
for (var i = 0; i < n.length; i++) {
if (n[i] == m) {
console.log(i);
}
}