- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Node.js – util.types.isUint8ClampedArray() Method
The util.types.isUint8ClampedArray() method checks whether the passed value is a built-in Uint8ClampedArray instance or not. If the above condition is satisfied, it returns True, else False.
Syntax
util.types.isUint8ClampedArray(value)
Parameters
- value − This input value takes input for the required parameter and checks if it's a Uint8ClampedArray instance or not.
It returns True or False based upon the input value passed.
Example 1
Create a file with the name "isUint8ClampedArray.js" and copy the following code snippet. After creating the file, use the command "node isUint8ClampedArray.js" to run this code.
// util.types.isUint8ClampedArray() Demo Example // Importing the util module const util = require('util'); // Passing normal Int8-Array as input value console.log("1." + util.types.isUint8ClampedArray(new Int8Array())); // Passing a Uint8ClampedArray array instance as input console.log("2." + util.types.isUint8ClampedArray(new Uint8ClampedArray())); // Passing a Int16 array as input console.log("3." + util.types.isUint8ClampedArray(new Int16Array()));
Output
C:\home
ode>> node isUint8ClampedArray.js 1.false 2.true 3.false
Example 2
// util.types.isUint8ClampedArray() Demo Example // Importing the util module const util = require('util'); var uintc8 = new Uint8ClampedArray(2); uintc8[0] = 21; // From an array var arr = new Uint8ClampedArray([21,31]); console.log(arr[1]); // From an ArrayBuffer var buffer = new ArrayBuffer(8); var z = new Uint8ClampedArray(buffer, 1, 4); // From an iterable var iterable = function*(){ yield* [1,2,3]; }(); var arr1 = new Uint8ClampedArray(iterable); // Passing float32 Array with values as input console.log("1." + util.types.isUint8ClampedArray(uintc8)); // Passing a float32 array 0th value as input console.log("2." + util.types.isUint8ClampedArray(arr)); // Passing a float32 array defined by array buffer console.log("3." + util.types.isUint8ClampedArray(z)); // Passing a float32 array defined by iterable console.log("4." + util.types.isUint8ClampedArray(arr1));
Output
C:\home
ode>> node isUint8ClampedArray.js 31 1.true 2.true 3.true 4.true
Advertisements
To Continue Learning Please Login
Login with Google