Line by line
1. async function loadUsers(teamId) {Defines a function: a reusable block you can call by name.
2. const res = await fetch(`/api/teams/${teamId}/users`);Declares a variable — a named box holding a value.
3. if (!res.ok) {A condition: the block below only runs when this is true.
4. throw new Error("request failed");Plain statement — it does its work and moves on.
5. }Plain statement — it does its work and moves on.
6. const users = await res.json();Declares a variable — a named box holding a value.
7. return users.filter((u) => u.active).map((u) => u.name);Defines a function: a reusable block you can call by name.
8. }Plain statement — it does its work and moves on.