quotation mark or apostrophe

C

Capricorn.St

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
 
I

Ian Collins

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.
 
R

Randy Webb

(e-mail address removed) 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.
 
L

Lasse Reichstein Nielsen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top