This is an example of my code. I want to use my existing if/else statement inside a try-catch block, and push when validation fails. I'm trying to use try-catch in between if/else condition and it gives me an error.
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);
}