-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelloWorld.html
More file actions
43 lines (33 loc) · 1.05 KB
/
Copy pathHelloWorld.html
File metadata and controls
43 lines (33 loc) · 1.05 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JS embeeded in HTML</title>
</head>
<body>
<h1 style="color: brown ;">java script intoduction</h1>
<hr>
<script>
<!-- //javascript code here
//javascript is case sensitive -->
document.writeln("Hello world from javascript");
document.writeln("This is a new line");
document.writeln("<h2> hello world again from javascript</h2>");
//js code to add 2 nos
var num1,num2,sum;
//prompt - used to take input from user at runtime
name = prompt("enter your name: ");
num1 = parseInt(prompt("enter your first number : "));
num2 = parseInt(prompt("enter your second number : "));
sum=num1+num2;
//prints value in console
console.log(sum);
console.log(name);
document.write("<br>"+ "hello"+name+"<br>");
document.writeln("the addition of 2 number is : "+sum);
alert("thank you js "+ name);
alert(100+300);
</script>
</body>
</html>