Now, what program you chose to write your scripts in is pretty much a matter of preference. I think that script editor is the worst possibility since it offers neither useful highlighting nor autocompletion nor reference information.
If you want something free and sturdy, Visual Code Studio might do the trick. I prefer CodeRunner because it’s not so huge and easier to configure. The money spend on it is well spent (in my opinion).
CodeRunner will alert you to syntax errors before you run the script. While you type, it will propose sensible completions and show the definitions of standard methods. That’s of course helpful, but it does not extend to DT’s (or any other program’s methods). This is one of the (many) shortcomings of JXA: the objects are mostly opaque and do not provide for introspection.
What about it, indeed? Short answer: forget about it.
Slightly longer answer: use
Even longer answer: you could add a line containing only
debug; to your code. This will open Safari’s web inspector at the line right after the
debug;. Well, sometimes. Oftentimes not. Even if it worked s as advertised, all you can do is step through the code. Safari knows zilch about JXA objects, so no inspection of properties etc. I think that’s nothing more than a glorified
console.log(). If you like a GUI to walk you through your code, try it out.