<script> //findindex 查询数组下标 var arr=[1,2,3,2]; var index=arr.findIndex(item=>{ return item==2 }) console.log(index); // 结果:1 </script>