Realm: Delete user

Docs suggest:
await app.deleteUser(app.currentUser);
When I test in Realm WebUI this gives result:
{"message":"'app' is not defined","name":"ReferenceError"}
I added:
const app = new App({ id: "<my_app_id>" });
at the top of the function, but get the same result.
How can ‘app’ be ‘defined’ in custom functions? thanks …