Skip to content

Commit cf01396

Browse files
committed
arguments objects
1 parent 9365257 commit cf01396

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

13_arrofunction/index.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,37 @@ const f4 = (userName) => {
2525
};
2626
// f4("Ashish choudhary");
2727

28-
2928
const f5 = (userName) => {
3029
return "f5 called with userName: " + userName;
3130
};
3231
// console.log(f5());
3332
// console.log(f5('Ashish choudhary'));
3433

35-
36-
function sayHello(fun){
34+
function sayHello(fun) {
3735
fun("Ashish choudhary");
3836
}
3937

40-
sayHello((userName) => {return "Hello " + userName;});
38+
sayHello((userName) => {
39+
return "Hello " + userName;
40+
});
4141
sayHello((userName) => {
4242
console.log("Hello " + userName);
4343
});
44+
45+
// arguments object
46+
47+
function f6() {
48+
console.log(arguments[0]);
49+
}
50+
51+
f6(12, 14);
52+
53+
54+
//
55+
function f7() {
56+
for (let k in arguments) {
57+
console.log(k, arguments[0]);
58+
}
59+
}
60+
61+
f7(12, 14, 50, 70, 60);

0 commit comments

Comments
 (0)