Node.js – util.types.isBigInt64Array() 方法


util.types.isBigInt64Array() 方法檢查傳遞的值是否為 BigInt64Array 例項。如果滿足上述條件,它返回 True,否則返回 False。

語法

util.types.isBigInt64Array(value)

引數

  • value − 此輸入值獲取所需引數的輸入,並檢查它是否為 BigInt64 陣列例項。

它根據傳遞的輸入值返回 True 或 False。

示例 1

建立一個名為 “isBigInt64Array.js” 的檔案,並複製以下程式碼片段。建立檔案後,使用命令 “node isBigInt64Array.js” 執行此程式碼。

// util.types.isBigInt64Array() Demo Example

// Importing the util module
const util = require('util');

// Functions to be passed as parameter
// of utiltypes.isBigInt64Array() method
var arr = new BigInt64Array();

// Passing BigInt64 Array as input value
console.log(util.types.isBigInt64Array(arr));

輸出

C:\home
ode>> node isBigInt64Array.js true

示例 2

// util.types.isBigInt64Array() Demo Example

// Importing the util module
const util = require('util');

// Functions to be passed as parameter
// of utiltypes.isBigInt64Array() method
var arr = new BigInt64Array();

// Passing BigInt64 Array as input value
console.log("1." + util.types.isBigInt64Array(arr));

// Passing BigInt64 Array prototype
console.log("2." + util.types.isBigInt64Array(BigInt64Array.prototype));

// Defining a typedArray
const typedArray = new Int8Array(8);
// Passing Typed array to check
console.log("3." + util.types.isBigInt64Array(typedArray));

輸出

C:\home
ode>> node isBigInt64Array.js 1. true 2. false 3. false

更新於: 2021-8-17

62 檢視

開啟您的 職業 生涯

透過完成課程獲得認證

入門
廣告
© . All rights reserved.