function loadScript(src) {
  return new Promise(resolve => {
    const script = document.createElement('script');
    script.onload = resolve;
    script.src = src;
    document.head.appendChild(script);
  });
}
function loadScript(src) {
  return new Promise(resolve => {
    const script = document.createElement('script');
    script.onload = resolve;
    script.src = src;
    document.head.appendChild(script);
  });
}
function loadScript ( src ) { return new Promise ( resolve => { const script = document . createElement ( 'script' ) ; script . onload = resolve ; script . src = src ; document . head . appendChild ( script ) ; } ) ; }
lazy load a script
lazy load a script