美文网首页
javascript error

javascript error

作者: LFBuildMountain | 来源:发表于2018-03-25 20:15 被阅读0次
    try {
        throw 'myException'
    }
    catch(e if e instanceof TypeError){
        console.log("first catch")
    }
    catch(e){
        console.log(e)
    }
    
    SyntaxError: Unexpected token if
    

    node.js doesn't support the conditional catch

    use this way

    try{
    }
    catch(e){
    if( e instanceof TypeErro){
      //
    }
    

    相关文章

      网友评论

          本文标题:javascript error

          本文链接:https://www.haomeiwen.com/subject/gmskcftx.html