_.lte()方法檢查每個自變量是否小於或等於下一個自變量。
用法:
_.lte( val1, val2, ..., valn );
參數:此方法采用n個值對其進行運算。
返回值:此方法返回一個布爾值。
注意:由於它需要安裝underscore.js contrib庫,因此在正常的JavaScript中將無法使用。
可以使用npm install underscore-contrib -save安裝underscore.js contrib庫。
範例1:
// Defining underscore contrib variable
var _ = require('underscore-contrib');
var lesser = _.lte(1, 4, 4);
console.log("Each argument is lesser than or equal to its next argument:", lesser);
輸出:
Each argument is lesser than or equal to its next argument:true
範例2:
// Defining underscore contrib variable
var _ = require('underscore-contrib');
var lesser = _.lte(1, 4, 9, 4);
console.log("Each argument is lesser than or equal to its next argument:", lesser);
輸出:
Each argument is lesser than or equal to its next argument:true
範例3:
// Defining underscore contrib variable
var _ = require('underscore-contrib');
var lesser = _.lte(1, 4, 9, 4);
console.log("Each argument is lesser than or equal to its next argument:", lesser);
輸出:
Each argument is lesser than or equal to its next argument:false
相關用法
- ASP End用法及代碼示例
- ASP Flush用法及代碼示例
- ASP BinaryRead用法及代碼示例
- underscore.js _.keep()用法及代碼示例
- underscore.js _.second()用法及代碼示例
- underscore.js _.third()用法及代碼示例
- underscore.js _.nth()用法及代碼示例
- Collect.js contains()用法及代碼示例
- Collect.js dd()用法及代碼示例
- p5.js Camera pan()用法及代碼示例
- underscore.js _.mod()用法及代碼示例
- underscore.js _.neg()用法及代碼示例
- underscore.js _.lt()用法及代碼示例
- underscore.js _.neq()用法及代碼示例
- underscore.js _.seq()用法及代碼示例
- underscore.js _.sub()用法及代碼示例
- d3.js scaleLinear()用法及代碼示例
注:本文由純淨天空篩選整理自taran910大神的英文原創作品 Underscore.js _.lte() Method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。