我不确定为什么在搜索web时,我得到了函数预期错误,并且没有得到有用的信息。耽误您时间,实在对不起!
oCollectedValue =new Array();
var i = 0
for (i; i < CollectedValue.length; i++)
{
if (Attribute.includes(CollectedValue[i]))
{
oCollectedValue.push(CollectedValue[i])
}
} 发布于 2018-07-11 04:46:12
If you can rely on IE9+,您可以使用indexOf代替includes
const CollectedValue = ["YES", "NO", "TEST", "YES", "NO"];
const Attribute = ["YES", "NO"];
oCollectedValue =new Array();
var i = 0
for (i; i < CollectedValue.length; i++)
{
if (Attribute.indexOf(CollectedValue[i]) > -1)
{
oCollectedValue.push(CollectedValue[i])
}
}
console.log(oCollectedValue);
https://stackoverflow.com/questions/51273137
复制相似问题