-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.html
More file actions
39 lines (34 loc) · 822 Bytes
/
function.html
File metadata and controls
39 lines (34 loc) · 822 Bytes
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
<script>
//simple function
function SimpleFunction() {
console.log("Simple function Calling");
}
SimpleFunction()
//passing variable in function
function passvariable(a,b){
console.log(a-b)
}
passvariable(7,5);
//global keyword a in this function we don't want to write var,let,const keyword in this
function fun1()
{
a = 10;
}
fun1()
console.log(a);
//return number
function fun2(num)
{
return num-2;
}
console.log(fun2(10))
//single line
function nextLine(arr,item){
arr.push(item)
return arr.shift();
}
var testArr=[1,2,3,4,5]
console.log("Before : "+JSON.stringify(testArr));
console.log(nextLine(testArr,6))
console.log("After : "+JSON.stringify(testArr));
</script>