Shorthand for flipping a boolean variable

前端 未结 5 1365
礼貌的吻别
礼貌的吻别 2021-02-01 03:13

How can I flip the value of a boolean variable in javascript, without having to include the variable name twice? So

foobarthings[foothing][barthing] = !foobarthi         


        
5条回答
  •  -上瘾入骨i
    2021-02-01 04:03

    You can have just foo and !foo in the place where you execute it or check the condition.

提交回复
热议问题