English 中文(简体)
贾瓦古尔语有空阵列吗?
原标题:Does JavaScript populate empty array items?

我正在 Java许多年度数据,我正在考虑将这一年作为阵列索引,并将数据输入阵列。 然而,Pabug似乎表明,Java语通过在阵列中填入2 000个“未界定”的奇迹来处理这个问题。 随着数百个此类阵列在积极记忆中环绕,我担心数十万无用阵列项目的间接费用可能会开始减缓方案的执行速度。 吗?

最佳回答

当你确定一个数字指数的价值高于目前的<代码>length时,所涉财产为<代码>length。

简言之,您应使用<代码>。 反对:

var data = {};
data[year] = "some data";

// or
var data = {
  2009: "2009 data",
  2010: "2010 data"
};

现在,我回答问题标题:“Does Javacast populatione food sign items?

如我以前说过,只有<代码>length 财产变更(如有必要,只有在指数增加幅度大于目前的<代码>length时,]length即为高于该指数的数值。

Array.prototype 计算方法的工作假设阵列物体的指数将从零开始。

以前的指数在<代码>中没有实际存在。 轨道物体:

var array = [];
array[10] = undefined;

array.hasOwnProperty(10); // true
array.hasOwnProperty(9);  // false

总之,如果贵方的财产不符合这些要求,则各阵列就意味着要包含从零开始的顺序指数,你只能使用物体。

问题回答

是的,很可能。 你们应考虑使用 Java语,而是:

var years = {2009:  Good , 2010:  Better };

如果你夸大了数千多条不明确的内容,就会影响整个方案速度,而不能肯定你会注意到这一点。

On the other hand, sometimes a sparse array is simpler to use than a custom object, and arrays have such handy methods available.

在一份日历申请中,我开始每年使用物体,但每年由12个成员(月阵列)组成,每个月都有一系列重要日期,其长度取决于拥有任何数据的月份最高日期。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签