summaryrefslogtreecommitdiff
path: root/demo/script.js
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2024-01-01 19:41:30 -0800
committerJesse Morgan <jesse@jesterpm.net>2024-01-01 19:41:30 -0800
commit40ce26ce1e97cf46c598c7a510fa9c8a2162b5fa (patch)
tree05f78878174c7bf4fd1f26d61cc575713ef57c52 /demo/script.js
parent76420739e01cb925eca57845bb4704e97d6c816a (diff)
Add support for calling functions.HEADmaster
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...
Diffstat (limited to 'demo/script.js')
-rw-r--r--demo/script.js7
1 files changed, 6 insertions, 1 deletions
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();
+}
+
+