Hej all,
I am new here and new to the language. In essence I am playing around to get familiar with NIM.
Currently, I am trying to reproduce the example on JavaScript invocation from the documentation, see JavaScript invocation example
There it says:
If the browser supports javascript, you should see the value 10. In JavaScript the echo proc will modify the HTML DOM and append the string.
When I create and compile the files as described, I do not get the number 10 displayed in the browser (in neither Firefox, Chromium, Safari). However, I get 10 written to the console output. That makes sense to me as the compiled JS function rawEcho writes the number to the log.
function rawEcho() {
var buf = "";
for (var i = 0; i < arguments.length; ++i) {
buf += toJSStr(arguments[i]);
}
console.log(buf);
}
I was now wondering if I misunderstand the documentation or if I have to do something more as the documentation continues with:
Use the dom module for specific DOM querying and modification procs.
Can anyone please point me to what I could do to make the code behave as described in the documentation? I am running Nim version 0.17.2 on Ubuntu 16.04.
$ nim --version
Nim Compiler Version 0.17.2 (2017-09-07) [Linux: amd64]
Copyright (c) 2006-2017 by Andreas Rumpf
git hash: 811fbdafd958443ddac98ad58c77245860b38620
Thanks in advance and best regards, Helge