[Javascript] RES: RES: RES: What operator is the circumflex accent(^) injavascript?

SosCpdGMail soscpd at gmail.com
Thu Aug 30 16:09:49 CDT 2007


Bitwise is very low level programming. Very very fast. For a slow machine,
in case of about 40, 50 different chars (keyboard keydown) to be recognized
(lots of ifs/case, as you can see), it is useful, but for the most cases,
no. Cell phones, PDA’s still use it, but PC’s are very powerful now.

 

Practical example

 

var a = 3;

var b = 12;

a ^= b; // a = a XOR b

b ^= a; // b = b XOR a

a ^= b; // a = a XOR b

 

Swapping the contents of two variables without using a temporary variable.

 

Useful? Truly no. Necessary? Yes, somehow.

 

Rafael

 

 

  _____  

De: javascript-bounces at lists.evolt.org
[mailto:javascript-bounces at lists.evolt.org] Em nome de Anthony Ettinger
Enviada em: quinta-feira, 30 de agosto de 2007 17:54
Para: JavaScript List
Assunto: Re: [Javascript] RES: RES: What operator is the circumflex
accent(^) injavascript?

 

 

On 8/30/07, SosCpdGMail <soscpd at gmail.com> wrote:

Alberto:

I will try to answer your questions(everybody questions) not with the
result, but with the knowledge. If you don't like, ignore. The "magic words"
can be found in the 2º link in the Google search for JavaScript operators 
(http://www.google.com.br/search?hl=pt-BR
<http://www.google.com.br/search?hl=pt-BR&q=Javascript+Operators&meta>
&q=Javascript+Operators&meta) (your
question is: "What operator is", and this mail list is about javascript). 

Sorry this sparkles, and you are always welcome. I will try to help any time
I have the answer (Or search for it, if is necessary).

Rafael


-----Mensagem original-----
De: javascript-bounces at lists.evolt.org
[mailto:javascript-bounces at lists.evolt.org] Em nome de Alberto Domingo
Enviada em: quinta-feira, 30 de agosto de 2007 16:29 
Para: JavaScript List
Assunto: Re: [Javascript] RES: What operator is the circumflex accent (^)
injavascript?


Hi Rafael,

I tryed Google. Now that I know it is a bitwise operator, I don´t have any 
problem finding the information. I never used (or encountered) bitwise
operators before. Google ignore ^ in the search string, and the word
circumflex retrieves a lot about charentities, but nothing about operators. 
The magic word is bitwise, but that was exacty the word I didn't know.
Thanks to David Dorward, Nick Fitzsimons, Flavio Gomes and Anthony Ettinger
for their answers.

Sorry Rafael, but your response was not very informative. You didn't 
mention the magic word bitwise. Thanks anyway for the good intention.

Alberto Domingo


At 05:25 30/08/2007, you wrote:
>See google, for Christ's sake. Google search for JavaScript Operators,
>what you already know (Guessed by the sentence "What OPERATOR is the
>circumflex accent (^) in JAVASCRIPT?").
>
>< <http://www.google.com.br/search?hl=pt-BR&q=Javascript+Operators&meta>
http://www.google.com.br/search?hl=pt-BR&q=Javascript+Operators&meta>http:
//www.google.com.br/search?hl=pt-BR&q=Javascript+Operators&meta=
>
>Sorry in advance (That may fix everything, right?) 
>
>Rafael
>
>
>----------
>De: javascript-bounces at lists.evolt.org
>[mailto: <mailto:javascript-bounces at lists.evolt.org>
javascript-bounces at lists.evolt.org] Em nome de Alberto Domingo
>Enviada em: quarta-feira, 29 de agosto de 2007 13:48
>Para: javascript at lists.evolt.org
>Assunto: [Javascript] What operator is the circumflex accent (^) 
injavascript?
>
>What operator is the circumflex accent (^) in javascript?
>
>Sorry if this is too simple, but I can´t find  any thing about this
operator.
>Surely it is trivial.
> 
>Thanks in advance.
>
>Alberto
>
>_______________________________________________
>Javascript mailing list
>Javascript at lists.evolt.org  <mailto:Javascript at lists.evolt.org> 
>http://lists.evolt.org/mailman/listinfo/javascript

_______________________________________________




I have been using JS, Perl, PHP for quite some time...I have yet to come
across a need for it, although I remember seeing it once or twice in other
peoples' code. 

I'm curious how you would use a bitwise OR in JS, and why?
 

 


Anthony Ettinger
Ph: 408-656-2473
var (bonita, farley) = new Dog;
farley.barks("very loud");
bonita.barks ("at strangers");

http://chovy.dyndns.org/resume.html
http://utuxia.com/consulting 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20070830/5450443b/attachment.htm>


More information about the Javascript mailing list