I have a question about code simplification questions

hi all.

I’m creating a web with threejs. Currently, there are dozens of glb files, so the number of variables increases, and there are many simple iterations of the code. However, I don’t know how to solve this problem because my coding skills are not good now.

If you click on the current button, you will see the visible of the glb file and it will disappear again and again. So, when you don’t have a few glb models, it’s easy to code them, but with dozens of glb models, it’s hard to code them like this. How can I solve this problem?

For example, when you click the product button in another category and load it, the previous product must disappear.

so i need to help!

this is my github

you can see my “chair.js” and “index.js”