Is it possible to trap errors in Javascript?

Haven't used it that much