Javascript and NodeJS

For the longest time, I have been looking for a better "Google Calculator" - one that supports units, fundamental constants, has a simple syntax, and is optimized for "back-of-the-envelope" calculations. Bonus points for quick-and-dirty Monte-Carlo error propagation.

This does not yet exist, but there are folks who try to marry mathjs with mathjax, which is a start. [Edit: Just yesterday, some random person released a pretty substantial update that allows this. So my efforts on this exact front are pretty much moot.] I never really got far in javascript-programming, but fortunately there are great refreshers online. But I am completely lost about the hot and new topics, such as how to write modules and javascript libraries.

I installed nodejs, which is a server-side scripting engine that coincidentally gives me a convenient REPL for tinkering. Installing mathjs was then as easy as npm install -g mathjs.

Npm allows me to execute node in a command window, and I am dropped into a javascript REPL. Here, .break gets you out of a multiline-mode, and .exit quits.

You load a module with

var mathjs = require("mathjs");
var math = mathjs();

Reminder about var: This doesn't make a difference in global contexts. In local (say, in function) contexts, it makes sure that the declared variable is local.