1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+
4
+ < head >
5
+ < meta charset ="UTF-8 ">
6
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7
+ < title > Java Script Basics</ title >
8
+ < link href ="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css " rel ="stylesheet ">
9
+ < link rel ="stylesheet " href ="css/style.css ">
10
+ < style >
11
+ * {
12
+ margin : 0 ;
13
+ padding : 0 ;
14
+ }
15
+ </ style >
16
+ </ head >
17
+
18
+ < body >
19
+
20
+ < div class ="container ">
21
+ < div class ="row ">
22
+ < h4 class ="fs-4 mt-4 "> JavaScript Ouput</ h4 >
23
+ < p > In JavaScript, "output" generally refers to the way the language produces or displays results from code
24
+ execution. There are several ways to generate output in JavaScript, depending on the context:</ p >
25
+ <!-- <ol style="margin-left: 20px;">
26
+ <li>Console Output()</li>
27
+ <li>JavaScript is the world's most popular programming language. </li>
28
+ <li>JavaScript is clientside scripting Language</li>
29
+ <em>JavaScript is known as a client-side scripting language because it primarily runs in the user's web
30
+ browser rather than on the web server.</em>
31
+ </ol> -->
32
+ < p > < b > 1. Console Output: </ b > console.log(): This method prints messages or values to the browser's
33
+ developer console. It is mainly used for debugging.</ p >
34
+ < p class ="m-0 "> < b > Example:</ b > </ p >
35
+ < code class ="mb-3 ">
36
+ console.log("Hello, World!");
37
+ </ code >
38
+
39
+ < p > < b > 2. Web Page Output: </ b > document.write(): This method writes directly to the HTML document. It's
40
+ generally not recommended for modern web development because it can overwrite the entire page content if
41
+ used after the page has loaded.</ p >
42
+ < p class ="mb-0 "> < b > Example:</ b > </ p >
43
+ < code class ="mb-3 ">
44
+ document.write("Hello, World!");
45
+ </ code >
46
+
47
+
48
+ < p > < b > 3. DOM Manipulation: </ b > JavaScript can be used to modify HTML elements to display output on the
49
+ webpage.</ p >
50
+ < p class ="mb-0 "> < b > Example:</ b > </ p >
51
+ < code class ="mb-3 ">
52
+ document.getElementById("output").innerHTML = "Hello, World!";
53
+ </ code >
54
+
55
+ < p > < b > 4. Alert Boxes: </ b > alert(): This method displays a message in a dialog box with an OK button. It’s a
56
+ simple way to display output but interrupts user interaction with the page. </ p >
57
+ < p class ="mb-0 "> < b > Example:</ b > </ p >
58
+ < code class ="mb-3 ">
59
+ document.getElementById("output").innerHTML = "Hello, World!";
60
+ </ code >
61
+
62
+ < p > Use < code > script</ code > tag for writng javacript code in html</ p >
63
+
64
+
65
+ </ div >
66
+
67
+
68
+ </ div >
69
+
70
+ < script src ="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js "> </ script >
71
+ < p > </ p >
72
+ </ body >
73
+
74
+ </ html >
0 commit comments