久久福利_99r_国产日韩在线视频_直接看av的网站_中文欧美日韩_久久一

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

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

瀏覽:46日期: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

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

附上相關規(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:

其實就是個 Object toString 的問題。

標簽: JavaScript
相關文章:
主站蜘蛛池模板: 男女啪网站 | 99视频免费看 | 精品二区 | 日本在线观看 | 久久网一区二区三区 | 免费看的毛片 | 国产成人av在线 | 欧美在线综合视频 | 婷婷亚洲五月 | 91九色porny首页最多播放 | 久久三区 | 精品伊人| 激情毛片 | 影音先锋中文字幕在线 | 久草毛片| 亚洲国产福利一区 | 国产999精品久久久久久 | 亚洲国产精品福利 | 人人插人人 | 中文字字幕一区二区三区四区五区 | 亚洲精品一 | 中字一区 | 男女免费视频 | 精品国产黄a∨片高清在线 激情网站免费 | 国产精品成人一区二区 | 在线观看国产 | 久久se精品一区精品二区 | 亚洲国产精品99久久久久久久久 | 夜夜艹 | 欧美一级毛片免费看 | 欧美成人免费一级人片100 | 日韩电影在线一区 | 日韩综合在线 | 日韩综合网| 天天操天天干天天 | 精品日韩中文字幕 | 国产日韩精品视频 | 国产午夜一区二区三区 | 极品毛片 | 91porn在线| 毛片免费在线观看 |