Re: JavaScript test for even or odd number

by Christopher Higgs <c.higgs(at)landfood.unimelb.edu.au>

 Date:  Mon, 13 Mar 2000 13:19:23 +1100
 To:  Colin Dunn <Colin.Dunn(at)las.ox.ac.uk>
 Cc:  hwg-techniques(at)hwg.org
 In-Reply-To:  ac
  todo: View Thread, Original
G'Day Colin,

At 21:46 12/03/00 +0000, you wrote:
>I'd be interested to hear from anyone who can offer alternative solutions.

How about:

function number_check(value) {
   if ((value/2)==(int(value/2)) {
      // even
   }else{
     // odd
   }
}


Chris Higgs <c.higgs(at)landfood.unimelb.edu.au>
Institute of Land and Food Resources
University of Melbourne http://www.landfood.unimelb.edu.au

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