Die statische Atomics
.store()
Methode speichert einen gegebenen Wert an einer gegebenen Position in dem Array und gibt den Wert zurück.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Syntax
Atomics.store(typedArray, index, value)
Parameter
typedArray
- Ein geteiltes getrypted Integer Array. Eines von
Int8Array
,Uint8Array
,Int16Array
,Uint16Array
,Int32Array
oderUint32Array
. index
- Die Position in
typedArray
, an dervalue
gespeichert wird. value
- Die Zahl, die gespeichert wird.
Rückgabewert
Der Wert, der abgespeichert wurde.
Exceptions
- Erzeugt einen
TypeError
, wenntypedArray
nicht von einem erlaubten Integer Typ ist. - Erzeugt eine
TypeError
, wenntypedArray
kein geteilter Arraytyp ist. - Erzeugt ein
RangeError
, wenn derindex
nicht in den Grenzen vontypedArray
ist.
Beispiele
var sab = new SharedArrayBuffer(1024);
var ta = new Uint8Array(sab);
Atomics.store(ta, 0, 12); // 12
Spezifikationen
Spezifikation | Status | Kommentar |
---|---|---|
ECMAScript (ECMA-262) Die Definition von 'Atomics.store' in dieser Spezifikation. |
Lebender Standard | Initiale Definition in ES2017. |
Browserkompatibilität
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.