Open In App

Lodash _.isOdd() Method

The Lodash_.isOdd() method checks whether the given value is an odd number or not .

Syntax:



_.isOdd( value )

Parameters: This method accepts a single parameter as mentioned above and described below:

Return Value: This method returns a Boolean value.



Example 1: 




// Defining Lodash variable 
const _ = require('lodash'); 
      
// Checking for an Odd 
console.log("The Value is odd number : " + _.isOdd(3);

Output :

The Value is odd number :  true

Example 2:




// Defining Lodash variable 
const _ = require('lodash'); 
      
// Checking for an Odd 
console.log("The Value is odd number : " + _.isOdd(2);

 Output :

The Value is odd number :  false

Example 3:




// Defining Lodash variable 
const _ = require('lodash'); 
      
// Checking for an Odd 
console.log("The Value is odd number : " + _.isOdd({});

Output :

The Value is odd number :  false

Article Tags :