about summary refs log tree commit diff stats
path: root/js/baba-yaga/simple-js-test.baba
blob: 2575d334d61d62db710a38625de7630e8793e551 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// simple-js-test.baba - Simple test for JS interop debugging

// Test Math.abs
absResult : io.callJS "Math.abs" [-42];
io.out "Math.abs result:";
io.out absResult;

// Test JSON.parse
jsonStr : "{\"name\": \"Alice\", \"age\": 30}";
parseResult : io.callJS "JSON.parse" [jsonStr];
io.out "JSON.parse result:";
io.out parseResult;

// Test property access
propResult : when parseResult is
  Ok obj then io.getProperty obj "name"
  Err msg then Err msg;

io.out "Property access result:";
io.out propResult;