Day 3: Throw

Problem Link

Solution

throw.js
if (a === 0) {
    throw Error("Zero Error");
  }
  if (a < 0) {
    throw Error("Negative Error");
  }
  return "YES";

Last updated

Was this helpful?