1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { createModuleURL, jsm, tsm } from "https://esm.town/v/vladimyr/virtualModule";
const { greet } = await import(jsm`
export function greet(name) {
console.log(\`Hello \${name}!\`);
}
`);
greet("val.town");
const { sum } = await import(tsm`
export function sum(a: number, b: number): number {
return a + b;
}
`);
console.log(sum(2, 3));
const { shout } = await import(createModuleURL(
`export function shout(name: string) {
console.log(\`HELLO \${name.toUpperCase()}!\`);
}`,
"application/typescript",
));
shout("val.town");
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
March 2, 2024