+ 2
quick question
Hey guys, can you please explain to me what does it mean closure[0](6) what exactly mean having [] and () next to each other?
4 Answers
+ 3
I'm not quite sure but maybe the closure array's first element (index 0) is a function that takes 1 argument.
for example
const foo = (val) => {
console.log(val);
}
const arr = [foo, 10, 20];
arr[0](6);
+ 3
Khaled, that is how you pass argument to a function.
function foo(a) {
console.log(a);
}
//In simple function call we do it like this
foo(6);
But since our function is part of that array, we call it that way.
+ 1
Got you Rick, Thank you so much ^^
0
yes Rick the closure arguments are a function and integer.
I could not understand what the (6) means.