HTML · JavaScript · Console

Write code. See the values. Print the result.

Build interactive calculations and document content in the Code workspace. Inspect console output, find errors and use supported JavaScript libraries before reviewing your document for printing or PDF.

document.jsJavaScript
const quantity = 3;
const unitPrice = 12.5;
const total = quantity * unitPrice;

console.log({ quantity, unitPrice, total });
Illustrative console output
▸ {quantity: 3, unitPrice: 12.5, total: 37.5}
Document result37.50

Example preview. Your code runs only when you press Run in the editor.

Inside the Code workspace

Feedback while you build your document.

Inspect values in the console

Use console.log(), console.info(), console.warn(), console.error() and console.table() to inspect values, objects and arrays. Filter messages or clear the output. Logging an error does not stop the script.

Find syntax and runtime errors

Syntax checking highlights invalid code before execution. Runtime exceptions and unhandled promise rejections appear with a stack trace and, when available, a clickable source line and column.

Add jQuery or React

Select a supported library above the JavaScript editor. The selected versions load with your document and the selection is preserved with the saved source.

From source to document

Start with a small working example.

  1. Open Code and add HTML

    Open the editor, choose Code and enter your document markup in the HTML view. CSS can be included in a style element.

  2. Switch to JavaScript

    Add calculations and supported document events. If your code uses jQuery or React, select that library above the source editor.

  3. Run and inspect

    Press Run or Ctrl+Enter / ⌘+Enter. Check the interactive preview and console. Use a reported source location to return to the code and fix an error.

  4. Review and export

    Review the result, save your document and print or export PDF. Form values become static content in the printable document.

A calculation you can inspect

Copy the HTML into the HTML view and the script into the JavaScript view. This example needs no library. Run it to display the total and inspect the calculation in the console.

HTML source

<h2>Price calculation</h2>
<p id="total"></p>

JavaScript source

const quantity = 3;
const unitPrice = 12.5;
const total = quantity * unitPrice;

console.log({ quantity, unitPrice, total });
document.querySelector("#total").textContent = total.toFixed(2);

Supported library builds

Choose the tools your document needs.

Choose the tools your document needs.
LibraryAvailable namesTypical use
jQuery 3.7.1slim$ · jQuery

Select elements, update text and respond to supported events. The slim build excludes Ajax and effects.

React 18.3.1+ ReactDOM 18.3.1React · ReactDOM

Build components and update state using React.createElement(), hooks and ReactDOM.createRoot(). Write plain JavaScript; JSX compilation is not included.

Library selection is stored as source comments. Supported pinned CDN imports are recognized during HTML import and use the bundled copies. Other external scripts and module scripts are omitted.

Know the environment

Support that matches a document workflow.

Explicit, isolated execution

Imported and restored scripts remain stopped until you press Run. Scripts use an isolated virtual document, and unresponsive scripts are stopped so the editor remains usable.

Document APIs and events

Use supported document elements and input, change, click, keydown, keyup, focus, blur and submit events. Full browser layout APIs, network requests, cookies and browser storage are unavailable to the script.

Logging and error diagnostics

The console displays values and error locations. Breakpoints, step-through debugging, live expression evaluation, module loading and JSX compilation are not provided.

Static print and PDF output

The printable snapshot contains the document result. Scripts and buttons are excluded; input values are converted to text or checkbox symbols. Check the result before exporting.

Common questions

Does console.error stop my script?

No. It records an error-level message. A thrown exception or an unhandled promise rejection is reported as a runtime failure and stops execution.

Can I load any external library URL?

Use the jQuery and React options offered in the editor. Arbitrary external script URLs and JavaScript modules are not loaded. The supported pinned libraries are bundled locally.

Will the console or JavaScript appear in the PDF?

No. Printing and PDF export use the static document result. Your source and library selection remain part of the saved editable document.

Give your next document a working calculation.

Open Code, add your source and use the console to verify the result before printing.

Open editor