-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlecture15.html
67 lines (60 loc) · 3.28 KB
/
lecture15.html
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
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lecture 15 | Functions Arrow Functions in javascipt |</title>
</head>
<body>
*****************************Tutorial Start 🔥 ********************************
<h1>Functions Arrow Functions in javascipt</h1>
<h4>What is Function</h4>
<p>Block of code designed to perform specific or particular task.</p>
<span>block of code means: kayi saari code ko alag kar dia jaata hai aur uska aik name de la
dia jaata hai aur uss code ka kuch task hota hai. jab hum uss code ko call karte hai uske
name se tab, mera jab specified task or particular task hota hai voo call ho jaata hai.
</span>
<script>
//how we create a javascript function
// function functionname (argument) { //yaha argument values ho sakte hai
//task
// }
//how we call/invoke a javascript function
// functionname (argument) //yaha argument pass karna hota hai jo create karne me hum add kiye thea.
//New Approach hai function create karne ka (arrow-> function)
</script>
<li>Predefined function</li>
<li>UserDefined function</li>
<p>function ko create karte time parenthesis () use karna hota hai, and call/invoke karte time bhi parenthesis ()
use karna hota hai. </p>
<p> jis code ko hame baar baar jarurat padhti hai, uss code ka hum function me bana sakte hai</p>
<p>jo function ko create karte time jo parameters/argumennts hum banate hai usko hum,
*formal parameters kehte hai</p>
<p> aur jo call/invoke karte time hum jo value paas karte hai parameters me usko hum
*actual parameters kehte hai</p>
<p>jab bhi hum function ko call kare, too jo formal paramters and actual parameters hai, in dono ki
matching honi chahiye.
Matching ka matlab agar maine two elements liye hai formal parameters mai , too agar maine 2 value pass kar dia
hai
actual parameters mai tab hi ye call ho payega.</p>
<p>Suppose maine 2 elements liye hai formal parameters mai and maine 1 value pass ki hai actual parameters me too
output aayega NaN(not a number)</p>
<p>function ko call karte time humko parenthesis() use karna hota hai, agar hum parenthesis use nhi karte hai too
voo
function ka defination return ho ke aajega.</p>
<h4>hum function ko kab kab call kar sakte hai </h4>
<li>self call(khud se)</li>
<li>event call(clickonButton function call)</li>
<li>callback function (automatically call)</li>
<h4>why you use function</h4>
<li>code reusability </li>
<p>koi function agar aisee ban rha hai jiska name nhi de rha hai, usko hum anonymouse function kehte hai.</p>
<li>ab humko function kahi pass karna hota hai tab hum anonymouse function banate hai, suppose mai aik function
bana rha hu aur usme dusara function pass kar rha hu tab hum anonymouse function banake wahi pe pass kar sakte
hai.</li>
<li>isko mai kisi bhi variable me assign kar sakte hai.</li>
<script src="lecture15.js"></script>
***************************** Tutorial End 🚀 ********************************
</body>
</html>