I am trying to understand unary operators in javascript, and found this reference guide here http://wiki.answers.com/Q/What_are_unary_operators_in_javascript, I understand most of the examples but I am trying to work out how I would use this:
!a; // Logical opposite of a in an example.
For instance if I do this:
a = true;
!a;
document.writeln(a);
I thought this would be false, but it outputs true.
What is a good code example where I can use something along the lines of !a to see how it works?
You aren’t assigning
!ato any variable.ais still true.What you want to do is this,