How to convert a normal record, the statement:
?Code:zmienna=x^50?zmienna:nowa_wartosc;
And what is this character: "^"?
I tried:
But it probably is wrong.Code:if(x^50) { zmienna=zmienna; // I know...meaningless? } else { zmienna=nowa_wartosc; }
| SitePoint Sponsor |
How to convert a normal record, the statement:
?Code:zmienna=x^50?zmienna:nowa_wartosc;
And what is this character: "^"?
I tried:
But it probably is wrong.Code:if(x^50) { zmienna=zmienna; // I know...meaningless? } else { zmienna=nowa_wartosc; }

What is the context of your question?
From whence does this data come? If it was a form (input from the user) there is no way to be sure of the significance of that expression.
More importantly, don't forget that "^" (commonly called the Caret) is simply another ASCII character. Again, the meaning of it is purely subjective. We tend to assume it represents an exponential operator. But that may not be true.
The code you present is a ternary operator which you correctly changed to a if/else
this partCode:zmienna=x^50?zmienna:nowa_wartosc;
JavaScript needs to evaluate that to a true or false for it to work.Code:x^50
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..
try 3^3 as wellCode:var bw; bw = ''; bw = 3^4?'yes':'no'; alert(bw);
Bookmarks