Open In App

Lodash _.isArrayBuffer() Method

Last Updated : 03 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

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

Syntax:

_.isArrayBuffer( value );

Parameters:

  • value: This parameter holds the value that needs to be Checked for an ArrayBuffer Value.

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.

JavaScript
// 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.

JavaScript
// 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.

JavaScript
// 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.


Similar Reads