isClosure

Checks if a given object is a closure.

isClosure(object) → returns boolean

Argument Reference for the isClosure function

object

Required: Yes
The object to check if it is a closure.

Examples sample code invoking the isClosure function


Returns true if the object is a closure

square = function(x) {
    return x * x;
};

writeDump(isClosure(square));

Expected Result: TRUE


Returns false if the object is not a closure

square = function(x) {
    return x * x;
};

squared = square(5);

writeDump(isClosure(squared));

Expected Result: FALSE


Fork me on GitHub