Avoid using try...catch...finally


Avoid calls to try…catch..finally in resource-heavy areas of code (some loops, generation of complex data, etc.). When an exception is thrown, a variable (the exception itself) is created at the start of the catch clause and destroyed at the end. Creating and destroying this variable unnecessarily uses CPU power and RAM. Hence why it is important to replace this construction with a logic test as often as possible.

Favor a logic test:

var oProperties = ['first','second',...,'nth'], i;
try {
    for( i = 0; i < oProperties.length; i++ ) { 
        test[oProperties[i]].someproperty = somevalue;
} catch(e) {

Further reading:

This best practice should only be applied if it is coherent with your project's specifications.
Under CC-By-NX-SA license