Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d154964

Browse files
Merge pull request #3 from seleniumforchitta/chitta_js_practice
chaning Function code
2 parents 4bab844 + 4813a69 commit d154964

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

‎Functions/Functions1.js‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,16 @@ greet(name)
1313

1414
function add(a,b){
1515
console.log(a+b)
16+
return a+b
1617
}
17-
add(4,5), add(4,55), add(4,555)
18+
add(4,5), add(4,55), add(4,555)
19+
let x = add(3,43)
20+
console.log(x)
21+
22+
23+
//Function as expression
24+
let y = function (num) { return num*num}
25+
console.log(y(5))
26+
27+
let z = y(3)
28+
console.log(z)

‎Functions/VariableScope.js‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// program to show the change in global variable
2+
let a = "hello";
3+
4+
function greet() {
5+
a = 3;
6+
}
7+
8+
// before the function call
9+
console.log(a);
10+
11+
//after the function call
12+
greet();
13+
console.log(a); // 3
14+
15+
// program showing local scope of a variable
16+
var a1 = "hello";
17+
18+
function greet1() {
19+
let b = "World"
20+
a1 = "hellooo"
21+
console.log(a1 + b);
22+
}
23+
24+
greet1();
25+
//console.log(a1 + b); // error

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /