Is there a way to avoid eval in this block of js?
// Check requirements Prototype and Scriptaculous
(function () {
var requires = [
'Prototype'
, 'Scriptaculous'
]
while (r = requires.pop()) {
if (eval('typeof ' + r + ' == "undefined"')) alert(r + ' is required');
}
} ());
The
evalhere is completely pointless:This will do the exact same thing, also note that
rleaks into the global scope.