fz21z
January 14, 2013, 12:02pm
1
How to convert a normal record, the statement:
zmienna=x^50?zmienna:nowa_wartosc;
?
And what is this character: “^”?
I tried:
if(x^50)
{
zmienna=zmienna; // I know...meaningless?
}
else
{
zmienna=nowa_wartosc;
}
But it probably is wrong.
ParkinT
January 14, 2013, 12:28pm
2
The code you present is a ternary operator which you correctly changed to a if/else
zmienna=x^50?zmienna:nowa_wartosc;
this part
x^50
JavaScript needs to evaluate that to a true or false for it to work.
the “^” in this case is a “bitwise XOR” (A bit of home work for you).
So depending on what the “X” value is in relation to “50” the result will a true of false
drop this into a web page and play…
var bw;
bw = '';
bw = 3^4?'yes':'no';
alert(bw);
try 3^3 as well