Foreign JavaScript

I am interested in finding out what this actually does?

if (result = !!(iterator || Prototype.K)(value, index))

I seen this function in the Prototype library and haven't been able to
find any documentation to gain insight into what the line above does.

  any: function(iterator) {
    var result = false;
    this.each(function(value, index) {
      if (result = !!(iterator || Prototype.K)(value, index))
        throw $break;
    return result;

More specifically it is the ... !!(iterator || Prototype.K)(value,
index) ... piece of code that confuses me.


It looks like it’s going to call the iterator function that’s passed in or Prototype.K if no iterator was passed in. In either case it passes ‘value’ and ‘index’ to the function. I’m guessing that the !! is going to work to convert the return value of that function call to a boolean, which is then assigned to result.