2
有人能告訴我爲什麼:爲什麼alert([「a」,「b」,「c」,「d」,「e」] [[1,2],3,4])在javascript中輸出e?
alert(["a","b","c","d","e"][[1,2],3,4])
在JavaScript而輸出E?
有人能告訴我爲什麼:爲什麼alert([「a」,「b」,「c」,「d」,「e」] [[1,2],3,4])在javascript中輸出e?
alert(["a","b","c","d","e"][[1,2],3,4])
在JavaScript而輸出E?
因爲逗號是執行所有分離指令的運算符(in fact:兩條指令,每條指令也可以使用逗號運算符)並返回最後一條指令的結果。 I.e .:
["a","b","c","d","e"][[1,2],3,4] => ["a","b","c","d","e"][4] === "e"
是的,關鍵點是'返回最後一個結果' –