I have a function which is triggered by clicking a button. To use the function again properly, I always have to refresh. How do I automatize this "refresh"
This is the trigger
document.getElementById("choose").addEventListener("click", branchenCheck);
And this is the function
let resultBranche = [];
let resultThema = [];
function branchenCheck(selectedBranche, selectedThema) {
for (var i = 0; i < kandidaten.length; i++) {
for (key in kandidaten[i]) {
if (kandidaten[i][key].indexOf(selectedBranche) != -1) {
resultBranche.push(kandidaten[i]);
}
}
}
themenCheck(resultBranche)
}
I read of “location.reload()
;” But I have no idea how to implement this or whether it is neccessary to implement.