这个实用,排查下浏览器自带哪些对象和方法
hs = []//用于存放函数名称的数组
var mytxt = $('#myfunc');
function strToVar(str) { //这个函数是将字符串转换为变量
var json = (new Function("return " + str))();
return json;
}
//Array.from(top.Object.keys(document.defaultView)).map(
Array.from(top.Object.keys(window)).map(
function (x) { //遍历
hs.push(x);
var sjhs = strToVar(x.toString()) //字符串名称转换为实际函数的代码
console.log(sjhs) //控制台输出函数代码
});
//mytxt.val(hs.join('\r\n'));
console.log("函数统计:当前网页共" + hs.length + "个函数")