mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +00:00
The URLs of the form `help://man/<section>/<page>` link to another help page inside the help application. All previous relative page links are replaced by this new form. This doesn't change any behavior but it looks much nicer :^) Note that man doesn't handle these new links, but the previous relative links didn't work either.
1.5 KiB
1.5 KiB
Name
js - evaluate JavaScript
Synopsis
$ js [options...] [script.js]
Description
js
evaluates JavaScript programs using the LibJS engine. If you pass it a path
to a script file, it will execute that script. Otherwise, it enters the
Read-Eval-Print-Loop (REPL) mode, where it interactively reads pieces (usually,
single lines) of code from standard input, evaluates them in one shared
interpreter context, and prints back their results. This mode is useful for
quickly experimenting with LibJS.
Run help()
in REPL mode to see its available built-in functions.
Options
-A
,--dump-ast
: Dump the Abstract Syntax Tree after parsing the program.-d
,--dump-bytecode
: Dump the bytecode-b
,--run-bytecode
: Run the bytecode-p
,--optimize-bytecode
: Optimize the bytecode-m
,--as-module
: Treat as module-l
,--print-last-result
: Print the result of the last statement executed.-g
,--gc-on-every-allocation
: Run garbage collection on every allocation.-c
,--disable-ansi-colors
: Disable ANSI colors-h
,--disable-source-location-hints
: Disable source location hints-s
,--no-syntax-highlight
: Disable live syntax highlighting in the REPL
Examples
Here's how you execute a script:
$ js ~/Source/js/type-play.js
And here's an example of an interactive REPL session:
$ js
> function log_sum(a, b) {
> console.log(a + b)
> }
undefined
> log_sum(35, 42)
77
undefined