有沒有辦法在這個js塊中避免eval?有沒有一種方法可以避免在這個JavaScript塊中使用eval?
// Check requirements Prototype and Scriptaculous
(function() {
var requires = [
'Prototype'
, 'Scriptaculous'
]
while (r = requires.pop()) {
if (eval('typeof ' + r + ' == "undefined"')) alert(r + ' is required');
}
}());
謝謝你,謝謝你的擡起頭,對全局變量。 – 2011-01-09 04:07:35