Found 10483 Articles for Web Development

DataView.getFloat32() function in JavaScript

Sharon Christine
Updated on 25-Jun-2020 10:17:22

138 Views

The getFloat32() function of the DataView gets and returns a signed 32-bit floating point number at the specified position.SyntaxIts syntax is as followsdataView.getFloat32();ExampleTry the following example. Live Demo    JavaScript Example           var arrayBuffer = new ArrayBuffer(8);       var dataView = new DataView(arrayBuffer);       dataView.setFloat32(1, Math.LOG2E);       document.write(dataView.getFloat32(1));     Output1.4426950216293335ExampleTo this function, in addition to floating point values you can also pass Math functions. Live Demo    JavaScript Example           var arrayBuffer = new ArrayBuffer(8);       var dataView ... Read More

DataView.buffer property in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 10:17:40

156 Views

The buffer property of the DataView represents the ArrayBuffer of the current DataView.SyntaxIts syntax is as followsdataView.buffer;ExampleTry the following example. Live Demo    JavaScript Example           var arrayBuffer = new ArrayBuffer(156);       var dataView = new DataView(arrayBuffer);       document.write(dataView.buffer.byteLength);     Output156

DataView.byteOffset property in JavaScript

Samual Sam
Updated on 25-Jun-2020 10:18:10

88 Views

The byteOffset property of the DataView represents the offset of the current DataView.SyntaxIts syntax is as followsdataView.byteOffset();ExampleTry the following example. Live Demo    JavaScript Example           var arrayBuffer = new ArrayBuffer(114);       var dataView = new DataView(arrayBuffer);       document.write(dataView.buffer.byteLength);     Output114

DataView.byteLength property in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 10:18:46

138 Views

The byteLength property of the DataView represents the length of the current Data View.SyntaxIts syntax is as followsdataView.byteLength();Example Live Demo    JavaScript Example           var arrayBuffer = new ArrayBuffer(8);       var dataView = new DataView(arrayBuffer);       document.write(dataView.byteLength);     Output8

Atomics.xor() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 10:19:19

160 Views

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 Live Demo    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

Atomics.sub() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 09:53:06

149 Views

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 sub() function of the atomic object accepts a number and the position, subtracts the given number from the number in the given position and it returns the value of the number in the old position.SyntaxIts syntax is as follows.Atomics.sub()Example Live Demo    JavaScript Example           var arrayBuffer = new SharedArrayBuffer(16);       var data = new Uint8Array(arrayBuffer);       ... Read More

Atomics.store() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 09:53:45

158 Views

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 store() function of the atomic object accepts a number(value) and a position in the array and, stores the given value in the specified position and returns the same.SyntaxIts syntax is as followsAtomics.store()Example Live Demo    JavaScript Example           var arrayBuffer = new SharedArrayBuffer(16);       var data = new Uint8Array(arrayBuffer);       data[0] = 20;       Atomics.store(data, ... Read More

Atomics.load() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 09:54:19

183 Views

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 load() function of the Atomic object returns the value at a given position of an array.SyntaxIts syntax is as followsAtomics.load()Example Live Demo    JavaScript Example           var arrayBuffer = new SharedArrayBuffer(16);       var data = new Uint8Array(arrayBuffer);       data[0] = 20;       Atomics.add(data, 0, 30);       document.write(Atomics.load(data, 0));     Output50Example Live Demo ... Read More

Atomics.isLockFree() function in JavaScript

Samual Sam
Updated on 25-Jun-2020 09:54:40

135 Views

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 Live Demo    JavaScript Example           document.write(Atomics.isLockFree(7));       document.write("");       document.write(" "+Atomics.isLockFree(8));     Outputfalse false

Atomics.or() function in JavaScript

karthikeya Boyini
Updated on 25-Jun-2020 09:55:16

145 Views

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 or() function of the atomic object accepts a value representing the position of an array, performs bitwise OR operation on the value in the given position and returns the old value in it.SyntaxIts syntax is as followsAtomics.or(data, 0, 30)Example Live Demo    JavaScript Example           var arrayBuffer = new SharedArrayBuffer(16);       var data = new Uint8Array(arrayBuffer);       ... Read More

Advertisements