扫码关注官方订阅号
在mdn中看了Array.from的教程,但是还是不理解Array.from第三个参数的作用!求解
人生最曼妙的风景,竟是内心的淡定与从容!
https://developer.mozilla.org...Array.from(obj, mapFn, thisArg) 就相当于 Array.from(obj).map(mapFn, thisArg),
Array.from([1, 2, 3], function(x){return x + this.a},{a:3}); 结果[4, 5, 6]
这个例子this就指向了{a:3}
this
{a:3}
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
这个例子
this就指向了{a:3}