Try wrapping your parens around the operation
alert("test: "+ (1 == 2 ? 'hello' : 'world'));
demo: http://jsfiddle.net/hunter/K3PKx/
what this is doing:
alert("test: "+(1==2)?'hello':'world');
is evaluating "test: " + (1==2) as true which outputs 'hello'