發表文章 | 發起投票 |
Why "use strict" in JavaScript can save you hours
http://www.webdesignporto.com/why-use-strict-in-javascript-can-save-you-hours/?utm_source=http://www.reddit.com/r/programming&utm_medium=post&utm_campaign=post&utm_content=use-strict
Discussion on reddit: http://redd.it/1zsuhm
tl;dr: "use strict" directive avoids:
[list]
[*]Duplicate keys in object
[*]Variables without var
[*]Duplicate arguments
[*]Freezes the arguments of the functions
[*](...and more)
[/list]
References:
Strict Mode (JavaScript)
http://msdn.microsoft.com/en-us/library/ie/br230269(v=vs.94).aspx
Strict mode
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode
Tools:
JSLint: http://jslint.com/
JSHint: http://www.jshint.com/
Discussion on reddit: http://redd.it/1zsuhm
tl;dr: "use strict" directive avoids:
[list]
[*]Duplicate keys in object
[*]Variables without var
[*]Duplicate arguments
[*]Freezes the arguments of the functions
[*](...and more)
[/list]
References:
Strict Mode (JavaScript)
http://msdn.microsoft.com/en-us/library/ie/br230269(v=vs.94).aspx
Strict mode
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode
Tools:
JSLint: http://jslint.com/
JSHint: http://www.jshint.com/
本貼文共有 0 個回覆
此貼文已鎖,將不接受回覆
發表文章 | 發起投票 |