我期待类似“154, 544 true”的内容,但这不起作用。
<p id="demo"></p>
<script>
var n = [154, 45, 100, 544, 75], txt = "";
var nFil = n.filter((value) => value > 100);
txt = nFil.join(", ") + "<br>" + nFil instanceof Array;
document.getElementById("demo").innerHTML = txt;
</script>
最佳答案
需要一个括号,例如:
txt = nFil.join(", ") + "<br>" + (nFil instanceof Array);
关于javascript - 数组名实例数组;没有按预期工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59743856/