-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcodewarsChallenge54.html
More file actions
31 lines (29 loc) · 1005 Bytes
/
codewarsChallenge54.html
File metadata and controls
31 lines (29 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JavaScript Function</title>
</head>
<body>
<h1>JavaScript Fuction</h1>
<h2>Function Sequence</h2>
<p>JavaScript functions are executed in the sequence they are called.</p>
<p id="demo"></p>
<script>
function myDisplayer(some){
document.getElementById("demo").innerHTML = some;
// document.getElementById("demo").innerHTML += some + "<br>"; // Append the text
/*The use of += in document.getElementById("demo").innerHTML += some + "<br>"; allows you to append content instead of replacing it, ensuring both messages are displayed sequentially.*/
}
function myFirst(){
myDisplayer("Hello");
}
function mySecond(){
myDisplayer("Goodbye");
}
myFirst();
mySecond();
</script>
</body>
</html>