Question: I want to create an trigger inside an procedure. but after some research I got to know that it is not possible. can u suggest me another way I can achieve the below actions. (I cant share exact data and queries due to some reason. please refer similar queries.)

***What I want***

I have created an temporary table containing data i need.   

eg. `CREATE TEMPORARY TABLE temp1 SELECT id, col_1 FROM table1 WHERE col_1=2;`

I want to inset data in table `table2` when data is inserted in temp1, which i can achieve by creating a `TRIGGER`. but the problem is I want to give a value in `table2` which will be dynamic and will be taken from nodejs backend. so i created a `PROCEDURE` which takes parameter `neededId`. but i cant created trigger inside a procedure. is their any other way i can achieve this?

***Procedure I Created***

*here `neededId` is the foreign key I get from backend to insert*

```

DELIMITER $$
USE `DB`$$
CREATE PROCEDURE `MyProcedure` (IN neededID int)
BEGIN
    DROP TABLE IF EXISTS temp1;
    CREATE TEMPORARY TABLE temp1 SELECT id, col_1 FROM table1 WHERE col_1=2;

    DROP TRIGGER IF EXISTS myTrigger;
    CREATE TRIGGER myTrigger AFTER INSERT ON temp1 FOR EACH ROW
    BEGIN
        INSERT into table2("value1", "value2", neededId);
    END;

END$$

DELIMITER ;

```

Answer: 
```
const idx = headings.findIndex(el => el.text === 3 && el.type === "♠")
headings.splice(idx,1)

```
Use `lodash`'s [`_.remove`](https://lodash.com/docs/4.17.15#remove):

```js
const headings = _.range(1, 13).map(i => ({text: i, type: "♠"}));
_.remove(headings, {text: 3, type: "♠"});
console.log(headings);
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
```

This removes all matching elements, not just the first one.