Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
TypedArray.name property in JavaScript
The name property of TypedArray constructors returns a string representing the name of the typed array type. This property is available on all TypedArray constructors like Int8Array, Uint8Array, Float32Array, etc.
Syntax
TypedArrayConstructor.name
Where TypedArrayConstructor is one of: Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, or BigInt64Array, BigUint64Array.
Return Value
Returns a string containing the name of the TypedArray constructor.
Example
<html>
<head>
<title>TypedArray name Property</title>
</head>
<body>
<script type="text/javascript">
var nameOfarray1 = Float32Array.name;
document.write("name of array1: " + nameOfarray1);
document.write("<br>");
var nameOfarray2 = Int16Array.name;
document.write("name of array2: " + nameOfarray2);
document.write("<br>");
var nameOfarray3 = Uint8Array.name;
document.write("name of array3: " + nameOfarray3);
</script>
</body>
</html>
Output
name of array1: Float32Array name of array2: Int16Array name of array3: Uint8Array
All TypedArray Names
<html>
<head>
<title>All TypedArray Names</title>
</head>
<body>
<script type="text/javascript">
document.write("Int8Array.name: " + Int8Array.name + "<br>");
document.write("Uint8Array.name: " + Uint8Array.name + "<br>");
document.write("Uint8ClampedArray.name: " + Uint8ClampedArray.name + "<br>");
document.write("Int16Array.name: " + Int16Array.name + "<br>");
document.write("Uint16Array.name: " + Uint16Array.name + "<br>");
document.write("Int32Array.name: " + Int32Array.name + "<br>");
document.write("Uint32Array.name: " + Uint32Array.name + "<br>");
document.write("Float32Array.name: " + Float32Array.name + "<br>");
document.write("Float64Array.name: " + Float64Array.name);
</script>
</body>
</html>
Output
Int8Array.name: Int8Array Uint8Array.name: Uint8Array Uint8ClampedArray.name: Uint8ClampedArray Int16Array.name: Int16Array Uint16Array.name: Uint16Array Int32Array.name: Int32Array Uint32Array.name: Uint32Array Float32Array.name: Float32Array Float64Array.name: Float64Array
Key Points
- The
nameproperty is a static property of TypedArray constructors - It returns the exact constructor name as a string
- This property is read-only and cannot be modified
- Useful for identifying the type of TypedArray constructor
Conclusion
The name property provides a simple way to get the string representation of any TypedArray constructor. It's particularly useful for debugging and type identification in JavaScript applications.
Advertisements
