summary refs log tree commit diff stats
path: root/tests/js/test1.nim
blob: 3f3d5f02c4e9c48e8393258f6cbd7ff6d714b74c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
discard """
  cmd: "nimrod js --hints:on $# $#"
  output: "1261129"
"""

# This file tests the JavaScript generator

import
  dom, strutils

var
  inputElement = "1123"

proc OnButtonClick(inputElement: string) {.exportc.} =
  let v = $inputElement
  if v.allCharsInSet(whiteSpace):
    echo "only whitespace, hu?"
  else:
    var x = parseInt(v)
    echo x*x

onButtonClick(inputElement)