Skip to content

Instantly share code, notes, and snippets.

@C-Lodder

C-Lodder/lazyload.js

Created Jul 31, 2019
Embed
What would you like to do?
Lazy load JS
const scripts = [
'https://some-cdn.com/file.js',
'js/file1.min.js',
'js/file1.min.js',
];
scripts.forEach(file => {
const script = document.body.appendChild(document.createElement('script'));
script.async = false;
script.src = file;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment