Hi there, quick question. I am reading a book about javascript and the author doesn't seem to like quotes ("") at all, but he loves angled brackets (<<>>). what really strikes me is that it looks like he uses them instead of quotes. FOr example I would say: alert("Hello WOrld!"); and he instead goes alert(<<Hello World!>>); .
It is the first time I see angled brackets used instead of quotes,I am a bit confused, so I looked at Crockford's conventions but actually he doesn't say anything about that.
What do you guys think? Is it ok to use <<>> and "" interchangeably?

Recommended Answers

All 6 Replies

Try it and find out. Report your findings.

Member Avatar

What book is this out of? You can not use angle brackets in place of quotes.

Try it:






Then switch the angle brackets to quotes, and see what happens. I have always used the single quotes for strings in JavaScript. I also always use double quotes for HTML. This way, when creating a string in JavaScript that has HTML, you do not need to escape the quotes.

Sounds like a typesetting error by the book's publishers.

Some natural languages (eg. Greek, Russian) use angled quotes but, as far as I know, no computer languages - certainly not js.


hi thanks all for that.
Perhaps it is a typesetting error as airshow said but it is recurrent...I tried as suggested to replace the quotes with angled brackets and the script doesn't work. I will ask directly to the author, I have no idea what's going on. The book by the way is called "javascript and ajax for dummies" by Andy Harris

They are probably equivalent to the « ( &#38;#171; ) and » ( &#38;#187; ) characters. If I correctly recall my high school Spanish classes from 30-odd years back, Spanish also uses them.

(Unexpectedly, DaniWeb or *something* processes the HTML character codes, so you get to see them. Also unexpectedly, they get translated to the real characters during a preview.)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.