There was an error while loading. Please reload this page.
1 parent fff58b2 commit 9d3cd49Copy full SHA for 9d3cd49
htmlProgram.html
@@ -0,0 +1,34 @@
1
+<!DOCTYPE HTML>
2
+
3
+<html>
4
5
6
7
8
+<script id="myscript">
9
+function newFunction(a, b) {
10
+ return a + b;
11
+}
12
+</script>
13
14
15
16
17
+<!--the order you load the modules (or scripts) matters, as its embedded in HTML-->
18
19
20
21
+<script id="myScript2">
22
+// Access the script element by its ID (Script 1)
23
+const scriptElement = document.getElementById('myScript');
24
25
+// Call newFunction from Script 1
26
+const result = newFunction(2, 2);
27
+console.log(result); // This will log 4 to the console
28
29
30
31
32
33
34
+</html>
0 commit comments