Frontend development · Beginner · 24 min
Debug JavaScript in Chrome DevTools with breakpoints and the console
By Padding · Updated 18 Nov 2026
Node.js 26.13 LTS (node:26 image) · Chrome DevTools in desktop Chrome, November 2026 · page checked in Chromium with Playwright 1.65.1
You will find and fix two planted bugs in a small basket page, a wrong total and a voucher request that fails without a word, using the Console, breakpoints, logpoints, stepping, the Scope, Watch and Call Stack panes and the Network panel.
On this page
Most debugging by beginners is console.log added, page reloaded, console.log moved, page reloaded again. It works, slowly. Chrome DevTools can stop your code on any line, show every variable at that moment, run it one line at a time and show you the exact request and response the page sent, all without editing the file.
In this tutorial you run a small shop basket with two bugs planted in it. The first makes the total wrong, but only after someone types a quantity. The second is a voucher that does nothing: no message, no discount, no error in the Console. You find both with DevTools, fix them, and finish with a Playwright test that keeps them fixed and a short routine for the next bug you meet.
A small Node script with no dependencies serves the page and plays the part of the shop's API. Everything runs on your own machine. The DevTools steps were written against Chrome. Edge's DevTools are built on the same code and work almost the same, though some menu labels and panel layouts differ. The panels are named rather than pictured, so you can follow along with whatever layout your copy of DevTools has.
Step 1 · Start the basket page and its API
Make a demo folder and write the server. It serves the page's files and answers two API routes: GET /api/basket returns three items, and POST /api/voucher checks a voucher code sent as JSON in a field called code.
mkdir -p ~/basket-debug-demo
cd ~/basket-debug-demo
cat > server.mjs <<'JS'
import { createServer } from 'node:http';
import { readFile } from 'node:fs/promises';
const PORT = 8473;
const basket = [
{ id: 'rice', name: 'Rice, 5 kg', price: 7500, qty: 1 },
{ id: 'beans', name: 'Beans, 1 kg', price: 1800, qty: 2 },
{ id: 'palm-oil', name: 'Palm oil, 1 litre', price: 2500, qty: 1 },
];
const vouchers = { SAVE10: 10 };
const files = {
'/': ['index.html', 'text/html; charset=utf-8'],
'/app.js': ['app.js', 'text/javascript; charset=utf-8'],
'/basket.js': ['basket.js', 'text/javascript; charset=utf-8'],
'/voucher.js': ['voucher.js', 'text/javascript; charset=utf-8'],
};
function send(res, status, type, body) {
res.writeHead(status, { 'content-type': type, 'cache-control': 'no-store' });
res.end(body);
}
function sendJson(res, status, data) {
send(res, status, 'application/json; charset=utf-8', JSON.stringify(data));
}
async function readJson(req) {
let body = '';
for await (const chunk of req) body += chunk;
try {
return JSON.parse(body);
} catch {
return {};
}
}
createServer(async (req, res) => {
const url = new URL(req.url, 'http://localhost');
if (url.pathname === '/api/basket' && req.method === 'GET') return sendJson(res, 200, basket);
if (url.pathname === '/api/voucher' && req.method === 'POST') {
const { code } = await readJson(req);
if (typeof code !== 'string') return sendJson(res, 400, { error: 'Send the voucher in a "code" field' });
const percent = vouchers[code.trim().toUpperCase()];
if (!percent) return sendJson(res, 404, { error: 'That voucher does not exist' });
return sendJson(res, 200, { discount: { code: code.trim().toUpperCase(), percent } });
}
if (url.pathname.startsWith('/api/')) return sendJson(res, 404, { error: 'Not found' });
const file = files[url.pathname];
if (!file) return send(res, 404, 'text/plain; charset=utf-8', 'Not found');
try {
send(res, 200, file[1], await readFile(new URL(file[0], import.meta.url)));
} catch {
send(res, 404, 'text/plain; charset=utf-8', `${file[0]} does not exist yet`);
}
}).listen(PORT, () => console.log(`Basket shop listening on http://localhost:${PORT}`));
JSNow the page. index.html holds the markup, app.js draws the basket and wires up the buttons, basket.js keeps the basket's state and sums, and voucher.js talks to the voucher API. Both bugs are already in this code. Do not go looking for them yet; the point is to find them with the tools.
cd ~/basket-debug-demo
cat > index.html <<'HTML'
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Your basket · Corner Market</title>
<style>
body { margin: 0; font-family: system-ui, sans-serif; line-height: 1.5; color: #1b1f24; background: #f6f7f8; }
main { max-width: 32rem; margin: 0 auto; padding: 1rem; }
ul { list-style: none; margin: 0 0 1.5rem; padding: 0; }
li { display: grid; grid-template-columns: 1fr auto auto auto; gap: 0.5rem; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid #d5d9df; }
li .each { grid-column: 1; color: #5a6270; font-size: 0.875rem; }
li input { width: 4rem; min-height: 2.75rem; font: inherit; }
li button, form button { min-height: 2.75rem; min-width: 2.75rem; font: inherit; }
.line-total, dd { font-variant-numeric: tabular-nums; text-align: right; }
form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; }
form label { width: 100%; }
form input { min-height: 2.75rem; font: inherit; flex: 1; min-width: 0; }
dl { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 1rem; }
dd { margin: 0; }
.total { font-weight: 700; font-size: 1.25rem; }
</style>
</head>
<body>
<main>
<h1>Your basket</h1>
<ul id="lines"></ul>
<form id="voucher-form">
<label for="voucher">Voucher code</label>
<input id="voucher" name="voucher" autocomplete="off">
<button type="submit">Apply</button>
</form>
<p id="status" role="status"></p>
<dl>
<dt>Subtotal</dt><dd id="subtotal"></dd>
<dt>Discount</dt><dd id="discount"></dd>
<dt class="total">Total</dt><dd id="total" class="total"></dd>
</dl>
</main>
<script type="module" src="app.js"></script>
</body>
</html>
HTML
cat > basket.js <<'JS'
export const basket = { lines: [], discountPercent: 0 };
function findLine(id) {
return basket.lines.find((line) => line.id === id);
}
export function setQuantity(id, value) {
const line = findLine(id);
line.qty = value;
}
export function addOne(id) {
const line = findLine(id);
line.qty = line.qty + 1;
}
export function subtotal() {
let sum = 0;
for (const line of basket.lines) {
sum = sum + line.price * line.qty;
}
return sum;
}
export function total() {
const s = subtotal();
return s - Math.round((s * basket.discountPercent) / 100);
}
JS
cat > voucher.js <<'JS'
import { basket } from './basket.js';
export async function applyVoucher(code) {
try {
const res = await fetch('/api/voucher', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ voucher: code }),
});
const data = await res.json();
basket.discountPercent = data.discount.percent;
return `${data.discount.code} applied: ${data.discount.percent}% off`;
} catch (err) {
// Something went wrong. Try again later?
}
}
JS
cat > app.js <<'JS'
import { basket, setQuantity, addOne, subtotal, total } from './basket.js';
import { applyVoucher } from './voucher.js';
const fmt = new Intl.NumberFormat('en-GB');
const list = document.querySelector('#lines');
const status = document.querySelector('#status');
// Handy in the Console while you debug. Remove it before the page goes live.
window.basket = basket;
function el(tag, attrs = {}, text = '') {
const node = document.createElement(tag);
for (const [name, value] of Object.entries(attrs)) node.setAttribute(name, value);
node.textContent = text;
return node;
}
function lineItem(line) {
const li = el('li');
li.append(
el('span', { class: 'name' }, line.name),
el('input', { type: 'number', min: '1', step: '1', value: line.qty, 'data-id': line.id, 'aria-label': `Quantity of ${line.name}` }),
el('button', { type: 'button', 'data-add': line.id, 'aria-label': `Add one ${line.name}` }, '+'),
el('span', { class: 'line-total' }, fmt.format(line.price * line.qty)),
el('span', { class: 'each' }, `${fmt.format(line.price)} each`),
);
return li;
}
function render() {
list.replaceChildren(...basket.lines.map(lineItem));
const s = subtotal();
const t = total();
document.querySelector('#subtotal').textContent = fmt.format(s);
document.querySelector('#discount').textContent = fmt.format(s - t);
document.querySelector('#total').textContent = fmt.format(t);
}
list.addEventListener('change', (event) => {
const input = event.target.closest('input[data-id]');
if (!input) return;
setQuantity(input.dataset.id, input.value);
render();
});
list.addEventListener('click', (event) => {
const button = event.target.closest('button[data-add]');
if (!button) return;
addOne(button.dataset.add);
render();
});
document.querySelector('#voucher-form').addEventListener('submit', async (event) => {
event.preventDefault();
const code = document.querySelector('#voucher').value.trim();
const message = await applyVoucher(code);
if (message) status.textContent = message;
render();
});
const res = await fetch('/api/basket');
basket.lines = await res.json();
render();
JSStart the server in its own terminal window and leave it running. It reads the files from disk on every request and tells the browser not to cache them, so a reload always picks up your edits.
cd ~/basket-debug-demo
node server.mjsCheck it worked
The terminal prints Basket shop listening on http://localhost:8473. In a second terminal, ask the API for the basket:
curl -s http://localhost:8473/api/basket
echoIt prints the three items as JSON. Open http://localhost:8473/ in Chrome: you see Rice, Beans (quantity 2) and Palm oil, and a total of 13,600.
Step 2 · Reproduce both bugs and write them down
A bug you cannot make happen on purpose is a bug you cannot prove you fixed. Before opening DevTools, find the shortest set of actions that shows each problem, and note what you expected against what you saw.
The total. First show that + on its own works: click the + next to Beans. The quantity goes from 2 to 3 and the total to 15,400, which is right (7,500 + 3 × 1,800 + 2,500). Now reload the page so Beans shows 2 again. This time type 3 into the Beans quantity box, replacing the 2, and press Tab. Then click the + next to Beans. The new number has to differ from the one already in the box: if you type 3 over a 3, the value has not changed, so the browser fires no change event and the bug stays hidden.
The voucher. Type SAVE10 into the voucher box and click Apply.
Write both down, in a note or a comment in your editor:
- Bug 1: after typing a quantity and then pressing
+, the quantity shows31instead of4and the total is far too high. Pressing+without typing first works. - Bug 2: applying
SAVE10shows no message and no discount. Nothing appears in the page to say what went wrong.
Check it worked
Clicking + alone took Beans from 2 to 3 and the total to 15,400. After the reload, typing 3 over the 2, pressing Tab and then + leaves the Beans quantity box showing 31 and the total reading 65,800 when it should be 17,200. After clicking Apply, the Discount line still shows 0 and no message appears under the voucher form. Reload the page to put the basket back to its starting state before the next step.
Step 3 · Look before you pause with the Console
Open DevTools with F12, or Control+Shift+I on Windows and Linux, Command+Option+I on macOS, and choose the Console panel. Reproduce bug 1 again: with Beans showing 2, type 3, press Tab, click +.
Nothing red appears in the Console, which already tells you something: the code is not crashing, it is doing the wrong thing quietly. app.js put the basket on window.basket so you can inspect it from here. Type each of these at the Console prompt and press Enter:
console.log(basket.lines)
console.table(basket.lines)
console.table(basket.lines.map((line) => ({ name: line.name, qty: line.qty, type: typeof line.qty })))console.log prints the array collapsed; you click the arrow to open it and then each item inside. console.table lays the same data out as rows and columns, which is much faster to scan when you are comparing several objects. The third line builds a small table with only the columns you care about, including what kind of value each quantity is.
You can call console.table from your own code too, but these lines are typed at the prompt: nothing in the files has changed.
Check it worked
The last table has three rows. Rice and Palm oil show a type of number. Beans shows qty as 31 and type as string. A quantity that is text, not a number, is your first real clue: "3" + 1 in JavaScript is "31", because + joins strings.
Step 4 · Pause the code with a line breakpoint
Seeing the bad value is not the same as seeing where it came from. Reload the page so the basket is clean, then open the Sources panel. Press Control+P (Command+P on macOS) and type basket.js to open the file.
Find the line sum = sum + line.price * line.qty; inside subtotal() and click its line number. A blue marker appears: that is a line-of-code breakpoint. The next time the browser is about to run that line, it stops.
Type 3 for Beans and press Tab. The page freezes and Sources highlights the line. Now use the panes on the right (or below, on a narrow window):
- Scope lists the variables that exist at this point, grouped by scope.
sumis under Local.lineis declared withconstinside the loop, so it sits in its own Block section above Local. The first stop is the loop's first pass, solineis Rice, withqty: 1. - Watch shows expressions you choose, worked out again each time the code stops. Click the
+in the Watch pane and addtypeof line.qty, then addline.price * line.qty. For Rice they show"number"and7500. - Call Stack shows how the code got here:
subtotalat the top, thenrender, then the anonymouschangehandler inapp.js. Clickrenderin the list and the Scope pane switches to that function's variables. Clicksubtotalto come back.
Press resume (F8, or the play-shaped button in the debugger toolbar) once. The code runs to the same breakpoint on the loop's second pass, and Block now shows line as Beans. Expand it: qty: "3", a string, shown in quotes.
Now step through the rest of the loop. Step over (F10, or the curved arrow in the debugger toolbar) runs the current line and stops at the next one in the same function. Press it a few times and watch sum grow in Scope while line moves on from Beans to Palm oil. Step into (F11) would follow a function call into its body, step out (Shift+F11) finishes the current function and stops in whoever called it, and resume (F8) runs on until the next breakpoint. If the F keys on your laptop control volume or brightness, hold Fn, or use the toolbar buttons.
Press resume until the page unfreezes, then click the blue marker again to remove the breakpoint.
Check it worked
While paused on the Beans line, the Watch pane shows typeof line.qty as "string" and line.price * line.qty as 5400. Multiplication turns "3" into a number, so the sum is still right at this point. The string only causes damage where + is used on it, which is the + button.
Step 5 · Catch the moment with conditional breakpoints and logpoints
A plain breakpoint in addOne would stop every time anyone presses +, including the times that work. You only care about the call where the quantity is already a string.
In Sources, open basket.js again. Right-click the line number of line.qty = line.qty + 1; inside addOne and choose Add conditional breakpoint. Type this condition and press Enter:
typeof line.qty === 'string'The marker turns orange. Reload the page so the basket is back to its starting state; breakpoints survive a reload. Click + next to Rice: the page does not stop, because Rice's quantity is a number. Now type 3 over the 2 in the Beans box, press Tab and click + next to Beans: it stops. In Scope, line.qty is "3". Press step over once and look again: line.qty is now "31". You have watched the bug happen.
That tells you where the damage is done, but not where the string came from. Right-click the line number of line.qty = value; inside setQuantity and choose Add logpoint. Type:
'setQuantity', id, value, typeof valueA logpoint prints to the Console like a console.log you never had to type into the file, and does not pause. Resume (F8), reload, type 5 for Rice and press Tab. Then remove both breakpoints by clicking their markers, or right-click inside the Breakpoints pane and choose Remove all breakpoints.
Check it worked
The Console shows a line like setQuantity rice 5 string, with a link to basket.js at the right. The value comes straight from the input box, and an input's value is always a string, even for type="number". setQuantity stores it as it arrives, and addOne later adds 1 to text.
Step 6 · Fix the total and confirm it
Convert the value once, at the place it enters the basket, so every other function can trust that a quantity is a whole number. Replace basket.js:
cd ~/basket-debug-demo
cat > basket.js <<'JS'
export const basket = { lines: [], discountPercent: 0 };
function findLine(id) {
return basket.lines.find((line) => line.id === id);
}
// Input values are strings. Turn them into a whole number of at least 1 here,
// so the rest of the code only ever sees numbers.
export function setQuantity(id, value) {
const line = findLine(id);
const qty = Number(value);
line.qty = Number.isInteger(qty) && qty > 0 ? qty : 1;
}
export function addOne(id) {
const line = findLine(id);
line.qty = line.qty + 1;
}
export function subtotal() {
let sum = 0;
for (const line of basket.lines) {
sum = sum + line.price * line.qty;
}
return sum;
}
export function total() {
const s = subtotal();
return s - Math.round((s * basket.discountPercent) / 100);
}
JSNumber("3") is 3. An empty box or something like 2.5 falls back to 1 rather than putting a broken value into the basket. addOne is left as it was: once quantities are always numbers, line.qty + 1 is correct.
Check it worked
Reload the page and repeat bug 1: type 3 over the 2 in the Beans box, press Tab, click +. The quantity shows 4 and the total 17,200. In the Console, console.table(basket.lines.map((line) => ({ qty: line.qty, type: typeof line.qty }))) shows number on every row.
Step 7 · Find the silent failure in the Network panel
Bug 2 left no trace in the Console because the code swallows its own error. When a page talks to a server and nothing happens, look at the conversation itself. Open the Network panel, tick Disable cache, and click the Fetch/XHR filter so only requests made by your scripts are listed. Then apply SAVE10 again.
A row named voucher appears. Its Status column shows 400, in red. Click the row:
- Headers shows the URL, the method
POSTand the status code. - Payload shows what the page sent:
{"voucher":"SAVE10"}. - Preview and Response show what came back:
{"error":"Send the voucher in a \"code\" field"}.
The server told the page exactly what was wrong. The page sent the code in a field called voucher, the API expects code, and the page never showed the answer to anyone.
While this panel is open, try the throttling menu at the top (it reads No throttling) and pick a slower preset such as 3G, then apply the voucher again. On a low-end Android phone on prepaid mobile data, requests can take this long, and a voucher button that gives no feedback is easy to press five times. Set it back to No throttling when you are done. To debug the page on your own phone, Chrome can inspect an Android device over USB from chrome://inspect on your computer.
Check it worked
The voucher request shows status 400, the Payload tab shows a voucher field and the Response tab shows the error message about a code field.
Step 8 · Pause on the swallowed exception
The Network panel showed the bad request. The Sources panel can show what the code did with the reply. In Sources, open the Breakpoints pane and tick both Pause on uncaught exceptions and Pause on caught exceptions. The second one matters here, because the error is caught by the empty catch block.
Apply SAVE10 again. The page pauses on basket.discountPercent = data.discount.percent; with a message along the lines of TypeError: Cannot read properties of undefined (reading 'percent'). Hover over data in the code, or look in Scope: it is { error: 'Send the voucher in a "code" field' }. There is no discount in it, so reading .percent from it throws, the catch ignores the error, and the function returns nothing.
There is one more way to stop the code: the debugger statement. Written in your source, it acts like a breakpoint whenever DevTools is open, and does nothing when it is closed. It is handy when a file is hard to find in Sources, or when you want a pause to survive reloads. To try it, add it as the first line inside the catch block of voucher.js, untick the two exception checkboxes, reload and apply the voucher again:
} catch (err) {
debugger;
// Something went wrong. Try again later?
}Look at err in Scope, then press resume. Delete the debugger; line before you go on; the next step replaces the file anyway, and a forgotten debugger will stop the page for anyone who opens DevTools on your live site.
Check it worked
With Pause on caught exceptions ticked, applying the voucher stops on the line that reads data.discount.percent, and Scope shows data with only an error property. With the debugger line in place instead, the pause lands inside catch, and Scope shows err as a TypeError.
Step 9 · Fix the voucher so failures are shown
Two changes: send the field the API expects, and treat a failed response as something to tell the person rather than to hide. A fetch only rejects when there is no response at all, so check res.ok for a 4xx or 5xx answer and show the server's message. Replace voucher.js:
cd ~/basket-debug-demo
cat > voucher.js <<'JS'
import { basket } from './basket.js';
// Always returns a message for the page to show, whether the voucher worked or not.
export async function applyVoucher(code) {
if (!code) return 'Enter a voucher code first.';
let res;
try {
res = await fetch('/api/voucher', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ code }),
});
} catch {
return 'Could not reach the shop. Check your connection and try again.';
}
const data = await res.json().catch(() => ({}));
if (!res.ok) return data.error ?? `The voucher could not be checked (error ${res.status}).`;
basket.discountPercent = data.discount.percent;
return `${data.discount.code} applied: ${data.discount.percent}% off`;
}
JSThe empty catch is gone. The only try left covers the network call itself, and even that returns a message the person can act on.
Check it worked
Untick both exception checkboxes in Sources, reload and apply FREEBIE: the page shows That voucher does not exist, and Network lists the request as 404. Apply SAVE10: the page shows SAVE10 applied: 10% off, Network shows 200, and the Discount line shows 1,360 with a total of 12,240.
Step 10 · Lock both fixes in with a test
DevTools helped you find the bugs. A test makes sure they stay gone when someone changes the code next month. Install Playwright, which drives a real browser from a script, into the demo folder. --with-deps also installs the system libraries Chromium needs on Linux and may ask for your password:
cd ~/basket-debug-demo
npm init -y > /dev/null
npm install playwright@1.65.1
npx playwright install --with-deps chromiumThe test repeats your two reproductions from the second step and checks the totals and messages a shopper would see. It also fails if the page throws any uncaught error.
cd ~/basket-debug-demo
cat > test-basket.mjs <<'JS'
import { chromium } from 'playwright';
import assert from 'node:assert/strict';
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 390, height: 844 } });
const errors = [];
page.on('pageerror', (err) => errors.push(err.message));
await page.goto('http://localhost:8473/');
await page.locator('#lines li').nth(2).waitFor();
const text = (selector) => page.locator(selector).textContent();
assert.equal(await text('#total'), '13,600', 'starting total');
// Bug 1: type a quantity, then press +.
const beans = page.getByRole('spinbutton', { name: 'Quantity of Beans, 1 kg' });
await beans.fill('3');
await beans.press('Tab');
await page.getByRole('button', { name: 'Add one Beans, 1 kg' }).click();
assert.equal(await beans.inputValue(), '4', 'typed 3, then + makes 4');
assert.equal(await text('#total'), '17,200', 'total after typing and +');
// Bug 2: a voucher must always say what happened.
const voucher = page.getByLabel('Voucher code');
await voucher.fill('FREEBIE');
await page.getByRole('button', { name: 'Apply' }).click();
await page.getByRole('status').filter({ hasText: 'That voucher does not exist' }).waitFor({ timeout: 5000 });
assert.equal(await text('#total'), '17,200', 'unknown voucher changes nothing');
await voucher.fill('save10');
await page.getByRole('button', { name: 'Apply' }).click();
await page.getByRole('status').filter({ hasText: 'SAVE10 applied: 10% off' }).waitFor({ timeout: 5000 });
assert.equal(await text('#discount'), '1,720');
assert.equal(await text('#total'), '15,480');
assert.deepEqual(errors, [], 'no uncaught errors on the page');
await browser.close();
console.log('PASS: totals and vouchers behave');
JS
node test-basket.mjsCheck it worked
The last line of output is PASS: totals and vouchers behave. To see the test catch bug 1 again, change line.qty = Number.isInteger(qty) && qty > 0 ? qty : 1; in basket.js back to line.qty = value; and run node test-basket.mjs: it stops with an AssertionError mentioning typed 3, then + makes 4. Put the fix back and it passes.
Step 11 · Keep a routine for the next bug
The tools you used map onto a short routine. Copy it somewhere you will see it:
- Reproduce it with the fewest actions, and write down expected against actual.
- Read the Console for red errors, then inspect the data with
console.table. - If a request is involved, check its status, payload and response in Network before reading any code.
- Pause near the symptom with a breakpoint; use a condition or a logpoint when the line runs often.
- Walk back up the Call Stack until you find where the bad value was made, and fix it there.
- Turn your reproduction into a test, and watch it fail on the old code.
Then stop the server and clean up. Go to the terminal running it and press Ctrl+C. Removing the demo folder also removes the local Playwright install. The browser Playwright downloaded stays in its shared cache; npx playwright uninstall removes that too if you no longer need it.
cd ~
rm -rf ~/basket-debug-demoCheck it worked
curl -s http://localhost:8473/api/basket prints nothing and exits with an error, because nothing is listening, and ls ~/basket-debug-demo reports that there is no such file or directory.
Next steps
- Practise the reproduce, isolate, fix and check routine away from the browser in find a bug step by step.
- Handle loading, error and timeout states for every request, not only vouchers, in fetch JSON and show it with loading and error states.
- Learn how the
changeandclickhandlers in this page work in handle clicks and key presses with event listeners.
Part of these paths
Related tutorials
- Find a bug step by step: reproduce, isolate, fix and checkYou will track down a wrong total in a short Python script by reproducing it, shrinking the input, testing one hypothesis at a time, fixing it, adding a test and writing a bug report.
- Fetch JSON from an API and show it with loading and error statesYou will build a market price search that loads JSON with fetch, shows loading, empty, error and success states, gives up after five seconds and never shows results out of order.
- Handle clicks and key presses with event listeners and delegationYou will build a small to-do list where adding, ticking and deleting tasks work by mouse and keyboard, using one delegated listener on the list, a form submit handler that stops the page reloading, and an AbortController that removes every listener in one call.
Need this done for you?
Padding does this work for growing companies, from the first diagnosis to a system that keeps working.
Get new tutorials