题解 | #查找元素位置#
查找元素位置
https://www.nowcoder.com/practice/0a9af9cb20c34babb6232126e019c74d
{"html":"<!-- 请在此处编写你的代码 -->\\n<!-- <div id=\"app\"> Hello Nowcoder </div> -->","css":"/* html, body {\\n\\twidth: 100%;\\n\\theight: 100%;\\n\\tmargin: 0;\\n\\tpadding: 0;\\n} */","js":"function findAllOccurrences(arr, target) {\r\n return arr.map((item, index) => {\r\n return item === target ? index : -1;\r\n }).filter(item => item !== -1);\r\n}"}