Javascript
Javascript has a lot of weird stuff going on[2,3].
There Are Two Javascripts
There are two Javascripts:
One for the server - where you can go wild.
One for the client - that should be thoughtful and careful.[5]
How to Prevent Caching[4]
To prevent caching of a Javascript src
file in an HTML file, developers often append a question mark followed by some kind of timestamp or hash. This doesn't affect the resolution of the URL, but does ensure that a new file is cached when it is downloaded.
<body>
<!-- The below import will always use cached if possible, regardless of
changes to `file1.js` -->
<script src="file1.js"></script>
<!-- The below import will cache `file2.js` as the below filename, ensuring
that new changes will be loaded and old versions will not load, even if old
versions of `file2.js` exist -->
<script src="file2.js?20201031"></script>
</body>
References
- https://addyosmani.com/resources/essentialjsdesignpatterns/book/
- https://github.com/lydiahallie/javascript-questions
- https://www.udemy.com/course/understand-javascript/
- https://stackoverflow.com/a/39591948
- https://remysharp.com/2022/10/13/two-javascripts
- Vanilla Javascript libraries
Incoming Links
- Accessibility
- Accessibility For Web Design
- AJAX
- APL
- ARIA Attributes
- Arrays (Javascript)
- Authentication
- C Data Types
- Canvas
- Classes (Javascript)
- Date (Javascript)
- DOM Manipulation (Javascript)
- ESLint
- Event Listeners (Javascript)
- Express
- Fetch API
- Frameworks (Javascript)
- Functions (Javascript)
- How To Load Local JSON Files
- Immer
- Input Hygiene
- Jasmine
- Jest
- JSDoc
- K6
- Lexical Scoping (Javascript)
- Make a Rule (ESLint)
- Minimum Viable Product
- Mocha and Chai (Javascript)
- MongoDB
- Mongoose
- MutationObserver (Javascript)
- Node
- NPM
- Object Destructuring (Javascript)
- Operators (Javascript)
- PHP
- PI AT PC Framework
- PixiJS
- Progressive Enhancement
- Promises and Async/Await (Javascript)
- Pug
- Rails
- React
- Regular Expressions
- Regular Expressions (Javascript)
- Ruby
- Socket.IO
- Sublime Text
- Switch Case (Javascript)
- Tagged Template Literals
- Test-Driven Development
- Testing (Javascript)
- Testing Vanilla Javascript
- Text Compression (Server)
- Typescript
- Typing
- Vanilla Javascript
- Variables (Javascript)
- Vue
- Websites
- Yarn
Last modified: 202401040446