Skip to content

Commit 9d3cd49

Browse files
Create htmlProgram.html
accidentally added it to workflow, programming example for free forever
1 parent fff58b2 commit 9d3cd49

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

htmlProgram.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
</script>
30+
31+
32+
33+
34+
</html>

0 commit comments

Comments
 (0)