-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAnonymousfunctions.js
58 lines (50 loc) · 1.5 KB
/
Anonymousfunctions.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Beats</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script>
var calculation=function(value)
{
var v=value;
v+=10;
v/=2;
return v;
}
function blueWorld(a,b)
{
return a+b;
}
function calculation(value)
{
var v=value;
v+=10;
v/=2;
return v;
}
var mint =calculation(60);
var disc= blueWorld(5,6);
var calculation=function(value)
{
var v=value;
v+=10;
v/=2;
return v;
};
alert(disc);
//we can make variables behave like a function
function subtract(firstNum, secondNum)
{
return secondNum-firstNum;
}
var sub=subtract;//this stores the function capacity in the sub variable
var subOne=subtract(3,7);//this stores the value in the variable not the function
var sub2=sub(8,9);
alert(sub2);
</script>
</body>
</html>