title: If else statement inside try catch Javascript
body: <p>This is an example of my code. I want to use my existing <code>if/else</code> statement inside a <code>try-catch</code> block, and push when validation fails. I'm trying to use <code>try-catch</code> in between <code>if/else</code> condition and it gives me an error.</p>
  
  <pre><code>var errLogs = [];
  try {
    var a = "ABCD";
    if(typeof a === "string"){
       console.log("equel");
    }catch(e) {
    }else{
       console.error("not equel");
    }
    console.log(e);
    errLogs.push(e);
  }
  </code></pre>