image.png

    1. <body>
    2. <script>
    3. const arr = [1,5,7,9];
    4. const target = 5;
    5. function deleteNode(arr,target){
    6. const res = [];
    7. arr.forEach(item=>{
    8. if(item!==target){
    9. res.push(item)
    10. }
    11. })
    12. return res;
    13. }
    14. console.log(deleteNode(arr,target));
    15. </script>
    16. </body>