|
||
---|---|---|
.. | ||
docs | ||
lib | ||
package.json | ||
README.md |
isOdd
Test if a value is an odd number.
Usage
var isOdd = require( '@stdlib/assert/is-odd' );
isOdd( value )
Tests if a value
is an odd number
.
var Number = require( '@stdlib/number/ctor' );
var bool = isOdd( 5.0 );
// returns true
bool = isOdd( new Number( 5.0 ) );
// returns true
bool = isOdd( 6.0 );
// returns false
bool = isOdd( -3.14 );
// returns false
bool = isOdd( null );
// returns false
bool = isOdd( NaN );
// returns false
isOdd.isPrimitive( value )
Tests if a value
is an odd primitive number.
var Number = require( '@stdlib/number/ctor' );
var bool = isOdd.isPrimitive( -5.0 );
// returns true
bool = isOdd.isPrimitive( new Number( -5.0 ) );
// returns false
isOdd.isObject( value )
Tests if a value
is a Number
object having an odd number value.
var Number = require( '@stdlib/number/ctor' );
var bool = isOdd.isObject( 5.0 );
// returns false
bool = isOdd.isObject( new Number( 5.0 ) );
// returns true
Examples
var Number = require( '@stdlib/number/ctor' );
var isOdd = require( '@stdlib/assert/is-odd' );
var bool = isOdd( 5.0 );
// returns true
bool = isOdd( new Number( 5 ) );
// returns true
bool = isOdd( 0.0 );
// returns false
bool = isOdd( 4.0 );
// returns false
bool = isOdd( NaN );
// returns false
bool = isOdd( '5' );
// returns false
bool = isOdd( null );
// returns false