我正在尝试从javascript上的可变文本中推断数据
var text= "
Data:
data1 (str)
data2 (int)
data3 (str)
TODO:todo
"
extrait var data = ["data1", "data2","data3"]
任何想法?
您可以使用forEach()循环
var data = ["data1", "data2","data3"];
data.forEach(el => {
console.log(el);
})