How to try catch in JavaScript

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