Does it matter where I put the async/defer attribute when linking to javascript files?
For example, is this:
<script defer src="my-js.js"></script> with the word immediately after the opening tag considered more proper than this: <script src="my-js.js" defer></script> with it after the src? I usually put it after the src, but I'm not totally sure if that's right, and different resources I've read about using those attributes seem to put them in either slot, which makes me think it doesn't matter.
Probably a silly question ultimately, and in practice the browser doesn't seem to mind where I put it. But also the browser seems completely fine with a lot of things I'd consider atrocities lol so I don't think that's a good baseline to use for understanding whether or not I'm doing something right.
Thank you2 Replies