JavaScript Stored Programs

Since 9.0, LANGUAGE JAVASCRIPT lets a routine body be JavaScript (ECMAScript 2024 in 9.7) between $$ quotes, with session.sql() for queries; 9.2 added CREATE LIBRARY and a transaction API, 9.4 WebAssembly libraries. On Community 9.7.2 the definition is stored, and only the call fails:

A JavaScript function on a Community serverSQL
CREATE FUNCTION gcd(a INT, b INT) RETURNS INT NO SQL LANGUAGE JAVASCRIPT AS $$
  let x = Math.abs(a), y = Math.abs(b);
  while (y) { [x, y] = [y, x % y]; }
  return x;
$$;
SELECT gcd(75, 220);
Output
ERROR 6001 (HY000): Language component: Not available.

The client needs no DELIMITER, since it reads $$ ... $$ as one quoted string. JavaScript suits parsing and validation code already written in it; on a LAMP stack, that code belongs in PHP.