Ask coding questions

← Back to all posts
How do I check if running a function in JavaScript will lead to an error?
ia13ru (43)

The title says it all. So how do I?

Answered by Squirrel777 (138) [earned 5 cycles]
View Answer
Squirrel777 (138)

You got 2 options:
1. a try and catch! Read more about this on W3schools

  1. Typescript. Typescript can help you catch errors before running the code which is really helpful! However, if you are coding frontend this wont be that useful and personally, Typescript isn't that good on replit.
ia13ru (43)

@Squirrel777 Thanks with the advice with try and catch!

RoBlockHead (425)

just gotta try it. Most of the time, just manually going through it can help you spot errors, but there's always something that you don't realize will be an error.