In tutorials I\'ve learnt to use document.write
. Now I understand that by many this is frowned upon. I\'ve tried print()
, but then it literally sen
Just dropping a note here to say that, although using document.write
is highly frowned upon due to performance concerns (synchronous DOM injection and evaluation), there is also no actual 1:1 alternative if you are using document.write
to inject script tags on demand.
There are a lot of great ways to avoid having to do this (e.g. script loaders like RequireJS that manage your dependency chains) but they are more invasive and so are best used throughout the site/application.