javascript - Why do we use to detect type of object is function? -


why use in javascript application this:

if ( typeof object.create !== 'function' ) {     object.create = function( obj ) {         function f() {};         f.prototype = obj;         return new f();     }; } 

this called polyfill -- detects whether feature of javascript supported current users browser, , if it's not there, defines other scripts come page run on browser.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -