Created
December 8, 2016 04:01
-
-
Save LincolnBurrows/b3b1650f38d2c6040031e7c84bdda60f to your computer and use it in GitHub Desktop.
javascript错误处理
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
var r1,r2,s=null; | |
try{ | |
r1=s.length; //产生错误 | |
r2=100; //此语句不会执行 | |
} catch(e){ | |
console.log('error'+e); | |
} finally{ | |
console.log('finally'); | |
} | |
console.log(r1); //undefined | |
console.log(r2); //undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment