Home License Download Tutorial Reference Projects Feedback History |
What you type is in boldface.
js>1 + 1 2 js>1 + 5 * 5 26 js>(1 + 5) * 5 30 js>Math.pow(5,2) 25 js>Math.log(10) 2.302585092994046 js>Math.PI 3.141592653589793 js>Math.E 2.718281828459045 js>Math.cos(Math.PI / 3) 0.5000000000000001 js>Math.cos(Math.PI / 3).toFixed(3) 0.500 js>Math.min(8 + 4 * 2, (8 + 4) * 2); 16 js>Math.sqrt(8*8); 8 |
js>1 < 4 true js>1 > 4 false js>true && false false js>true || false true js>3 == 4 false js>3 != 4 true js>!true false |
js>var a js>a = 5 5 js>a = "Hello, World!" Hello, World! js>b = [a,2,'three',null,5] Hello, World!,2,three,,5 js>b[2] three js> |
js>function sum(a,b) 2:{ 3: return a+b; 4:} js>function info(obj) 2:{ 3: print(obj.name + ' ' + obj.age); 4:} |
js>c = new Object [object Object] js>c.name = 'Alice' Alice js>c.age = 30 30 js>info(c) Alice 30 js>d = {name: 'Bob', age: 35} [object Object] js>info(d) Bob 35 |
The JSDB tutorial