Open In App

Lodash _.isArrayBuffer() Method

Lodash _.isArrayBuffer() method Checks if the given object or value can be classified as an ArrayBuffer Value or not. 

Syntax:

_.isArrayBuffer( value );

Parameters:

Return Value:

This method returns a Boolean value.



Example 1: In this example, this method returns true as the given value is an array buffer object.




// Defining Lodash variable
const _ = require('lodash');
 
let val = new ArrayBuffer(3)
// Checking for an ArrayBuffer
console.log("The Value is ArrayBuffer : "
    + _.isArrayBuffer(val));

Output:



The Value is ArrayBuffer : true

Example 2: In this example, this method returns false as the given value is not an array buffer object it is a string.




// Defining Lodash variable
const _ = require('lodash');
 
let val = "GeeksforGeeks"
 
// Checking for an ArrayBuffer
console.log("The Value is Array : "
    + _.isArrayBuffer(val));

Output:

The Value is ArrayBuffer : false

Example 3: In this example, this method returns false as the given value is not an array buffer object.




// Defining Lodash variable
const _ = require('lodash');
 
let val = { 1: 1 }
 
// Checking for an ArrayBuffer
console.log("The Value is Array : "
    + _.isArrayBuffer(val));

Output:

The Value is ArrayBuffer : false

Note: This will not work in normal JavaScript because it requires the lodash library to be installed and can be installed using npm install lodash.


Article Tags :