Underscore.js是一個JavaScript庫,它提供了許多有用的函數,即使不使用任何內置對象,它們也可以以很大的方式幫助編程,例如映射,過濾器,調用等。
_.isDataView()函數是JavaScript的Underscore.js庫中的內置函數,用於檢查指定對象是否為DataView。
用法:
_.isDataView(object)
參數:它接受以下指定的單個參數:
- object:這是陳述的對象。
返回值:如果聲明的對象是DataView,則此方法返回true,否則返回false。
範例1:
<!DOCTYPE html>
<html>
<head>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.11.0/underscore-min.js">
</script>
</head>
<body>
<script>
var buff = new ArrayBuffer(11);
console.log(_.isDataView(
new DataView(buff, 3, 5)));
</script>
</body>
</html>
輸出:
true
範例2:
<!DOCTYPE html>
<html>
<head>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.11.0/underscore-min.js">
</script>
</head>
<body>
<script>
console.log(_.isDataView("Geeks!"));
</script>
</body>
</html>
輸出:
false
參考:https://underscorejs.org/#isDataView
相關用法
- Node.js util.types.isDataView()用法及代碼示例
- PHP imagecreatetruecolor()用法及代碼示例
- p5.js year()用法及代碼示例
- d3.js d3.utcTuesdays()用法及代碼示例
- PHP ImagickDraw getTextAlignment()用法及代碼示例
- PHP Ds\Sequence last()用法及代碼示例
- PHP array_udiff_uassoc()用法及代碼示例
- PHP geoip_continent_code_by_name()用法及代碼示例
- d3.js d3.map.set()用法及代碼示例
- PHP GmagickPixel setcolor()用法及代碼示例
- PHP opendir()用法及代碼示例
- PHP cal_to_jd()用法及代碼示例
- d3.js d3.bisectLeft()用法及代碼示例
- PHP stream_get_transports()用法及代碼示例
注:本文由純淨天空篩選整理自nidhi1352singh大神的英文原創作品 Underscore.js _.isDataView() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。