| Author |
Standalone JavaScript programs
|
Hussein Baghdadi
clojure forum advocate
Bartender
Joined: Nov 08, 2003
Posts: 3359
|
|
Hi,
I'm not a JavaScript Ninja so my question may sound really silly.
Is there a way to run JavaScript code outside the browser. I'm looking for something like:
terminal $ jsvm binary-tree.js
Thanks all.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
https://developer.mozilla.org/en/introduction_to_the_javascript_shell
|
 |
Karthik Shiraly
Ranch Hand
Joined: Apr 04, 2009
Posts: 364
|
|
Another solution is using JRE6 Scripting API (javax.script.*). This is suitable if the JS code does not involve changing its container - for example, you can't use this to reliably run JS code that manipulates browser DOM.
It's good for testing data structures, or following DRY principles (example: parameter validation rules can be coded just once in JS and invoked from both client side and server side).
Example:
|
 |
Hussein Baghdadi
clojure forum advocate
Bartender
Joined: Nov 08, 2003
Posts: 3359
|
|
|
Thank you Karthik but actually Eric's link is what I'm looking for. Thank you guys.
|
 |
 |
|
|
subject: Standalone JavaScript programs
|
|
|