[Javascript] Single vs. Double quotes in Javascript

BEKIM BACAJ trojani2000 at hotmail.com
Thu Nov 13 11:48:32 CST 2003


It is posible that single quotes have more priority than double qutoes while 
debuged, everything inside single quotes gets procesed earlier than defs 
inside double quotes. But I doubt you can notice speed diference if the same 
script does not use double qutese anywhere else. But if combined, single 
quted gat the precedence.
This is, however, only my best guess.

>From: "Peter-Paul Koch" <gassinaumasis at hotmail.com>
>Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
>To: javascript at LaTech.edu
>Subject: Re: [Javascript] Single vs. Double quotes in Javascript
>Date: Thu, 13 Nov 2003 16:00:14 +0000
>
>
>
>>I did not test this code to confirm or deny the 15% faster claim
>
>I did, and cannot confirm it. It seems that single quotes are *sometimes* 
>faster in Explorer Windows (roughly 1/3 of my tests did show a faster 
>response time), but if Mozilla shows a difference at all, it handles double 
>quotes slightly faster. I found no difference at all in Opera.
>
>I cannot say that these experiments confirm the 15% claim.
>
>>-------
>>var s='';
>>var iTime1 = new Date().valueOf();
>>for(var i=0;i<100000;i++){
>>	s+="a";
>>}
>>var iTime2 = new Date().valueOf();
>>alert('With double quote : ' + (iTime2 - iTime1));
>>
>>
>>s='';
>>iTime1 = new Date().valueOf();
>>for(var i=0;i<100000;i++){
>>	s+='a';
>>}
>>iTime2 = new Date().valueOf();
>>alert('With single quote : ' + (iTime2 - iTime1));
>>-------
>
>-------------------------------------------------------------------
>ppk, freelance web developer
>Interaction, copywriting, JavaScript, integration
>http://www.quirksmode.org/
>Column "Keep it Simple": http://www.digital-web.com/columns/keepitsimple/
>------------------------------------------------------------------
>
>_________________________________________________________________
>The new MSN 8: smart spam protection and 2 months FREE*  
>http://join.msn.com/?page=features/junkmail
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus




More information about the Javascript mailing list