HighDots Forums  

quotation mark or apostrophe

Javascript JavaScript language (comp.lang.javascript)


Discuss quotation mark or apostrophe in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Capricorn.St@gmx.de
 
Posts: n/a

Default quotation mark or apostrophe - 05-03-2006 , 05:47 AM






Hi,
which of the following two codes is correct and where is the correct
notation standardized:

a) alert("Hello World");

b) alert('Hello World');

Thanx
Stefan


Reply With Quote
  #2  
Old   
Ian Collins
 
Posts: n/a

Default Re: quotation mark or apostrophe - 05-03-2006 , 05:51 AM






Capricorn.St (AT) gmx (DOT) de wrote:
Quote:
Hi,
which of the following two codes is correct and where is the correct
notation standardized:

a) alert("Hello World");

b) alert('Hello World');

Either.

--
Ian Collins.


Reply With Quote
  #3  
Old   
Randy Webb
 
Posts: n/a

Default Re: quotation mark or apostrophe - 05-03-2006 , 11:57 AM



Capricorn.St (AT) gmx (DOT) de said the following on 5/3/2006 5:47 AM:
Quote:
Hi,
which of the following two codes is correct and where is the correct
notation standardized:
Both are "correct" technically.

As for being standardized, it isn't. Typically though use ' in JS and
leave " for HTML. It makes escaping a lot simpler.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Reply With Quote
  #4  
Old   
Lasse Reichstein Nielsen
 
Posts: n/a

Default Re: quotation mark or apostrophe - 05-03-2006 , 12:16 PM



Capricorn.St (AT) gmx (DOT) de writes:

Quote:
which of the following two codes is correct and where is the correct
notation standardized:

a) alert("Hello World");

b) alert('Hello World');
Both are correct. String literals in ECMAScript/Javascript can be
surrounded by either single or double quotes, as long as they
match.

This is specified in the ECMAScript standard:
<URL:http://www.ecma-international.org/publications/standards/Ecma-262.htm>
and also in the specifications of the ECMAScript compliant languages
javascript: <URL:http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Literals#String_Literals >
and JScript: <URL:http://msdn.microsoft.com/library/en-us/script56/html/c7a6bd3a-4b1c-4dbe-8505-106dbf483b41.asp>

/L
--
Lasse Reichstein Nielsen - lrn (AT) hotpop (DOT) com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.