Codepad guides

A collaborative code editor for debugging together.

Open a code editor, invite a collaborator, and work on the same files with live cursors. Start with the two-file JavaScript exercise below, or bring your own code in any of 40+ languages.

Opens a new pad with the example files. Choose a nickname to label your cursor. No email or account required.

Debug a JavaScript function together

A teammate has a shopping-cart total that joins strings instead of adding prices. Use one file for the function and another for examples, then work through the fix together.

  1. Open the debugging example. The button above creates your own pad with cart.js and examples.js already filled in. Choose a nickname if prompted.
  2. Invite your teammate. Open share, copy the edit link, and send it. They can open it in another browser without an account.
  3. Trace the examples. Switch to examples.js and compare the expected totals with what the function would produce.
  4. Make the fix together. Discuss why JavaScript joins the string prices, then update cart.js. Use the labeled cursors to follow each other.

The starter deliberately contains the bug. Both files are copied into a new pad when you open it:

cart.js

// Prices arrive as strings. Why does this join them instead of adding?
export function subtotal(prices) {
  return prices.reduce((sum, price) => sum + price, 0);
}

examples.js

import { subtotal } from './cart.js';

// Trace these examples together, then run them in your own environment.
console.log(subtotal(['12.50', '7.50'])); // Expected: 20
console.log(subtotal([]));               // Expected: 0
console.log(subtotal(['5', '0', '2']));   // Expected: 7

One fix to discuss

Convert each price before adding it. Then discuss how you would handle an input that is not a valid number.

return prices.reduce((sum, price) => sum + Number(price), 0);

The comments show expected results. Codepad does not execute the function. Run it in your local JavaScript environment when you want to verify the output.

A staged Codepad session with cart.js and examples.js tabs, two collaborators, and the author’s private debugging notes.
An example session in Codepad. The code is shared; the notes on the right belong only to the person viewing this screen.

Keep the discussion beside the code

File tabs keep related snippets under one link. Each participant can use the private notes panel for questions or observations without adding them to the shared code. Editor settings include Vim, Emacs, and VS Code keybindings.

For a practice interview, use the sample exercise and interview rubric. For someone who should only view the code, send a separate read-only link.

What happens when the connection drops?

The connection indicator shows whether the editor is live. Edits synchronize while connected, and the service periodically saves a snapshot. A live connection is not a separate confirmation that every recent edit has reached storage.

If you go offline, keep the tab open and wait for it to reconnect before closing or reloading. Copy important work elsewhere if the connection cannot be restored. Offline changes in an open tab are not a durable backup.

Read how saving and browser identity work before using a pad as the only copy of your work.

When this editor fits

Codepad is useful for a small debugging session, discussing an API response, reviewing a snippet, or teaching a concept. You bring the code and the conversation. There is no terminal, compiler, package installation, or project runtime inside the pad.

Choose a full development environment when you need to execute a project or manage its dependencies. Use Codepad when a shared code editor is enough.