To dynamically include a JavaScript file in a web page, you'd normally insert a <script>
tag pointing to your script. For example:
var js_file= document.createElement("script");
js_file.src='http://example.com/js.js';
document.body.appendChild(js_file);
Write JavaScript code will load an external JavaScript file in the current page and:
- Shortest valid answer wins
- The file is hosted on
https://pastebin.com/raw/rV6dDDj9
(content isconsole.log('Good job!');
) - The code must be vanilla JavaScript (no jQuery, etc.)
- Answer validity test is done in the web browser console. Criteria:
- URL requested and JS file downloaded.
- Console prints
Good job!