You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constObj={name: 'G-Dragon',age: 30,sayName(){return'Hi, I am '+this.name;}}console.log(Obj.sayName())//Hi, I am G-Dragonletfunc=Obj.sayName.bind({name: '高龙'},1,12);console.log(func())//Hi, I am 高龙
描述: bind() 方法创建返回一个新的函数。新函数中的 this 指向 bind() 被调用时传入的第一个参数,而其余参数将作为新函数的参数,供调用时使用。
语法:
function.bind(thisArg[, arg1[, arg2[, ...]]])
。参考阅读
The text was updated successfully, but these errors were encountered: