Daud Daud - 1 year ago 125
AngularJS Question

Which javascript construct is this AngularJS filter expression?

If we wish to use a filter in AngularJS on the controller side, we use this

$filter('filter')(array, expression, comparator, anyPropertyKey)

I can't understand which javascript construct is this using. I mean, its not a function, its not an assignment expression, its not a self-executing function. What is it ?

Answer Source

It's a function which returns a function which you then execute.

function foo() {
    return function bar() {};


// equivalent to:
var b = foo();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download