DynJSECMAScript 运行环境
DynJS 是一个在 JVM 上实现的 ECMAScript 运行环境。
示例代码:
$ wget -q -O dynjs-0.2.0.zip http://bit.ly/dynjs-020-download $ unzip dynjs-0.2.0.zip $ ./bin/dynjs --console DynJS console. Type exit and press ENTER to leave. dynjs> var x = {} dynjs> x.name = "Douglas" dynjs> var speak = function(name) { print(name); } dynjs> speak(x.name) Douglas
$ cat my_app.js print("Hi! What's your name?"); var sayHello = function(name) { print("Hello " + name); } System = java.lang.System; scanner = new java.util.Scanner(System.in); name = scanner.nextLine(); sayHello(name); $ ./bin/dynjs my_app.js Hi! What's your name? Douglas Hello Douglas ^D
评论