📜  try-catch-finally - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:05.838000             🧑  作者: Mango

代码示例1
localStorage.getItem(key)

    try {
        data = JSON.parse(key)
    }
    catch (e) {
        // if the code errors, this bit of code will run
    }
    finally {
    
        return data
    }