updateHTMLDoc() function that I defined below:
To make this function I am leveraging the
parseFromString() function of the
DOMParser class to parse the given HTML code so that it can be modified. Here is an example showing how you can use this function to add CSS and JS to the head of the given HTML string:
Hopefully this short example helps you see how you can use this function. I have also added JSDoc annotation to make it easier to use this function in an IDE such as Visual Studio Code.
Happy coding! 😎