偶然在网上看到这样的写法
1 'alert("hello")'.replace(/.+/, eval);
2 'alert("hello")'.replace(/.+/, function(m){new Function(m)();});
3
4 var i = 0; eval(Array(10).join('alert(++i);'));
5 var i = 0; new Function(Array(10).join('alert(++i);'))();
2 'alert("hello")'.replace(/.+/, function(m){new Function(m)();});
3
4 var i = 0; eval(Array(10).join('alert(++i);'));
5 var i = 0; new Function(Array(10).join('alert(++i);'))();
挺精妙的写法,记下备用