so i am trying to add a pending script tag like this
const script = document.createElement('script');
script.setAttribute('src', '/script.js');
script.setAttribute('type', 'text/javascript');
script.setAttribute('defer', true);//this is the code in question!
document.getElementsByTagName('body')[0].appendChild(script);
But I found out that the script tag will generate an attribute defer, for example defer=true, and not only defer.
They are the same? What is meant if I do defer=true, and not defer?Thank!
source
share