ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

IsOdd

Returns true if the number is an odd number

Source

Number.prototype.IsOdd = function () {
    return this % 2 == 1;
}

Example

if (self.row.IsOdd()) {
    xoffset += 75;
}

Author: Loek van den Ouweland

Submitted on: 16 apr. 2013

Language: JavaScript

Type: Number

Views: 5170