Javascript 在Jquery中查找vs选择器速度
我有一个包含许多行的表。我需要使用jquery查找td数据。 有很多方法可以获得这些数据Javascript 在Jquery中查找vs选择器速度,javascript,jquery,css,Javascript,Jquery,Css,我有一个包含许多行的表。我需要使用jquery查找td数据。 有很多方法可以获得这些数据 1. $("table tr td").each(function(){}) 2. $("table").find("tr").find("td").each(function(){}) 现在我想知道哪种方法更好,为什么?使用console.time和console.timeEnd进行评测将以微秒为单位提供其他性能 console.time('withSelector'); for(var i=0
1. $("table tr td").each(function(){})
2. $("table").find("tr").find("td").each(function(){})
现在我想知道哪种方法更好,为什么?使用
console.time
和console.timeEnd
进行评测将以微秒为单位提供其他性能
console.time('withSelector');
for(var i=0; i<10E4 ;i++)
$("table tr td");
console.timeEnd('withSelector');
console.time('withSelector');
对于(var i=0;i使用console.time
和console.timeEnd
进行分析将以微秒为单位提供其他性能
console.time('withSelector');
for(var i=0; i<10E4 ;i++)
$("table tr td");
console.timeEnd('withSelector');
console.time('withSelector');
对于(var i=0;欢迎光临