The code looks correct but you are missing something. If you change the number of lights, you have to update the materials of your scene via material.needsUpdate
. See https://stackoverflow.com/questions/16879378/adding-and-removing-three-js-lights-at-run-time
This fact is also noted in the docs: How to update things, section Materials