There are some exceptions. You cannot do this with:
breakcontinue- Any block, such as
if , for , while , do or try
eg. What else, it can ruin your order of operations:
x < 3 ? l = true : r = true;
But this is not a reason not to do it, because it is ugly. Which one is clearer is:
if(i > 5) { alert('One'); } else { alert('Two'); }
or
i > 5 ? alert('One') : alert('Two');
? This is not entirely true, is it? And preserving the characters is never a reason for anything, in fact; otherwise there would be no comments or spaces. A good minifier like the Google Closure Compiler will automatically convert them for you whenever possible, and there are many other places to save. In the end, this is what you find most convenient and readable.
In addition, if you need break , continue , etc., then it will be rather inconsistent and unattractive code.
source share