Ignoring an error in JS

Is there a function that ignores an error and continus running the program encounters an error?

You could use try/catch (I think that’s what it is in JavaScript)

4 Likes

Adding on to Qwerty’s response, here’s the usage of try catch:

try {
  // your code
} catch {
  // code that runs when the code above errors
}
4 Likes

learn more:

So you’d do

try {
  // potentially erroneous code here
} catch {}

But what are you doing to make you want to ignore an error? Just in case there’s a better way to solve your problem

2 Likes