Hi Phil,
I regularly use some Js code to add functionality to the Dynamics 365 marketing module. For example, I use it to give dynamicity or to create conditions for visibility of certain fields.
As @Petr Jantač rightly pointed out, however, this definitely has limitations. To understand this, one must consider that the marketing module, and thus its code, is loaded in a specific order within the web page (creating a D365 marketing page or embedding the module in one's own web pages).
In any case, you can test your customizations in real-time with tools such as Visual Studio Code or other tools that allow you to have a graphical preview online.
Happy coding!
Regards,
Stephen