国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

javascript - js對象 屬性的訪問和創建

瀏覽:76日期:2023-02-28 14:42:50

問題描述

一個有意思的問題:

var a = new Object(); var b = new Object(); var c = new Object(); c[a] = a; c[b] = b; console.log(c[a] === a); //輸出什么? ---> falseconsole.log(c[b] === b); //輸出什么? ---> true

var a = new Object(); var b = new Object(); var c = new Object(); c.a=a; c.b=b; console.log(c.a === a); //輸出什么? ---> trueconsole.log(c.b === b); //輸出什么? ---> true

這里其實涉及到的就是[]運算符 和.運算符 相關知識。

附上相關規則和網址,你們自己研究吧:

MemberExpression : MemberExpression [ Expression ]

Let baseReference be the result of evaluating MemberExpression.

Let baseValue be GetValue(baseReference).

ReturnIfAbrupt(baseValue).

Let propertyNameReference be the result of evaluating Expression.

Let propertyNameValue be GetValue(propertyNameReference).

ReturnIfAbrupt(propertyNameValue).

Let bv be RequireObjectCoercible(baseValue).

ReturnIfAbrupt(bv).

Let propertyKey be ToPropertyKey(propertyNameValue).

ReturnIfAbrupt(propertyKey).

If the code matched by the syntactic production that is being evaluated is strict mode code, let strict be true, else let strict be false.

Return a value of type Reference whose base value is bv and whose referenced name is propertyKey, and whose strict reference flag is strict.

MemberExpression : MemberExpression . IdentifierName

Let baseReference be the result of evaluating MemberExpression.

Let baseValue be GetValue(baseReference).

ReturnIfAbrupt(baseValue).

Let bv be RequireObjectCoercible(baseValue).

ReturnIfAbrupt(bv).

Let propertyNameString be StringValue of IdentifierName

If the code matched by the syntactic production that is being evaluated is strict mode code, let strict be true, else let strict be false.

Return a value of type Reference whose base value is bv and whose referenced name is propertyNameString, and whose strict reference flag is strict.

CallExpression : CallExpression [ Expression ]

Is evaluated in exactly the same manner as MemberExpression : MemberExpression [ Expression ] except that the contained CallExpression is evaluated in step 1.

CallExpression : CallExpression . IdentifierName

Is evaluated in exactly the same manner as MemberExpression : MemberExpression . IdentifierName except that the contained CallExpression is evaluated in step 1.

ECMAScript 2015 #sec-property-accessors

問題解答

回答1:

其實就是個 Object toString 的問題。

標簽: JavaScript
相關文章:
主站蜘蛛池模板: 国产视频高清在线观看 | 午夜在线社区视频 | 日本成人在线免费观看 | 亚洲国产欧美日韩精品一区二区三区 | 久久国内精品自在自线400部o | 香港一级特黄高清免费 | 欧美va免费大片 | 国产一区二区三区久久 | 99精品视频在线观看免费播放 | 性欧美f| 欧美99| 播放一级毛片 | 国产精品亚洲天堂 | 亚洲国产日韩欧美在线 | 欧美午夜视频在线 | 5x性区m免费毛片视频看看 | 精品一区二区三区五区六区 | 成人影院久久久久久影院 | 亚洲一级视频在线观看 | 99香蕉网| 欧美成人免费一区在线播放 | 人成免费a级毛片 | 在线观看亚洲天堂 | av国产精品 | 亚洲精品成人 | h网站国产 | 热re91久久精品国产91热 | 波多野结衣中文在线播放 | 日本美女作爱 | 久久精品久久精品久久精品 | 久久不卡日韩美女 | 真实偷清晰对白在线视频 | 成人精品网 | 草草在线影院 | 成人 在线欧美亚洲 | 日本免费一区二区三区a区 日本免费一区二区三区看片 | 久久精品在现线观看免费15 | 亚洲视频免费 | 成年人免费视频网站 | 手机在线看片国产日韩生活片 | 国产免费一区二区三区在线 |