#include #include using namespace emscripten; int main() { val Math = val::global("Math"); // two ways to call Math.abs printf("abs(-10): %d\n", Math.call("abs", -10)); printf("abs(-11): %d\n", Math["abs"](-11).as()); // Const-qualification and references should not matter. int x = -12; const int y = -13; printf("abs(%d): %d\n", x, Math.call("abs", x)); // x is deduced to int& printf("abs(%d): %d\n", y, Math.call("abs", y)); // y is deduced to const int& printf("abs(-14): %d\n", Math.call("abs", -14)); return 0; }