471,351 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,351 software developers and data experts.

quotation mark or apostrophe

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

May 3 '06 #1
4 2039
Ca**********@gmx.de wrote:
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.
May 3 '06 #2
Ca**********@gmx.de said the following on 5/3/2006 5:47 AM:
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/
May 3 '06 #3
Ca**********@gmx.de writes:
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 - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
May 3 '06 #4
Thanx.

May 4 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Robert Garrett | last post: by
63 posts views Thread by Tristan Miller | last post: by
4 posts views Thread by Thomas Miskiewicz | last post: by
3 posts views Thread by James Foreman | last post: by
4 posts views Thread by | last post: by
9 posts views Thread by dajava | last post: by
31 posts views Thread by The Bicycling Guitarist | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.