es5严格模式
1 <script type="text/javascript"> 2 "use strict"; 3 function test(){ 4 console.log(arguments.callee); 5 } 6 test(); 7 </script>
try...catch
<script type="text/javascript"> try { console.log('s'); console.log(v); console.log('s'); } catch (error) { console.log(error.message+" "+error.name); } console.log("dsf"); </script> 1.EvalError:eval()的使用与定义不一致 2.RangeError 数值越界 3.ReferenceError:非法或不能识别的引用数值 4.SyntaxError 发生语法解析错误 5.TypeError 操作类型错误 6.URIError URI处理函数使用不当
with
<script type="text/javascript"> var obj={ name:"asD" } function test(){ var name="ad"; with(obj){ console.log(name); } } </script>