How to try catch in JavaScript

Syntax
By Jad Joubran · 
Last updated Apr 28, 2018
try {
  potentialFail();
} catch (error) {
  console.log(error);
}
ReferenceError: potentialFail is not defined
try...catch on MDN