Beijing time this morning, from the Twitter front end engineer Angus Crol, at the JSConf conference in Berlin, was titled "Break all the Rulez" speech, mainly talked about some we usually think is wrong not the use of things, is actually useful. In this paper, the following speech with slides. in the United States, the father of JavaScript see slides also said: I agree with the majority view (it seems there are still a problem?).

below, I’ll translate the main points briefly, without extending the explanation,.

with statement

why don’t you use it,

?

1. unexpected running results may implicitly create global variables

2. closures analyze excessive consumption of

3. compile later

says that ES5’s strict pattern prevents implicit creation of global variables (without var), which reduces one of the with’s problems…

strict mode also can not use with ah,.

why is it useful,

?

1. builds browser developer tools

 

//Chrome Developer Tools IS._evaluateOn =     function (evalFunction, obj, expression) {        IS._ensureCommandLineAPIInstalled ( );;       expression =     & nbsp;       with; " (window._inspectorCommandLineAPI) {                 with (window) {"} + + expression; ""         return; evalFunction.call (obj, expression)  

2. analog block level scoping

 

; / / is, or the old var addHandlers;

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*