Q:

Proper way to do a try/except with catchall in javascript

What would be the correct way to do the following:
try {
    card.focus();
} catch(ReferenceError e) {
    console.log(e)
} catch (e) {
    console.log('damn')
}

In python it would be:
try:
    card.focus()
except ReferenceError as e:
    print e
except:
    print 'damn'

A:

Use the keyword instanceOf in order to check the Error type.

try {
  card.focus();
} catch (error) {
  if (error instanceof ReferenceError) console.log("Not defined!");
}

