Let's compare our original Star Wars exploration from Chapter 7, Events, Event-Driven Design, and APIs (https://github.com/PacktPublishing/Hands-on-JavaScript-for-Python-Developers/tree/master/chapter-8/swapi) with a jQuery version (https://github.com/PacktPublishing/Hands-on-JavaScript-for-Python-Developers/tree/master/chapter-8/swapi-jQuery).
Now, I'll grant that this is not the most elegant piece of jQuery, but there are reasons for why that is so. Let's break this down.
First up—HTML:
ES6 | jQuery |
No change | Addition of <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script> |
As we discussed, adding in a JavaScript library or framework inherently needs another file download and/or overhead processing time from local files. Usually, the size is negligible, so in this case, the only relevant factor is that we're adding a line of HTML to load the jQuery file from a global content delivery...