将具有一个元素的数组拆分为具有许多元素的数组

Nic*_*ing 4 javascript arrays split join

我想把这个数组包含一个项目(带有一堆逗号分隔项的STRING)

["Bucknell Venture Plan Competition, Mitch Blumenfeld, DreamIt Ventures, Deep Fork Capital, John Ason, Mitchell Blumenfeld, Gianni Martire"]

我想把它变成这个.包含每个名称作为单独数组项的数组.

["Bucknell Venture Plan Competition", "Mitch Blumenfeld", "DreamIt Ventures", "Deep Fork Capital", "John Ason", "Mitchell Blumenfeld", "Gianni Martire"]

谢谢!

更新:

谢谢您的帮助.那很有效!

Gab*_*abe 8

简单如下:

var myArr = ["Bucknell Venture Plan Competition, Mitch Blumenfeld, DreamIt Ventures, Deep Fork Capital, John Ason, Mitchell Blumenfeld, Gianni Martire"];
var myNewArr = myArr[0].split(",");
Run Code Online (Sandbox Code Playgroud)


Tow*_*wer 5

我认为这应该有效:

var items = ["Bucknell Venture Plan Competition, Mitch Blumenfeld, DreamIt Ventures, Deep Fork Capital, John Ason, Mitchell Blumenfeld, Gianni Martire"];
var array = items[0].split(",");
Run Code Online (Sandbox Code Playgroud)

  • @ppumpkin,你的答案在哪里?抱歉,您无权为回答问题点赞。 (4认同)
  • 是的,这很奇怪,实际上不是。我在 2 分钟前回答了。 (3认同)
  • 每个人都从零代表点开始,抱歉,您期望它更像是一个社会主义点系统。 (3认同)
  • @ppumkin 您应该努力回答更多问题,而不是抱怨。 (2认同)