-
-
Notifications
You must be signed in to change notification settings - Fork 637
qjs.com
mattx edited this page Sep 6, 2023
·
3 revisions
QuickJS is a small and embeddable JavaScript engine. It comes with an interactive command-line interface with contextual colorization.
The source code for qjs.com
can be found in the third_party/quickjs
folder.
git clone https://github.com/jart/cosmopolitan && cd cosmopolitan
build/bootstrap/make.com o//third_party/quickjs/qjs.com
./o/third_party/quickjs/qjs.com
Run and test the interpreter:
$ o/third_party/quickjs/qjs.com
QuickJS - Type "\h" for help
qjs >: console.log(2+2)
4
undefined
qjs >:
Print 10 numbers from the Fibonacci sequence:
qjs >: let a = 0, b = 1, temp; for (let i = 0; i<9; i++) { console.log(a); temp = a+b; a=b; b=temp; }
0
1
1
2
3
5
8
13
21
34