Declaring Function
We may declare a function in this way:
function nameOfFunction() {
// task to do
}
Enter fullscreen mode
...
For further actions, you may consider blocking this person and/or reporting abuse
This is not how function invocations work:
You might want to look into stack frames to understand what's really going on. This part is especially misleading to beginners:
I am sorry I will try to write it better in the mean times for you this is better :
function myFunction(a, b) {
return a * b;
}
myFunction(10, 2); // Function invocation, will return 20
//optional parameters (es6 only)
//allow to set optional parameters
function myFunction(a, b = 10) {
return a * b;
}
myFunction(1); // Function invocation, will return 10
myFunction(1,5); // Function invocation, will return 5
Thank you so much for your feedback 🙏