阵列["属性&QUOT]。 [英] array.["property"]

查看:87
本文介绍了阵列["属性&QUOT]。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

这意味着什么是奇怪的sintax(看看对象:)?


如果我有ie array.length我可以使用数组。[" length"]是

IE / Firefox兼容??

解决方案

尝试不带点:


数组[''length'']与array.length相当。


11月21日,上午8:09,josh < xdevel2 ... @ yahoo.comwrote:


大家好,

这意味着什么是奇怪的sintax(看看对象:)?


如果我有ie array.length我可以使用数组。["长度"]并且是

IE / Firefox兼容?


josh写道:


大家好,

什么它是否意味着奇怪的sintax(看看对象:)?


如果我有ie array.length我可以使用数组。[" length"]并且它是

IE / Firefox兼容??



array [" length"]相当于array.length


在javascript中,一个对象与一个关联数组相同,它使得数组和对象之间的形式差异变得模糊。


这是由ECMA-262标准,因此与所有浏览器和所有javascript引擎兼容




数组。["长度"](注意点)是语法错误。一些javascript

解析器*可以*容忍它,但你*不应该依赖它。

-

Martijn Saly


josh说:


>
大家好,
这意味着什么奇怪的sintax(看对象:)?



你似乎的意思是看看主题,这对于某些新闻阅读者来说是一件令人讨厌的事情。不要让人们阅读这个主题,而他们正在阅读这条消息。


> if我有ie array.length我可以使用数组。[" length"]并且它是IE / Firefox兼容吗?



不,你不能在任何浏览器中使用这种语法,但你应该使用:
能够使用:array ["长度在任何一个。没有点。


您可以使用此表示法来访问任何对象的属性。

-


Hi all,
what does it meaning that strange sintax (look at the object :) ?

if I have i.e. array.length I can use array.["length"] and is it
IE/Firefox compatible??

解决方案

Try it without the dot:

array[''length''] is equivilant to array.length.

On Nov 21, 8:09 am, "josh" <xdevel2...@yahoo.comwrote:

Hi all,
what does it meaning that strange sintax (look at the object :) ?

if I have i.e. array.length I can use array.["length"] and is it
IE/Firefox compatible??


josh wrote:

Hi all,
what does it meaning that strange sintax (look at the object :) ?

if I have i.e. array.length I can use array.["length"] and is it
IE/Firefox compatible??

array["length"] is equivalent to array.length

In javascript, an object is the same as an associative array, which
makes the formal difference between arrays and objects blurry.

This is defined by the ECMA-262 standard, and is thus compatible with
all browsers and all javascript engines.

array.["length"] (mind the dot) is a syntax error. Some javascript
parsers *may* tolerate it but you *shouldn''t* count on it.
--
Martijn Saly


josh said:

>
Hi all,
what does it meaning that strange sintax (look at the object :) ?

You seem to mean "look at the subject", and that''s a nuisance with
some newsreaders. Don''t ask people to read the subject while
they''re reading the message.

>if I have i.e. array.length I can use array.["length"] and is it
IE/Firefox compatible??

No, you can''t use that syntax in any browser, but you should be
able to use: array["length"] in any. There''s no "dot".

You can use this notation to access attributes of any Object.
--


这篇关于阵列[&QUOT;属性&QUOT]。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆