Open In App

Lodash _.sneq() Method

Last Updated : 13 Nov, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Lodash _.sneq() method checks whether each of the arguments is strictly not equal (===) to each other or not and returns the corresponding boolean value.

Syntax:

_.sneq( val1, val2, ..., valn );

Parameters:

This method takes n values to operate them _.sneq() method.

Return Value:

This method returns a Boolean value.

Note: This will not work in normal JavaScript because it requires the lodash.js contrib library to be installed. Lodash.js contrib library can be installed using npm install lodash-contrib.

Example 1: In this example, _.sneq function verifies that the provided arguments (1, 2, and 3) are not equal, returning true to signify their inequality.

Javascript




// Defining lodash contrib variable
let _ = require('lodash-contrib');
 
let eq  = _.sneq( 1, 2, 3 );
   
console.log("Each arguments are not "
    + "equal to each other :", eq);


Output:

Each arguments are not equal to each other : true

Example 2: In this example, we use the _.sneq function to confirm that the provided arguments (2, 2, and 2) are equal, resulting in false as the output.

Javascript




// Defining lodash contrib variable
let _ = require('lodash-contrib');
 
let eq  = _.sneq( 2, 2, 2 );
   
console.log("Each arguments are not "
    + "equal to each other :", eq);


Output:

Each arguments are not equal to each other : false

Example 3: In this example, the _.sneq function confirms the inequality of the provided arguments (“2”, 2, and 2), resulting in true.

Javascript




// Defining lodash contrib variable
let _ = require('lodash-contrib');
 
let eq  = _.sneq( "2", 2, 2 );
   
console.log("Each arguments are not "
    + "equal to each other :", eq);


Output:

Each arguments are not equal to each other : true

Example 4: In this example, _.sneq function checks that the provided arguments (“2”, “2”, and “2”) are not equal to each other, returning false to indicate their equality.

Javascript




// Defining lodash contrib variable
let _ = require('lodash-contrib');
 
let eq  = _.sneq( "2", "2", "2" );
   
console.log("Each arguments are not "
    + "equal to each other :", eq);


Output:

Each arguments are not equal to each other : false


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads