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

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

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

瀏覽:50日期: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
相關文章:
主站蜘蛛池模板: 亚洲视频日韩视频 | 中文字幕国产亚洲 | 99国产在线| 欧美一级鲁丝片 | 亚洲一区二区免费看 | 免费一级毛片在线播放视频 | 一级成人a免费视频 | 欧美国产日本高清不卡 | 亚洲天堂网在线视频 | 日韩一区二区在线免费观看 | 欧美在线观看成人高清视频 | 国产91第一页 | 草草影院ccyycom | 午夜爽 | 天空在线观看免费完整 | 久久久久久免费视频 | 久久精品国产线看观看亚洲 | 成人男女啪啪免费观看网站 | 免费午夜不卡毛片 | 国产日韩精品视频 | 久久在线观看免费视频 | 久久www免费人成看国产片 | 久久精品一区二区免费看 | 国产女王丨vk | 男人女人做性全程视视频 | 成人毛片高清视频观看 | 99精品视频在线观看免费播放 | 久久免费视频在线观看30 | 国产成人在线播放 | 国产亚洲自在精品久久 | 国产视频三区 | 精品欧美小视频在线观看 | 看一级毛片一区二区三区免费 | 琪琪午夜伦埋大全影院 | 亚洲视频区 | 欧美一区二区三区不卡片 | 亚洲第一视频在线观看 | 香蕉超级碰碰碰97视频在线观看 | a级男女性高爱潮高清试 | 91亚洲精品 | 国产视频精品久久 |