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

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

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

瀏覽:44日期: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)文章:
主站蜘蛛池模板: 黄色a三级三级三级免费看 黄色a网 | 亚洲综合色自拍一区 | 亚洲天堂男人在线 | 欧美日韩 国产区 在线观看 | 久久99国产精品久久99无号码 | 久久亚洲国产午夜精品理论片 | 欧美性精品hd在线观看 | 国产精品久久一区二区三区 | 国产精品久久不卡日韩美女 | 一级毛片子 | 亚洲一区在线免费观看 | 亚洲一级片免费看 | 亚洲自偷自偷图片在线高清 | 中文三级视频 | 韩国美女激情视频一区二区 | 波多结衣一区二区三区 | 亚洲aⅴ在线| 免费a级毛片网站 | 男女朋友做爽爽爽免费视频网 | 久久成年片色大黄全免费网站 | 精品国产一区二区三区四区不 | 亚洲美女视频一区二区三区 | 国产精品无打码在线播放9久 | 香港一级纯黄大片 | 久久久久免费观看 | 久久99九九99九九精品 | 九九久久国产 | 欧美在线高清视频播放免费 | 中国女人真人一级毛片 | 日韩在线视频观看 | 91久久线看在观草草青青 | 99视频九九精品视频在线观看 | 中国一级淫片aaa毛片毛片 | 手机免费看毛片 | 亚洲一二区 | 欧美日韩亚洲视频 | 无限资源中文免费 | 亚洲第5页| 国产伦精品一区二区三区四区 | 国产深夜福利视频在线播放 | 久久影院在线观看 |