function greet(name) {
return `Hello, ${name}!`;
}
const nums = [3, 1, 4, 1, 5, 9];
nums.sort((a, b) => a - b);
console.log(nums.join(', '));
function square(x) {
return x * x;
}
def greet(name):
return f"Hello, {name}!"
nums = [3, 1, 4, 1, 5, 9]
nums.sort()
print(', '.join(map(str, nums)))
def square(x):
return x * x
view-comparator component. Drag the vertical bar to
redistribute width between panels. Drag the strip at the bottom edge to change
the component height. Click either panel to shift the split by one step. Use the
small ▲ / 0 / ▼ buttons that appear in the top-right corner of the
right panel to shift that panel's content up or down for line-by-line alignment;
keyboard shortcuts Alt+↑, Alt+↓, and
Esc also work when the right panel has focus.
VC_STYLE for the CSS and VC_TEMPLATE for the HTML
structure.
.container flex row holding
.panel-left, a .splitter bar, and
.panel-right, plus a .resizer strip below the container
for height adjustment. The right panel also hosts an .offset-controls
overlay with three small buttons for shifting content vertically.
slot="left" and
slot="right") so the host page supplies content as slotted
<pre> or <pre><code> elements.
step-px increment. Offset
controls: click on ▲/▼ to shift right-panel content by
offset-step-px; click 0 to reset; Alt+Arrow keys and
Esc work when the right panel has focus.
slotchange listener on each slot applies Prism highlighting and
normalizes the box model of newly assigned <pre> elements,
then scrolls both panels to the top.
ResizeObserver on the host element re-applies the current split
ratio whenever the host changes width, keeping the panels correctly proportioned
during page resizes.
_getLeftPx(), _setLeftPx(),
_availableWidth(), _totalWidthPx(),
_getHeightPx(), _setHeightPx(),
_applyStyles(), _applyLayout(),
_maybePrism(), _harmonizeSlotted(),
_adjustOffset(), _setRightOffset(),
_applyRightPaddingTop(), and _handleOffsetKey().