eval
здесь совершенно бессмысленно:
// since everything in the global scope gets defined on 'window'
typeof window[r] === 'undefined';
Это сделает то же самое , также отметим, что r
просачивается в глобальную область.
// Check requirements Prototype and Scriptaculous
(function () {
var requires = ['Prototype', 'Scriptaculous'];
var r = ''; // make sure to __not__ override a global r
while (r = requires.pop()) {
if (typeof window[r] === 'undefined') {
alert(r + ' is required');
}
}
} ());