JavaScript Exceptions best practices?
I'm starting to learn JavaScript, so far no problem but I have a hard time finding a good explanation of the Exception mechanism in JS.

It seems similar to C++, JS allows to throw about every object, instead of just throwing an Exception object (probably due to it's dynamic nature).

    throw 'An error occured.';

works, as well as

    throw new Exception('An error occured.');

`catch` and `finally` both seem to work like their Java equivalent. Still, I don't know what are widely accepted best practices regarding exceptions.

JavaScript Exceptions best practices?
===

I'm starting to learn JavaScript, so far no problem but I have a hard time finding a good explanation of the Exception mechanism in JS.

It seems similar to C++, JS allows to throw about every object, instead of just throwing an Exception object (probably due to it's dynamic nature).

    throw 'An error occured.';

works, as well as

    throw new Exception('An error occured.');

`catch` and `finally` both seem to work like their Java equivalent. Still, I don't know what are widely accepted best practices regarding exceptions.
