From 40ce26ce1e97cf46c598c7a510fa9c8a2162b5fa Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Mon, 1 Jan 2024 19:41:30 -0800 Subject: Add support for calling functions. So far this only works if the function is defined before it is called. Otherwise, it fails in confusing ways. The problem is that I currently assume identifiers are always variables, but functions are currently never variables. Functions are currently treated as special case when they are declared. I'll need to rethink that... --- demo/script.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'demo') diff --git a/demo/script.js b/demo/script.js index 5f536fd..9e7e9ad 100644 --- a/demo/script.js +++ b/demo/script.js @@ -1,5 +1,5 @@ -function main() { +function lowest_price() { const offers = [{ id: 1, price: 2.01}, { id: 2, price: 2.99 }]; let min_price = null; @@ -15,3 +15,8 @@ function main() { return best_offer; } +function main() { + return lowest_price(); +} + + -- cgit v1.2.3