Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Character entites as logical and comparison operators?
Old 02-01-2008, 04:41 AM Character entites as logical and comparison operators?
Skilled Talker

Posts: 52
Name: Bruce
Trades: 0
Which should I use in my javascript code for comparisons and when testing for more than one condition?
Code:
">" or ">"?  "&&" or "&"? etc.
I thought I read somewhere that it's best to use the character entities, but maybe I was mistaken and they are only to be used when you need those special characters in html to show up on the page as that symbol.

I've just realized that the character entities don't work in javascript (when used for the purpose mentioned above) in every circumstance, which brought me to ask this question.

Have I been doing something stupid? lol

Last edited by SillyWilly; 02-01-2008 at 04:45 AM..
SillyWilly is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-01-2008, 08:44 AM Re: Character entites as logical and comparison operators?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You use the operators NOT the entities.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 02-01-2008, 12:09 PM Re: Character entites as logical and comparison operators?
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,935
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
http://www.pageresource.com/jscript/jifelse.htm

Like Hirst said, you use the operators, not the entities.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 02-02-2008, 12:24 AM Re: Character entites as logical and comparison operators?
Skilled Talker

Posts: 52
Name: Bruce
Trades: 0
Thanks.

Yeah I knew all about the operators and how to use them. The link you gave me was actually the place I learned it. It's a great site. The guy teaches it well and he's pretty funny too.

I just thought I read somewhere that using the entities was better, but after I recovered from my concussion and could think better I was thinking that I must have been mistaken, especially after they didn't work in one case.
SillyWilly is offline
Reply With Quote
View Public Profile
 
Old 02-02-2008, 12:50 AM Re: Character entites as logical and comparison operators?
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,935
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Using the entities is better iff (that's if and only if, for the uninitiated) you're trying to show your code to someone else and it's not a VB-type setup whereby HTML codes such as <> are automatically converted for you (e.g. on a WordPress blog).

Then you'd have to do something like &lt; to show less than and &gt; to show greater than.

Honest mistake though. 'Sall good.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Reply     « Reply to Character entites as logical and comparison operators?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15311 seconds with 12 queries