Code-defined decks with live demos and polls
const button = document.querySelector('button');
button.addEventListener('click', () => {
console.log('clicked');
}); A plain code block keeps its Copy button.
The area of a circle is A=πr2.
i=1∑ni=2n(n+1)<div class="box">Hello, slides!</div> .box {
padding: 24px;
border-radius: 12px;
background: tomato;
color: white;
font: 600 28px system-ui;
} Press Run to see the result
for (let i = 1; i <= 3; i++) {
console.log('step', i);
}
console.warn('this is a warning'); Press Run to see the result
Press Run — this demo does not start on its own.
<button id="count">Clicked 0 times</button> button {
font: 600 22px system-ui;
padding: 12px 20px;
margin: 24px;
} let n = 0;
const button = document.getElementById('count');
button.addEventListener('click', () => {
n++;
button.textContent = `Clicked ${n} times`;
}); Press Run to see the result
Edit shows the code; ↗ opens the demo in the playground.
First, a question: what does textContent do with markup?
<p id="out"></p> document.getElementById('out').textContent = '<b>bold?</b>'; Press Run to see the result
The counter button on slide 7 is clicked three times. What does it say?
Which method attaches an event handler?
Scan the QR code on the board, or open gkrisz.space/s and type the code.
Your phone follows the presenter; switch to Browse to look around on your own.