A
In my current example, I have an array and want to disable the elements in the array - but only if they have a property type that equals either 'radio' or 'checkbox'. Looping through the array, this works:
#1
Code:
var t = this.inputs[i].type || null; 
if(t==='checkbox' || t==='radio') { this.inputs[i].disabled=true; }
But it annoys me in this sort of cases that I have to type the variable's name twice. I tried this instead which didn't work:
#2
Code:
t==='checkbox' || 'radio'
And this which worked in Firefox and Chrome, but not in IE8:
#3
Code:
t==='checkbox' | 'radio'
Surely, there must be an shorter way of doing it than #1 above?

===================================================================

B
While I'm at it, I also find the if-else shorthand great:
#4
Code:
(value) ? a=1 : a=2;
But it annoys me that it is not possible to do this as in a true shorthand for if without else:
#5
Code:
(value) ? a=1; 
// or at least:
(value) ? a=1 : ;
It works with a hack, e.g. like this:
#6
Code:
(value) ? a=1 : 0 ;
That's fine although it looks ugly in the code. Can anyone tell me, why this is not possible then:
#7
Code:
(value==='mystring') ? a=1 : 0 ;