Bookmarklet Code Builder - Online Convert JS to Bookmark
Write a JavaScript snippet and get a ready‑to‑drag bookmarklet link. With minification and encoding. Easy browser tools.
UD5 Toolkit
Explore JavaScript Error.cause to chain errors and preserve debugging context. Build a nested error chain, inspect the cause property, and view stack traces.
Create an error chain to see the output...
Error.cause is an ES2022 feature that allows you to specify the underlying reason for an error. It accepts any value, typically another Error object, and preserves the original stack trace and context. This enables chained errors – a pattern where a higher‑level error wraps a lower‑level one without losing debugging information.
try {
throw new Error("Network timeout");
} catch (originalError) {
throw new Error("File upload failed", { cause: originalError });
}
You can chain more levels by nesting further.
cause property is read‑only. Instead, create a new error and assign the original error as its cause.
cause you get automated standardized chaining, whereas manually concatenating messages loses the original error object and stack trace. Debugging tools and logging libraries can automatically traverse the cause property to present a full error chain.
function logErrorChain(err) {
let current = err;
let level = 0;
while (current) {
console.log(`Level ${level}: ${current.message}`);
if (current.stack) console.log(current.stack);
current = current.cause;
level++;
}
}
cause option works with any built‑in or custom error class that extends Error. Just pass { cause: previousError } to the constructor.
JSON.stringify on an Error object returns {}. The cause property is enumerable and will appear in JSON.stringify(err) as "cause":{...}, but you may need a custom replacer to capture message and stack properly.
class ChainedError extends Error {
constructor(message, originalError) {
super(message);
this.cause = originalError;
}
}
Though not a full polyfill, it provides the chaining pattern until native support is available.
Write a JavaScript snippet and get a ready‑to‑drag bookmarklet link. With minification and encoding. Easy browser tools.
Animate text that looks like it's being decoded or scrambled before settling on the final word. Copy the JS snippet.
Set up multiple @layers and use revert‑layer to fall back. See the computed style and cascade resolution live.
Drop a PDF and extract any embedded JavaScript or form actions. Check for malicious code. Privacy‑friendly analysis.
See your current push subscription details. Trigger push and notificationclick events manually to debug.
Paste JavaScript and catch syntax errors instantly with line numbers. Lightweight pre‑commit check. Local.
Highlight elements with aria‑describedby and see the linked description text. Verify a11y annotations.
Fill in a form and see the FormData object as JSON. Perfect for debugging multipart form submissions. Client-side.
Create promises that resolve or reject after a delay. See state changes and chain .then/.catch. Debug async code.
Write a generator function and step through it with next(). See values and done state. Understand iterators.
Write JavaScript using element.animate() and see the result in a live preview. Compare with CSS keyframes. Debugger included.
Input any JavaScript object and see if structuredClone can deep‑copy it. Compare with JSON.parse/stringify. Learn transferables.
Touch the screen and see the exact coordinates, radius, and force of each touch point. Indispensable for mobile web devs.
Test the Fullscreen API: request fullscreen on a colored div, detect changes, and copy the JavaScript boilerplate.
See the current state of a Service Worker for your page: installing, waiting, active. Unregister or skip waiting. Developer utility.
Choose Babel presets (env, React, TypeScript) and plugins. Get a clean babel.config.json to transpile your code. Local tool.
Press any key to see the complete KeyboardEvent properties: key, code, keyCode, modifiers. Indispensable for game & shortcut developers.
Write JavaScript code and see the output or console.log results immediately. Safe iframe sandbox. For quick experiments.
Paste a list of JavaScript values and see them pretty‑printed as if in the browser console. Great for debugging.
Enter a JSON pointer expression (/foo/bar) to extract a value from your pasted JSON. Debug nested objects quickly.
Press any key and see the full KeyboardEvent object: key, code, keyCode, modifier status. Dev tool.
Paste any JavaScript snippet and get a ready‑to‑drag bookmarklet link. Minify and encode automatically. Pure client.
Paste HTML/CSS snippets or enter properties to test how z‑index and stacking contexts interact. Real‑time example.
Convert any text into JavaScript‑style \uXXXX escape sequences and vice versa. Handles emojis. Useful for i18n development.
Paste any JavaScript expression and see its evaluated type and value. Understand JS coercion and type quirks. Educational.
Enter a regular expression and see a visual railroad diagram explaining the pattern. Learn and debug regex.
Type any condition and see the result of the ternary operator. Understand truthy/falsy values. Quick learning tool.
Press any key to see the corresponding JavaScript event key, code, and keyCode. An essential debugging tool for front-end developers handling keyboard input.
Minify JavaScript and CSS code to reduce file size for production. Remove whitespace and comments instantly. Run locally, your code stays private.
Make your JavaScript code more readable with this online beautifier. Format and indent JS automatically. Works entirely in your browser, protecting your code privacy.