Version 1 (modified by 15 years ago) (diff) | ,
---|
JSC
jsc
is a command-line utility that allows you to run JavaScript programs outside of the context of a web browser. It is primarily used as part of the test harness for validating the JavaScript portions of WebKit, but can also be used as a scripting tool.
jsc
can be run in an interactive mode to test out JavaScript expressions, or it can be passed one or more files to run similar to invoking a Perl or Python script.
Usage
Command Line Flags
Usage: jsc [options] [files] [-- arguments] -d Dumps bytecode (debug builds only) -e Evaluate argument as script code -f Specifies a source file (deprecated) -h|--help Prints this help message -i Enables interactive mode (default if no files are specified) -s Installs signal handlers that exit on a crash (Unix platforms only)
Built-In Functions
quit()
Quit the interpreter
Examples
You can use jsc
as a calculator:
$ ./jsc > "hello" hello > 1 + 3 4 > 2 * Math.sin(32) 1.1028533624833812 > 2 * Math.floor(1.2) 2 > 2 * Math.ceil(1.2) 4 > 15.3 / 18 * 27.1 * (Math.ceil(1.3) * Math.exp(2.3) * Math.log (1.223) * Math.sin(32.22)) 66.6192983328985 >
You can also test more complicated expressions:
> var add3 = function(arg) { return arg + 3; } undefined > add3(3) 6 >