How to use the lt function from lodash

Find comprehensive JavaScript lodash.lt code examples handpicked from public code repositorys.

lodash.lt is a function in the Lodash library that compares two values and returns true if the first value is less than the second value.

241
242
243
244
245
246
247
248
249
250
module.exports.kv                  = _.kv;
module.exports.last                = _.last;
module.exports.lastIndexOf         = _.lastIndexOf;
module.exports.lowerCase           = _.lowerCase;
module.exports.lowerFirst          = _.lowerFirst;
module.exports.lt                  = _.lt;
module.exports.ltContrib           = _.ltContrib;
module.exports.lte                 = _.lte;
module.exports.lteContrib          = _.lteContrib;
module.exports.map                 = _.map;
fork icon19
star icon122
watch icon0

+ 92 other calls in file

500
501
502
503
504
505
506
507
508
509
510
511
512
console.log(isWeakMap); // => true


const isWeakSet = _.isWeakSet(new WeakSet);
console.log(isWeakSet); // => true


const lt = _.lt(1, 3);
console.log(lt); // => true


const lte = _.lte(1, 1);
console.log(lte); // => true
fork icon0
star icon4
watch icon0

+ 15 other calls in file

How does lodash.lt work?

lodash.lt is a function in the lodash library that checks if the first argument is less than the second argument using a strict comparison. If the first argument is less than the second argument, it returns true, otherwise, it returns false.

Ai Example

1
2
3
4
5
6
const _ = require("lodash");

console.log(_.lt(1, 2)); // Output: true
console.log(_.lt(2, 1)); // Output: false
console.log(_.lt(2, 2)); // Output: false
console.log(_.lt("a", "b")); // Output: true

In this example, we first import lodash. Then we use _.lt to compare two values and check if the first value is less than the second value. The function returns true if the first value is less than the second value, and false otherwise. In the first two examples, we compare numbers, in the third example, we compare two equal numbers, and in the last example, we compare two strings.

Other functions in lodash

Sorted by popularity

function icon

lodash.get is the most popular function in lodash (7670 examples)