如何将API请求中的单个字符串放入单个数组中? JavaScript的

时间:2018-02-16 21:09:04

标签: javascript arrays api ecmascript-6 es6-promise

到目前为止,这是我的代码:



In [87]: str_ = 'AZ|C|DTD'

# Gets the partitions spitted on first `|`
# generates 3 element tuple: `('AZ', '|', 'C|DTD')`
In [88]: parts = str_.partition('|')

# Concatenate after joining first two elements with
# empty string, `BA|` and last element
In [89]: ''.join(parts[:2]) + 'BA|' + parts[2]
Out[89]: 'AZ|BA|C|DTD'




我要做的是将此列表(请参阅图像)转换为一个数组 enter image description here

示例:["爆炸"," incendiary_device"];

我想在turnArray()函数中执行此操作。我怎么能这样做?

0 个答案:

没有答案