![]() |
Home License Download Tutorial Reference Projects Feedback History |
js>1+4
5
js>writeln("hello, world")
hello, world
|
js>var a = 100000; js>var b = 2000; js>a / b 50 js>typeof a number js>var c = "Hello"; js>typeof c string |
js>me = {name: 'Shanti', home: 'California'};
js>writeln(me.name)
Shanti
js>writeln(me.name," lives in ",me.home);
Shanti lives in California
js>f = [1,1,2,3,5,8,13,21];
js>for (var i in f) writeln(f[i])
1
1
2
...
|
Stream is a built-in object. Stream objects can represent files, TCP sockets, web pages, RS-232 ports, pipes, and dynamically allocated blocks of memory.
js>var s = new Stream('jsdbhelp.html')
jsdbhelp.html
js>s.readFile()
<head>
<title>JSDB Help</title>
...
js>quit
|
js>
js>run('perfect.js')
...
js>load("xml.js")
js>x = readXML(new Stream('test.xml'));
js>items = x.find('item');
js>for (var i in items) writeln(items[i].cdata);
...
|
Create a .js file using your favorite text editor. Run it with one of
jsdb.exe program.js
jsdb.exe -load xml.js program.js
c:\temp>pkzip program.zip main.js |
There are two interactive debuggers, debugconsole.js and debug.js.
c:\temp>jsdb debug.js localhost:8832 c:\temp>jsdb.exe -debug localhost:8832 myprogram.js |
Or, more conveniently,
c:\temp>jsdb debug.js myprogram.js |
The JSDB cookbook