题解 | #使用 apply 调用函数#

使用 apply 调用函数

http://www.nowcoder.com/practice/d47b482e7148497582c7a995df51f393

function callIt(fn) {
    let arr = Array.prototype.slice.call(arguments,1)     
    return fn.apply(null,arr)
}

Array.prototype.slice.call(arr, ?start, ?end)

此用法能将带有length属性的对象转换成数组

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务