Node.js – util.types.isFloat64Array() Method


The util.types.isFloat64Array() method checks whether the passed value is a builtin Float64Array instance or not. It returns True if the above condition holds, else False.

Syntax

util.types.isFloat64Array(value)

Parameters

It takes only one parameter −

  • value − This input value takes input for the required parameter and checks if it is a Float64Array instance or not.

It returns True or false based upon the input value passed.

Example 1

Create a file with the name "isFloat64Array.js" and copy the following code snippet. After creating the file, use the command "node isFloat64Array.js" to run this code.

// util.types.isFloat64Array() Demo Example

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

// Passing a normal array buffer as input
console.log("1. " + util.types.isFloat64Array(new ArrayBuffer()));

// Passing a Uint8Array array as input
console.log("2. " + util.types.isFloat64Array(new Uint8Array()));

// Passing a Float64Array as input
console.log("3. " + util.types.isFloat64Array(new Float64Array()));

Output

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

Example 2

// util.types.isFloat64Array() Demo Example

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

// Defining different types of array
var arr1 = new Float32Array();
var arr2 = new Float64Array();
var arr3 = new BigUint64Array();

// Passing the above array types as input
console.log("1. " + util.types.isFloat64Array(arr1));
console.log("2. " + util.types.isFloat64Array(arr2));
console.log("3. " + util.types.isFloat64Array(arr3));

Output

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

Updated on: 18-Aug-2021

39 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements