|
|
|
|
|
by Cthulhu_
4238 days ago
|
|
Bascially, the Javascript language standard defines a set of default API functions. These have been expanded over time, most notably with ES 5, which added things like .map() to arrays. However, older browsers like IE <9 do not support ES 5, so if, as a developer, you try to call .map on an array in IE 8, you'd get an error. A polyfill uses Javascript's awesome ability to add functions to basic types, and extend the language in other ways. So if a browser does not ship with, for example, array.map() itself, a polyfill can do array.map = function() {} and implement it. That way, a developer can simply use array.map and not have to do a different implementation (fall back on a ye olde for-loop). |
|