尝试解析json,如果异常,则不继续往下执行,请问逻辑如何写?
try { var obj = JSON.parse(json_string); } catch (e) { throw new Error(‘something bad happened’); console.log(e); //如何让程序停在这,不执行后面的代码 }
try { var obj = JSON.parse(json_string); } catch (e) { throw new Error(‘something bad happened’); console.log(e); //如何让程序停在这,不执行后面的代码 }