What is .map() doing in this situation?

后端 未结 4 958
执笔经年
执笔经年 2020-12-13 05:29

Using the Chrome Console, this is my input and output:

[0].map(Array);

[[0, 0, [0]]]; // output

What is happening here?

ED

4条回答
  •  无人及你
    2020-12-13 05:56

    After you updated question. Other answers provide you info about map

    To answer why array and string differ look to constructors

    String constructor accept 1 parameter String(thing) while array new Array(element0, element1[, ...[, elementN]])

提交回复
热议问题