Write the JS code to load the 3rd party script before ready event triggers and after successful load show your name on the browser with a message.
Answers
Answered by
4
Answer:
Let’s say we need to load a third-party script and call a function that resides there.
We can load it dynamically, like this:
let script = document.createElement('script');
script.src = "my.js";
document.head.append(script);
…But how to run the function that is declared inside that script? We need to wait until the script loads, and only then we can call it.
Similar questions