theme(s) / editor / tutorial(s)

search online for more tutorials. See also:

- jsmath -- www.math.union.edu/~dpvc/jsMath
- (ascii)math svg -- www1.chapman.edu/~jipsen/svg/asciisvg.html
- (ascii)math ml -- www1.chapman.edu/~jipsen/mathml/asciimath.html
- (original) js editor -- math.chapman.edu/~jipsen/js

All these packages have been used with gratitude, see theme(s). They
were originally
developed by
Peter Jipsen,
November 2010,
Chapman University.

Comments |
// this is a one-line comment /* this comment could contain linebreaks */ |

Constants |
numbers 12.3 and strings "hi", "hi".charAt(0) is "h" |

Variables |
start with a letter, then use letters, digits or _ (declared with var) |

Expressions |
built from +, -, *, /, pow(x,y), sqrt(), PI, E, log(), floor(), ceil(),random(), sin(), cos(), tan(), atan() and constants, variables, functions |

Assignments |
v = expression; |

Blocks |
{ statement 1; ... statement n; } |

Conditions |
expression == expression or <=, <, >, >=, !=...or !cond, cond1 && cond2, cond1 || cond2 |

if - else |
if (condition) block 1 else block 2 // optional |

for-loops |
for (var i=start; endcondition; i++) block |

while-loops |
while (condition) block |

Functions |
f = function(v1, ..., vn) { statement 1; ... return expression; } |

Lists (arrays) |
a = [1,2,"hi"] a[0] is 1, a.length is 3, a+[4] is [1,2,"hi",4] |

Objects(hash tables) |
object = {attribute:expression, method:function} a = {x:2, y:3, s:function(){return this.x+this.y}} a.x is 3, a["x"] is 3, a.s() is 5 |

Output |
write("Hello"); writeln(" world"); |