屌你老母邊撚個發明type script

60 回覆
27 Like 16 Dislike
2020-05-19 20:13:37

2020-05-19 20:15:42
0 == [] 成立唔等於 []係false
你試下if([]){console.log("hi")}就知
唔好用comparision 去判斷TRUE FALSE
2020-05-19 20:18:35
呢個情況有啲特別,state係個number
number係immutable
2020-05-19 20:22:26
array 同 object做arithmetic 同 comparision果陣會做type conversion 轉番做primitive type 先
array會call .join("")
object 會call .toString()

1) 0 == []
0 == [].join("")
0 == "" , true

2) "0" == []
"0" == [].join("")
"0" == "", false
2020-05-19 20:45:17
2020-05-19 20:47:15
State係immutable
Local variables係mutable
2020-05-21 15:10:20
exaxtly

如果state係object就要至少shallow copy一次
吹水台自選台熱 門最 新手機台時事台政事台World體育台娛樂台動漫台Apps台遊戲台影視台講故台健康台感情台家庭台潮流台美容台上班台財經台房屋台飲食台旅遊台學術台校園台汽車台音樂台創意台硬件台電器台攝影台玩具台寵物台軟件台活動台電訊台直播台站務台黑 洞