Lesson 32 of 55 · javascript
Progressive Enhancement & Graceful Degradation
Duration: 9 mins
Progressive Enhancement – start with a fully functional HTML page, then layer CSS and JavaScript.
- Use feature detection (
if ('fetch' in window) { … }). - Provide
<noscript>fallback content. - Keep core functionality available without JS.
Graceful Degradation – build the rich experience first, then ensure it still works when features are missing.
Example: Feature‑detect fetch
if('fetch' in window){
fetch('/data.json').then(r=>r.json()).then(d=>render(d));
} else {
console.warn('Fetch not supported – loading static data');
}