JavaScript

JavaScript moderno (ES2024) con QuickJS-ng: prompt interattivo, script e moduli, file con std/os, timer. Scrivi js, oppure js file.js.

versione 0.17.0 · Licenza: MIT · Sito del progetto

JavaScript

A cosa serve

JavaScript moderno (ES2024) con il motore QuickJS-ng: prompt interattivo, script e moduli ES, lettura e scrittura di file con i moduli std e os, timer.

Come si usa

Comando Cosa fa
js apre il prompt interattivo (>; ... se la riga continua)
js file.js esegue uno script dalla cartella home
js -m file.js lo esegue come modulo ES (automatico per .mjs)
js -e "codice" valuta il codice ed esce
js -h mostra l'aiuto
> [1, 2, 3].map(x => x * 2)
[ 2, 4, 6 ]
> setTimeout(() => print("fatto"), 1000)

Le parentesi aperte continuano sulla riga dopo. I timer partono prima del prompt successivo. Per uscire: EOF.

Limiti

Il prompt è a righe: niente frecce per la cronologia dentro il programma né completamento con Tab. Memoria: fino a 8 MB.

Nel Terminale

JavaScript

Modern JavaScript (ES2024) with QuickJS-ng: interactive prompt, scripts and modules, std/os file APIs, timers. Type js, or js file.js.

version 0.17.0 · License: MIT · Project site

JavaScript

What it is

Modern JavaScript (ES2024) on the QuickJS-ng engine: interactive prompt, scripts and ES modules, file I/O through the std and os modules, timers.

How to use it

Command What it does
js opens the interactive prompt (>; ... when the line continues)
js file.js runs a script from the home folder
js -m file.js runs it as an ES module (automatic for .mjs)
js -e "code" evaluates the code and exits
js -h shows the help
> [1, 2, 3].map(x => x * 2)
[ 2, 4, 6 ]
> setTimeout(() => print("done"), 1000)

Open brackets continue on the next line. Timers run before the next prompt. To quit: EOF.

Limits

The prompt is line based: no arrow-key history inside the program and no Tab completion. Memory: up to 8 MB.

In the Terminal