javascriptbooleanflipshorthand

Shorthand for flipping a boolean variable


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

foobarthings[foothing][barthing] = !foobarthings[foothing][barthing];

without writing foobarthings[foothing][barthing] twice.


Solution

  • There is no shorter way than what you currently have.