Announcement

Collapse
No announcement yet.

checking if a number is even/odd?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • checking if a number is even/odd?

    is there an efs function to determine if a number is even or odd? i've checked all the utility functions and the math object already, i cant seem to find one...?

  • #2
    Re: checking if a number is even/odd?

    function isEven(x)
    {
    return ( ( x % 2 ) == 0 );

    }


    Originally posted by Axiom
    is there an efs function to determine if a number is even or odd? i've checked all the utility functions and the math object already, i cant seem to find one...?

    Comment


    • #3
      well that works, thanks... and just what exactly is the "%" in the context of that function, ive never seen that before?

      Comment


      • #4
        Axiom
        That is the Javascript modulus operator which returns the integer remainder of the division of the first operand by the second (eg 7 % 5 returns 2)
        Alex


        Originally posted by Axiom
        well that works, thanks... and just what exactly is the "%" in the context of that function, ive never seen that before?

        Comment

        Working...
        X