switch·Esc back

JavaScript

You might say

What language makes the interactive parts of a webpage move and respond?

A programming language that makes a web page respond to actions and dataWhen someone marks a task complete, browser JavaScript can send a request, receive the updated list, and change that row on the page. JavaScript can also run on a server through Node.js, which is a different environment with different responsibilities.
Know first
JS
Why does one click change a page?
task.js
1button.addEventListener("click", async () => {
2 const task = await fetch("/api/task/1")
3 row.textContent = task.done ? "Done" : "Not done"
4})
localhost:3000
Organize meeting notes
Not clicked yet
How a click updates the interface

Handle the clickJavaScript runs the action prepared for that button.

Wait for the resultIt can ask a server for an updated list, which may arrive later or fail.

Update the visible partAfter the result arrives, code changes the relevant value and the browser redraws it.

Learn next
Further reading