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
Javascript Articles
Page 91 of 534
ArrayBuffer.byteLength Property in JavaScript
ArrayBuffer object in JavaScript represents a fixed-length binary data buffer.The byteLength property of the ArrayBuffer returns an unsigned, 32-bit integer that specifies the size/length of the ArrayBuffer.SyntaxIts syntax is as followsarray.byteLengthExampleTry the following example. JavaScript Example var arrayBuffer = new ArrayBuffer(8); var result = arrayBuffer.byteLength; document.write("length of the array buffer is: " + result); Outputlength of the array buffer is: 8ExampleYou can also create an array buffer object by passing a string value and get its length as in the following example. Since ...
Read MoreArrayBuffer.slice() function in JavaScript
ArrayBuffer object in JavaScript represents a fixed-length binary data buffer.The slice() method of the this object returns a portion or, chunk from the array buffer (as a separate object). It accepts two integer arguments representing the start (inclusive) and end (exclusive) of the portion of the array to be returned.SyntaxIts syntax is as followsarrayBuffer.slice(start, end);ExampleTry the following example. JavaScript Example var arrayBuffer = new ArrayBuffer(16); var int32View = new Int32Array(arrayBuffer); int32View[1] = 102; var sliced = new Int32Array(arrayBuffer.slice(4,12)); document.write(" "+sliced); Output102,0
Read MoreAtomics.isLockFree() function in JavaScript
The Atomic object of JavaScript is an object and which provides atomic operations such as add, sub, and, or, xor, load, store etc. as static methods, these methods are used with SharedArrayBuffer objects.This method is used to determine whether to use locks or atomic operations.SyntaxIts syntax is as followsAtomics.isLockFree(size)Example JavaScript Example document.write(Atomics.isLockFree(7)); document.write(""); document.write(" "+Atomics.isLockFree(8)); Outputfalse false
Read MoreAtomics.xor() function in JavaScript
The Atomic object of JavaScript is an object and which provides atomic operations such as add, sub, and, or, xor, load, store etc. as static methods, these methods are used with SharedArrayBuffer objects.The xor() function of the atomic object accepts a number and the position and, performs an xor operation on the given value at the given position.SyntaxIts syntax is as followsAtomics.xor()Example JavaScript Example var arrayBuffer = new SharedArrayBuffer(16); var data = new Uint8Array(arrayBuffer); data[0] = 30; document.write(Atomics.xor(data, 0, 3)); document.write(", "+Atomics.load(data, 0)); Output30, 29
Read MoreDataView.byteLength property in JavaScript
The byteLength property of the DataView represents the length of the current Data View.SyntaxIts syntax is as followsdataView.byteLength();Example JavaScript Example var arrayBuffer = new ArrayBuffer(8); var dataView = new DataView(arrayBuffer); document.write(dataView.byteLength); Output8
Read MoreDataView.byteOffset property in JavaScript
The byteOffset property of the DataView represents the offset of the current DataView.SyntaxIts syntax is as followsdataView.byteOffset();ExampleTry the following example. JavaScript Example var arrayBuffer = new ArrayBuffer(114); var dataView = new DataView(arrayBuffer); document.write(dataView.buffer.byteLength); Output114
Read MoreDataView.buffer property in JavaScript
The buffer property of the DataView represents the ArrayBuffer of the current DataView.SyntaxIts syntax is as followsdataView.buffer;ExampleTry the following example. JavaScript Example var arrayBuffer = new ArrayBuffer(156); var dataView = new DataView(arrayBuffer); document.write(dataView.buffer.byteLength); Output156
Read MoreJSON. stringify( ) function in JavaScript
The stringify() function of a JSON object accepts a JSON string, and constructs an object based on the given text and, returns it.SyntaxIts Syntax is as followsJson.stringify();Example JavaScript Example var jsonSample = '{Tutorial: Java, Version:8}'; jsonObj = JSON.stringify(jsonSample); document.write(jsonObj); Output"{Tutorial: Java, Version:8}"
Read MoreSharedArrayBuffer.byteLength Property in JavaScript
The byteLength property of the SharedArrayBuffer returns an unsigned, 32-bit integer that specifies the size/length of a SharedArrayBuffer. Syntax Its Syntax is as follows sharedArrayBuffer.byteLength Example JavaScript Example var sharedArrayBuffer = new SharedArrayBuffer(8); var result = sharedArrayBuffer.byteLength; document.write("length of the shared array buffer is: " + result); Output length of the shared array buffer is: 8
Read MoreparseFloat() function in JavaScript
The parseFloat() function accepts two parameters one is a string representing a number and another is a number representing the radix and returns an integer of the given radix.SyntaxIts Syntax is as followsnum.parseFloat('4524', 8);Example JavaScript Example var result1 = parseFloat(Math.PI); document.write("Result: "+result1); document.write(''); var result2 = parseFloat("245.12@welcome"); document.write("Result: "+result2); document.write(''); var result3 = parseFloat("11111100.010"); document.write("Result: "+result3); OutputResult: 3.141592653589793 Result: 245.12 Result: 11111100.01
Read More