2

.map(window.open) 和 .map((one)=>window.open(one)) 的区别是啥?

 2 years ago
source link: https://www.v2ex.com/t/845317
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  JavaScript

.map(window.open) 和 .map((one)=>window.open(one)) 的区别是啥?

  Stefango · 8 小时 45 分钟前 · 610 次点击

这两行代码的执行结果咋不一样(一个打开新窗口,一个在当前窗口打开新标签页)? this 不同?

`https://baidu.com
https://163.com`.split(/\r|\n/ig).map(window.open)


`https://baidu.com
https://163.com`.split(/\r|\n/ig).map((one)=>window.open(one))

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK