I know that you can do the following in javascript to switch the boolean value in one liner.
var toggle = false;
if(true) toggle != toggle;
but is it also possible with a string? I know that this can be done with some if statements. But is it possible to do this oneliner? something like that:
var string_toggle = "CAT";
if(true) "CAT" = "ESP" || "ESP" = "CAT";
If it is not clear what I ask, let me know so that I can improve the question.
source
share