Which programming language is this?
const handler = (e: MouseEvent) => {
const target = e.target as HTMLElement | null;
target?.classList.toggle("active");
};
document.addEventListener("click", handler);
Answer: TypeScript
It reads like JavaScript, but the
Play Programming Languages ▸
(e: MouseEvent) parameter annotation and the as HTMLElement | null cast only parse in TypeScript.