Recommendation 13: Disable Function constructor

  The method defined functions include three kinds: function statement, Function constructor and the function directly regardless of the amount by which method is defined functions, they are all Function instances of an object, and all objects inherit Function default or custom methods and properties.

// function statement written in the function 
function F (X) {
   return X 
} 
// used Function () Constructor function clone 
var F = new new Function ( "X", "return X;" );
 // use direct function of the amount of direct generating function 
var F = function (X) {
   return X; 
}

 

 (1) Scope compare

 (2) Comparison of resolution efficiency

 (3) Compatibility Comparison

Guess you like

Origin www.cnblogs.com/chorkiu/p/12095753.html