Performance and migration
Find jQuery bottlenecks and migrate a widget to modern JavaScript.
What you will be able to do
- Cache selections outside loops.
- Batch reads before writes.
- Remove unused plugins from the bundle.
- Migrate one widget at a time with tests.
In plain English
The main costs are repeated selection, layout thrashing and large plugin bundles. Cache selectors, batch DOM writes and remove unused plugins. Migrate widget by widget with tests, not in one risky rewrite.
const list = document.querySelector('#list')
const buttons = list.querySelectorAll('.js-select')
buttons.forEach((button) => {
button.addEventListener('click', () => button.classList.toggle('active'))
})Your turn
EasyCache a selection
Replace repeated $("#list") calls with a cached const.
JAVASCRIPT · starter
$('#list').append('a'); $('#list').append('b')Check your understanding before moving on.
Knowledge checkQuestion 1
What is the safest migration strategy?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.