Open utterances-bot opened 2 years ago
apply
https://febook.hzfe.org/awesome-interview/book4/coding-apply-call-bind
apply 这一行实现,会使第二个参数传入 [] 或 {length: 0} 时报错
[]
{length: 0}
if (argsArray && typeof argsArray === "object" && argsArray.length) {
可以改成
if (argsArray && typeof argsArray === "object" && 'length' in argsArray) {
实现 apply/call/bind | HZFE - 剑指前端 Offer
apply
https://febook.hzfe.org/awesome-interview/book4/coding-apply-call-bind