我想这样做:当输入的值与我的数组的值匹配时,写入匹配值。
所以这是我的代码:
//我的数组如下:
var checkNames = (document.getElementById("KPIorCounterList").value.split("\n").map(element => element.trim())).filter(v=>v != "");
我的另一个数组:myarray= ["RAB Video call drop %",RAB PS R99 drop % ","RAB PS HSDPA drop %"]
例如 ; 将 RAB* 写入 textare 时,我应该看到,以“RAB”开头
我想,我的代码应该如下:
for (var i = 0; i < checkNames.length; i++) {
for (var j = 0; j < myarray.length; j++) {
// var str = myarray[j].split(" "); // I am not sure for his.
I want to this for here : (pseudo code)
for example checkName[i] == RAB*
if (checkName[i].match("match condition") == myarray[j])
alert(myarray[j]);
//I should show output myarray[j] == RAB Video call drop %",RAB PS R99 drop % ","RAB PS HSDPA drop %"
}
}
我能怎么做 ?请..