JavaScript Best Practices
Error handling
If certain states of your program throw uncaught errors, they will halt execution and potentially reduce the usefulness of the example. You should therefore catch errors using a try...catch
block:
try { console.log(results); } catch(e) { console.error(e); }