In jquery when I run:
$('li').each(some-function(i){});
The IDE seems to know that some-function is expecting an index.
It leads me to believe I can make a function in javascript/jquery that expects a function as one of it's parameters that expects certain paramters. (I am new to javascript)
I know how to do it in c language.
I am looking for something like this:
void somefuncA ( void (*funcB)(int) ){
//do stuff with funcB
(*funcB)(5);
}
So the function 'somefuncA' expects to get a function funcB that gets one integer as a parameter and then does something.
Hope that makes sense.. thanks
p.s. I know JavaScript is weakly type but I also noticed that .each()
expects a function as parameter and not just any function but one with an int as parameter.