Re: When does != == !=?

by "Cyanide _7" <leo7278(at)hotmail.com>

 Date:  Sun, 02 Jul 2000 03:33:29 CDT
 To:  jbbrett(at)zigzagnet.com
 Cc:  hwg-languages(at)hwg.org
  todo: View Thread, Original
if you are trying to determine which operator to use in a comparison, based 
off another comparison of their choice, and the values compared are numeric, 
then may i suggest using eval instead? granted im taking a shot in the dark 
as to what you are trying to accomplish, but does this look right?

function test(val1, val2, oper){
  return eval(val1 + oper + val2);
}

something like that maybe? - Cyanide_7


>
>When the user selects an operator from a select, he is selecting a string
>"==" and not a literal operator as ==, so comparison is very easy.
>
>if ("==" == "!="){
>// do something.......
>
>}
>
>If this was not what you were trying to achieve, please elucidate.
>
>-Srini
>
>----- Original Message -----
>From: Jason Brett <jbbrett(at)zigzagnet.com>
>To: Hwg-Languages@Hwg. Org <hwg-languages(at)hwg.org>
>Sent: Sunday, July 02, 2000 8:53 AM
>Subject: When does != == !=?
>
>
>| Hey folks,
>|
>| I'm trying to do a comparison between two operators in javascript. Is 
>that
>| possible?
>|
>| I have a dropdown list where the user selects an operator to use. Later I
>| need to compare the user's selection to determine my action.
>|
>| Is this possible? If not, what's a workaround?
>|
>| Example:
>|
>| User choices:
>| ==
>| !=
>| >
>| <
>| <=
>| >=
>|
>| My statement says (variables translated here) if ( == == == ) { ...
>| but that particular case returns false.
>|
>| What do I do?
>|
>| Thanks in advance!
>|
>| Jason Brett
>| ZigZag Internet Solutions
>| Powerful Solutions. Explosive Results.
>|
>|
>

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA