[英]Faster way to print an array cell than doing a for loop
So I have an array like: 所以我有一个像这样的数组:
var arra= new String [50,50];
// I add in arrays and for every added row, update count by 1. The columns are till incount which is less than 50.
for(i=0;i<=count;i++)
{
for(j=0;j<incount;j++)
{
print (bigsub[i,j]);
}
}
Is there a faster way I can do this? 有没有更快的方法可以做到这一点? Can I do this for the inner array as well?
我也可以对内部数组执行此操作吗?
您可以使用JSON.stringify(array)
,我认为它将起作用。
If all you need to do is print it (for debugging purposes) you can use @vimalnath's suggestion in the question comment above. 如果只需要打印(出于调试目的),则可以在上面的问题注释中使用@vimalnath的建议。 If however you want to do this for some heavy duty operations and you are open to using HTML 5 then you could employ multiple Web Workers to do this job asynchronously for you.
但是,如果您想对某些繁重的操作执行此操作,并且愿意使用HTML 5,则可以雇用多个Web Worker为您异步执行此工作。
要在javascript中打印数组,可以使用此
alert(arrayObj.join('\n'));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.