午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

您的位置:首頁技術(shù)文章
文章詳情頁

javascript - js對象 屬性的訪問和創(chuàng)建

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

問題描述

一個(gè)有意思的問題:

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

這里其實(shí)涉及到的就是[]運(yùn)算符 和.運(yùn)算符 相關(guān)知識(shí)。

附上相關(guān)規(guī)則和網(wǎng)址,你們自己研究吧:

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:

其實(shí)就是個(gè) Object toString 的問題。

標(biāo)簽: JavaScript
相關(guān)文章:
主站蜘蛛池模板: 欧美成人精品激情在线观看 | 97在线公开视频 | 国产污视频 | 久久精品视频观看 | 日韩在线观看视频网站 | 中文字幕在线播出 | 超碰在线98 | 日韩一区二区三区在线 | 男人天堂网在线观看 | 久久视频免费看 | 久久久视频在线 | av天天在线 | 中国黄色一级视频 | 超碰在线视屏 | 中文字幕一区二区不卡 | 欧日韩在线视频 | 欧美一级全黄 | 日本aⅴ视频 | 日韩av不卡在线播放 | 国产乱淫av一区二区三区 | 五月天毛片 | 欧美xxxxxx片免费播放软件 | 国产一区二区视频在线播放 | 国产91精品一区二区绿帽 | 亚洲欧美日韩国产 | 特级毛片在线播放 | 欧美在线观看一区二区 | 日日夜夜天天综合 | 国产成人精品久久二区二区91 | a级一a一级在线观看 | 亚洲精品一区二 | 婷婷九九 | 成人久久精品 | 亚洲欧美日韩动漫 | 中文字幕第一页在线播放 | 中文字幕第4页 | 精品一区二区在线播放 | 欧美日韩一区二区三区四区 | 生活一级片 | 性欧美video另类hd尤物 | 3d动漫精品啪啪一区二区免费 |