Calling all array items [0,1,2,3] BESIDES an item specified [e.g. 3] using index

I need to remove all buttons except the one which was clicked (perhaps using e.target.id?) – according to its index (using for loop.

I tried to create variable and declared it let buttonsX = buttons[i] so I could refer to it later in the if statement as !buttonsX and then it would call all the array buttons EXCEPT the button with the current index (triggered by a mousedown event).

But nothing happened.

I read there are the pull() & splice() functions but they would just require unnecessary lines of code that could’ve been prevented by a smaller code.

Other than them – I haven’t found any resources about such a function on the internet.

Also, it must be pure javascript,

Thank you very much.