Jongware's Personal Recommendations:
On Windows, TextPad (https://www.textpad.com/). On Mac, TextWrangler (https://www.barebones.com/produ…..twrangler/).
Both have particular strengths and weaknesses. TextPad, for instance, can natively look up stuff in Windows CHM files — yup, those I created for InDesign's Javascript! TextWrangler, on the other hand, is much better with GREP and can edit files that are stored on a web server (when connected with a user name and password, you can select a remote file; TW will download it, you edit and close, and it gets uploaded again automatically!).
Since both are professional code editors, both have a command to jump to and/or select “matching braces”, which is a great help if you somewhere missed one. Another feature both have is the ability to fast search through a set of files, in case you just know for certain you used a certain command somewhere but cannot recall in which file.
In general you should not have to rely on the editor “fixing” your braces for you, and use proper indenting of your code blocks to visually see where you are in your script, and how many closing braces you need. That said, personally I've been saved by this particular function lots of times ;-)