if (!Function.prototype.bind) { Function.prototype.bind = function(oThis) { // 如果给函数对象的属性而不是方法来调用bind // 如: // fn = function () {} // fn.test = {} // fn.test.bind(this) // 则抛出异常 if (typeofthis !== 'function') { // closest thing possible to the ECMAScript 5 // internal IsCallable function thrownewTypeError('Function.prototype.bind - what is trying to be bound is not callable'); }