summary refs log tree commit diff stats
path: root/tests/js/test1.nim
blob: 7f1d346f088ea6f439916cbc040cde9171fed00d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
discard """
  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)