Hidden simplicity
if (flag) {
flag = false;
trigger(false);
} else {
flag = true;
trigger(true);
}
// turns to
if (flag) {
flag = false;
trigger(flag);
} else {
flag = true;
trigger(flag);
}
// turns to
if (flag) {
flag = false;
} else {
flag = true;
}
trigger(flag);
// turns to
flag = !flag;
trigger(flag);
Written by Dawid Szlachta
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Related Tags
#javascript
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#