You're welcome. An omission and a further suggestion on my part, though.
The omission:
for (var i = 0, len = win.frames.length; i < len; i++)
is more efficient than
for (var i = 0; i < win.frames.length; i++)
and as safe if you can be sure that the number of items does not change
while looping. For that matter, if you stored the value of “win.frames” in
a variable and access that variable instead, it would be even more
efficient:
for (var i = 0, frames = win.frames, len = frames.length;
i < len; i++)
{
var api = findAPI(frames[i]);
if (api) {
return api;
}
}
Or you might want to wrap it as suggested e. g. in
<
http://naildrivin5.com/blog/2013/05/17/source-code-typography.html?utm_content=buffer5f552&utm_source=buffer&utm_medium=twitter&utm_campaign=Buffer>
(from David Bryant Copeland [@davetron5000 at Github], by tweet of
@kevinSuttle):
for (var i = 0,
frames = win.frames,
len = frames.length;
i < len; i++)
{
var api = findAPI(frames[i]);
if (api) {
return api;
}
}
The suggestion: _it's_ _e-learning_ :)