Is it possible to reference methods using function calls?
I thought I could try something like this:
function map(f,lst) {
// calling map method directly is fine.
return lst.map(f)
}
function mapm(m,lst) {
// where m is a passed method
return map( function(x) { return x.m() }, lst)
}
var list_a = [ [1,9],[2,8],[3,7],[4,6] ]
var list_b = mapm(pop,list_a)
>Uncaught ReferenceError: pop is not defined
Try:
If you really want to reference the function itself: