-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctions in JS.html
More file actions
40 lines (36 loc) · 1.47 KB
/
Functions in JS.html
File metadata and controls
40 lines (36 loc) · 1.47 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
<!DOCTYPE html>
<html lang="en">
<head>
<title> Functions in JS</title>
</head>
<body>
<h1>Functions in JavaScript</h1>
<p>Here we are discuss about the some function ...syntax</p>
<p> Simply starts with product of the two variables 4, 3 is</p>
<p id="demo1"></p>
<p id="demo2"> Here the product of two numbers a and b</p>
<!-- simple function ....here we call and print the operation on it -->
<script>
function myFunction(p1, p2) {
return p1*p2 ;
}
document.getElementById("demo1").innerHTML = myFunction(4, 3);
</script>
<!-- Product of the two numbers 5 and 20 .. -->
<script>
var x = myFunction(5, 20) ;
document.getElementById("demo2").innerHTML = x;
function myFunction(a, b) {
return a * b ;
}
</script>
<p id="demo3" ></p>
<!-- Functions as the variables for the other function -->
<script>
document.getElementById("demo3").innerHTML = "The temperature is " + toCelsuis(77) + "Celsius";
function toCelsuis(fahrenheit) {
return (5/9) * (fahrenheit-32) ;
}
</script>
</body>
</html>