summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/system/jssys.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/system/jssys.nim b/lib/system/jssys.nim
index 3bf506e1e..1c8ea9d88 100644
--- a/lib/system/jssys.nim
+++ b/lib/system/jssys.nim
@@ -278,7 +278,9 @@ proc toJSStr(s: string): cstring {.compilerproc.} =
 
 proc mnewString(len: int): string {.asmNoStackFrame, compilerproc.} =
   asm """
-    return new Array(`len`);
+    var result = new Array(`len`);
+    for (var i = 0; i < `len`; i++) {result[i] = 0;}
+    return result;
   """
 
 proc SetCard(a: int): int {.compilerproc, asmNoStackFrame.} =