一个函数或方法中,其实有很多地方都需要这种选返回值,最后执行某些事的 ===================================================================== 附一:JavaScript Error (try/catch/finally) Introduction Like other programming languages, JavaScript provides the possibility to make use of the try/catch/finally block. Usually when an error is encountered then the script stops and doesn't continue with the rest of the page. The try/catch/finally block can be used to continue the processing with the rest of the page. You just have to put the code in your try block and when an error in encountered there, then it will call the catch block. The finally block is called always regardless of an error occurred or not. The following example makes the usage clear. Example:
文章评论
共有 位脚本之家网友发表了评论我来说两句