I ran into a problem in using async functions. I didn't realize that classList.add('') is illegal. So, when I was running my code in Firefox it stopped running my function, but no error appeared because it was async (Chrome shows the error). This was hard to track down because in the original program the function with the classList.add was two function calls away. What is going here and how do I avoid it in the future (besides having to check the error logs in two different browsers)? PS bonus if you can give explain the reason why async errors don't actually halt execution.
async function error1(){
console.log('Fn async error: before')
let a=undefined
a.b=1
console.log('after')
}
async function error2(){
console.log('Fn async noError: before')
document.body.classList.add('')
console.log('after')
}
function error3(){
console.log('Fn: before')
document.body.classList.add('')
console.log('after')
}
//Stops execution of function but not program
//Throws an error in Chrome and Firefox
error1()
//Stops execution of function but not program
//Throws an error in Chrome but not Firefox
error2()
//Errors and stops program
error3()