diff --git a/4-binary/01-arraybuffer-binary-arrays/01-concat/task.md b/4-binary/01-arraybuffer-binary-arrays/01-concat/task.md
index 6710104b2..67b71fb2e 100644
--- a/4-binary/01-arraybuffer-binary-arrays/01-concat/task.md
+++ b/4-binary/01-arraybuffer-binary-arrays/01-concat/task.md
@@ -1,4 +1,4 @@
-# Concatenate typed arrays
+# بÙâÙÙ
Ù¾ÛÙØ³ØªÙ آراÛÙâÙØ§Û typed
-Given an array of `Uint8Array`, write a function `concat(arrays)` that returns a concatenation of them into a single array.
+ÛÚ© آراÛÙâ Ø§Ø² `Uint8Array` داد٠شد٠است. ÛÚ© تابع `concat(arrays)` بÙÙÛØ³Ûد ک٠آÙâÙØ§ را در ÛÚ© آراÛÙâÛ ÙØ§ØØ¯ ب٠ÙÙ
Ù
ØªØµÙ Ú©ÙØ¯ Ù Ø¨Ø±Ú¯Ø±Ø¯Ø§ÙØ¯.
diff --git a/4-binary/01-arraybuffer-binary-arrays/article.md b/4-binary/01-arraybuffer-binary-arrays/article.md
index 2827e277e..32441d64a 100644
--- a/4-binary/01-arraybuffer-binary-arrays/article.md
+++ b/4-binary/01-arraybuffer-binary-arrays/article.md
@@ -1,87 +1,87 @@
-# ArrayBuffer, binary arrays
+# ArrayBuffer, آراÛÙâÙØ§Û Ø¯ÙØ¯ÙÛÛ
-In web-development we meet binary data mostly while dealing with files (create, upload, download). Another typical use case is image processing.
+در ØªÙØ³Ø¹ÙâÛ ÙØ¨Ø Ù
ا Ù
عÙ
ÙÙØ§ ÙÙگاÙ
سرÙکار داشت٠با ÙØ§ÛÙâÙØ§(Ø³Ø§Ø®ØªÙØ Ø¨Ø§Ø±Ú¯Ø°Ø§Ø±Û Ú©Ø±Ø¯ÙØ داÙÙÙØ¯ کردÙ) ب٠دادÙâÙØ§Û Ø¯ÙØ¯ÙÛÛ Ø¨Ø±Ø®ÙØ±Ø¯ Ù
ÛâÚ©ÙÛÙ
. ÛÚ©Û Ø¯Ûگر از Ø§Ø³ØªÙØ§Ø¯ÙâÙØ§Û Ø±Ø§ÛØ¬ آ٠پردازش تصÙÛØ± Ù
ÛâØ¨Ø§Ø´Ø¯.
-That's all possible in JavaScript, and binary operations are high-performant.
+ÙÙ
ÙâÛ Ø§ÛÙâ Ù
ÙØ§Ø±Ø¯ در Ø¬Ø§ÙØ§Ø§Ø³Ú©Ø±Ûپت Ù
Ù
Ú©Ù Ø§Ø³ØªØ Ù Ø¹Ù
ÙÛØ§ØªâÙØ§Û Ø¯ÙØ¯ÙÛÛ Ø¹Ù
Ùکرد Ø¨Ø§ÙØ§ÛÛ Ø¯Ø§Ø±ÙØ¯.
-Although, there's a bit of confusion, because there are many classes. To name a few:
+ÙØ±ÚÙØ¯Ø Ø§ÙØ¯Ú©Û Ø§ØØªÙ
Ø§Ù Ø§Ø´ØªØ¨Ø§Ù Ú©Ø±Ø¯Ù ÙØ¬Ùد Ø¯Ø§Ø±Ø¯Ø Ø²ÛØ±Ø§ Ú©ÙØ§Ø³âÙØ§Û Ø¨Ø³ÛØ§Ø±Û ÙØ¬Ùد Ø¯Ø§Ø±ÙØ¯. Ø¨Ø±Ø®Û Ø§Ø² Ø¢ÙâÙØ§ Ø¹Ø¨Ø§Ø±ØªÙØ¯ از:
- `ArrayBuffer`, `Uint8Array`, `DataView`, `Blob`, `File`, etc.
-Binary data in JavaScript is implemented in a non-standard way, compared to other languages. But when we sort things out, everything becomes fairly simple.
+دادÙâÙØ§Û Ø¯ÙØ¯ÙÛÛ Ø¯Ø± Ø¬Ø§ÙØ§Ø§Ø³Ú©Ø±ÛÙ¾ØªØ ÙØ³Ø¨Øª Ø¨Ù Ø³Ø§ÛØ± زباÙâÙØ§ Ø¨Ù Ø´Ú©Ù ØºÛØ±Ø§Ø³ØªØ§ÙØ¯Ø§Ø±Ø¯Û Ù¾ÛØ§Ø¯ÙâØ³Ø§Ø²Û Ø´Ø¯ÙâØ§ÙØ¯. ÙÙÛ ÙÙگاÙÛ Ú©Ù Ù
ا ÚÛØ²Ùا را Ù
رتب Ù
ÛâÚ©ÙÛÙ
Ø ÙÙ
Ù ÚÛØ² ÙØ³Ø¨ØªØ§ ساد٠Ù
ÛâØ´ÙØ¯.
-**The basic binary object is `ArrayBuffer` -- a reference to a fixed-length contiguous memory area.**
+**Ø´Û Ø¯ÙØ¯ÙÛÛ Ù¾Ø§ÛÙ `ArrayBuffer` است -- ÛÚ© اشار٠ب٠ÛÚ© ÙØ§ØÛÙâÛ Ù¾ÛÙØ³ØªÙâÛ ØØ§Ùظ٠با Ø·Ù٠ثابت.**
-We create it like this:
+آ٠را Ø¨Ù Ø´Ú©Ù Ø²ÛØ± Ù
ÛâØ³Ø§Ø²ÛÙ
:
```js run
-let buffer = new ArrayBuffer(16); // create a buffer of length 16
+let buffer = new ArrayBuffer(16); // ساخت ÛÚ© Ø¨Ø§ÙØ± با Ø·ÙÙ 16
alert(buffer.byteLength); // 16
```
-This allocates a contiguous memory area of 16 bytes and pre-fills it with zeroes.
+اÛ٠کد ÛÚ© ØØ§ÙظÙâÛ Ù¾ÛÙØ³ØªÙ Ø¨Ù Ø§ÙØ¯Ø§Ø²Ù 16 Ø¨Ø§ÛØª را اختصاص Ù
ÛâØ¯ÙØ¯ ٠آ٠را با ØµÙØ± Ù
ÙØ¯Ø§Ø±Ø¯ÙÛ Ø§ÙÙÛÙ Ù
ÛâÚ©ÙØ¯.
-```warn header="`ArrayBuffer` is not an array of something"
-Let's eliminate a possible source of confusion. `ArrayBuffer` has nothing in common with `Array`:
-- It has a fixed length, we can't increase or decrease it.
-- It takes exactly that much space in the memory.
-- To access individual bytes, another "view" object is needed, not `buffer[index]`.
+```ÙØ¯Ø± ÙØ´Ø¯Ø§Ø±="`ArrayBuffer` ÛÚ© آراÛ٠از ÚÛØ²Û ÙÛØ³Øª."
+Ø¨ÛØ§ÛÛØ¯ ÛÚ© Ù
ÙØ¨Ø¹ Ø§ØØªÙ
ا٠اشتبا٠کرد٠را Ø±ÙØ¹ Ú©ÙÛÙ
. `ArrayBuffer` ÙÛÚ Ø§Ø±ØªØ¨Ø§Ø·Û Ø¨Ø§ آراÛÙ ÙØ¯Ø§Ø±Ø¯:
+- ÛÚ© Ø·Ù٠ثابت Ø¯Ø§Ø±Ø¯Ø Ù
ا ÙÙ
ÛâØªÙØ§ÙÛÙ
آ٠را Ú©Ù
ÛØ§ Ø²ÛØ§Ø¯ Ú©ÙÛÙ
.
+- دÙÛÙØ§ ب٠ÙÙ
ا٠Ù
ÛØ²Ø§Ù ØØ§Ùظ٠اشغا٠Ù
ÛâÚ©ÙØ¯.
+- Ø¨Ø±Ø§Û Ø¯Ø³ØªØ±Ø³Û Ø¨Ù Ø¨Ø§ÛØªâÙØ§Û جداگاÙÙØ ÛÚ© Ø´Û "View" دÛگر ÙØ§Ø²Ù
Ø§Ø³ØªØ ÙÙ `buffer[index]`.
```
-`ArrayBuffer` is a memory area. What's stored in it? It has no clue. Just a raw sequence of bytes.
+ÛÚ© ÙØ§ØÛ٠از ØØ§Ùظ٠است. ÚÙ ÚÛØ²Û در Ø¢Ù Ø°Ø®ÛØ±Ù Ù
ÛâØ´ÙØ¯Ø ÙÛÚ Ø³Ø±ÙØ®Û ÙØ¬Ùد ÙØ¯Ø§Ø±Ø¯. ÙÙØ· ÛÚ© Ø¯ÙØ¨Ø§Ù٠خاÙÛ Ø§Ø² Ø¨Ø§ÛØªâÙØ§ `ArrayBuffer`
-**To manipulate an `ArrayBuffer`, we need to use a "view" object.**
+**Ø§Ø³ØªÙØ§Ø¯Ù Ú©ÙÛÙ
"View" Ù
ا Ø¨Ø§ÛØ¯ از ÛÚ© Ø´Û Ø`ArrayBuffer` Ø¨Ø±Ø§Û Ø¯Ø³ØªÚ©Ø§Ø±Û Ú©Ø±Ø¯Ù ÛÚ©**
-A view object does not store anything on its own. It's the "eyeglasses" that give an interpretation of the bytes stored in the `ArrayBuffer`.
+را Ù
ÛâØ¯ÙØ¯ `ArrayBuffer` است Ú©Ù ØªÙØ³ÛØ±Û Ø§Ø² Ø¨Ø§ÛØªâÙØ§Û Ø°Ø®ÛØ±Ù شد٠در "eyeglasses" ÚÛØ²Û را در Ø®ÙØ¯ Ø°Ø®ÛØ±Ù ÙÙ
ÛâÚ©ÙØ¯. اÛÙ view ÛÚ© Ø´Û
-For instance:
+:Ø¨Ø±Ø§Û Ù
ثاÙ
-- **`Uint8Array`** -- treats each byte in `ArrayBuffer` as a separate number, with possible values from 0 to 255 (a byte is 8-bit, so it can hold only that much). Such value is called a "8-bit unsigned integer".
-- **`Uint16Array`** -- treats every 2 bytes as an integer, with possible values from 0 to 65535. That's called a "16-bit unsigned integer".
-- **`Uint32Array`** -- treats every 4 bytes as an integer, with possible values from 0 to 4294967295. That's called a "32-bit unsigned integer".
-- **`Float64Array`** -- treats every 8 bytes as a floating point number with possible values from 5.0x10-324 to 1.8x10308.
+- **`Uint8Array`** -- Ù
اÙÙØ¯ ÛÚ© عدد جداگاÙÙ Ø¨Ø±Ø®ÙØ±Ø¯ Ù
ÛâÚ©ÙØ¯ Ù Ù
ÙØ§Ø¯Ûر Ù
جاز آ٠از 0 تا 255 است.(ÛÚ© Ø¨Ø§ÛØª 8 Ø¨ÛØª است پس ÙÙØ· تا ÙÙ
ا٠Ù
ÙØ¯Ø§Ø± را Ù
ÛâØªÙØ§Ùد Ùگ٠دارد.). ب٠اÛÙ Ù
ÙØ¯Ø§Ø± ÛÚ© عدد صØÛØ Ø¨Ø¯ÙÙâØ¹ÙØ§Ù
ت 8-Ø¨ÛØªÛ Ú¯ÙØªÙ Ù
ÛâØ´ÙØ¯ `ArrayBuffer` با ÙØ± Ø¨Ø§ÛØª در
+- **`Uint16Array`** -- Ø¨Ø±Ø®ÙØ±Ø¯ Ù
ÛâÚ©ÙØ¯ Ú©Ù Ù
ÙØ§Ø¯Ûر Ù
جاز آ٠از 0 تا 65535 Ù
ÛâØ¨Ø§Ø´Ø¯. ب٠آ٠ÛÚ© عدد صØÛØ Ø¨Ø¯ÙÙâØ¹ÙØ§Ù
ت 16-Ø¨ÛØªÛ Ú¯ÙØªÙ Ù
ÛâØ´ÙØ¯ integer با ÙØ± 2 Ø¨Ø§ÛØª ب٠عÙÙØ§Ù ÛÚ©
+- **`Uint32Array`** -- Ø¨Ø±Ø®ÙØ±Ø¯ Ù
ÛâÚ©ÙØ¯ Ú©Ù Ù
ÙØ§Ø¯Ûر Ù
جاز آ٠از 0 تا 4294967295 Ù
ÛâØ¨Ø§Ø´Ø¯. ب٠آ٠ÛÚ© عدد صØÛØ Ø¨Ø¯ÙÙâØ¹ÙØ§Ù
ت 32-Ø¨ÛØªÛ Ú¯ÙØªÙ Ù
ÛâØ´ÙØ¯ integer با ÙØ± 4 Ø¨Ø§ÛØª ب٠عÙÙØ§Ù ÛÚ©
+- **`Float64Array`** -- Ù
ÛâØ¨Ø§Ø´Ø¯ 1.8x10308 تا 5.0x10-324 Ø±ÙØªØ§Ø± Ù
ÛâÚ©ÙØ¯ Ù Ù
ÙØ§Ø¯Ûر Ù
جاز آ٠از float با ÙØ± 8 Ø¨Ø§ÛØª ب٠عÙÙØ§Ù ÛÚ© عدد
-So, the binary data in an `ArrayBuffer` of 16 bytes can be interpreted as 16 "tiny numbers", or 8 bigger numbers (2 bytes each), or 4 even bigger (4 bytes each), or 2 floating-point values with high precision (8 bytes each).
+با Ø¯ÙØª Ø¨Ø§ÙØ§(ÙØ± کداÙ
8 Ø¨Ø§ÛØª) ØªÙØ³Ûر Ø´ÙØ¯ float ÛÛ Ø¨Ø§ Ø§ÙØ¯Ø§Ø²ÙâÛ 16 Ø¨Ø§ÛØªØ Ù
ÛâØªÙØ§Ùد ب٠عÙÙØ§Ù 16 عدد Ú©ÙÚÚ© ÛØ§ 8 عدد Ø¨Ø²Ø±Ú¯âØªØ± (ÙØ± کداÙ
2 Ø¨Ø§ÛØª) ÛØ§ 4 عدد Ø¨Ø²Ø±Ú¯âØªØ± از ÙØ¨ÙÛ(ÙØ± کداÙ
4 Ø¨Ø§ÛØª) ÛØ§ 2 عدد `ArrayBuffer` Ø¨ÙØ§Ø¨Ø±Ø§ÛÙØ ÛÚ© دادÙâÛ Ø¯ÙØ¯ÙÛÛ Ø¯Ø±ÙÙ

-`ArrayBuffer` is the core object, the root of everything, the raw binary data.
+Ø´Û Ø§ØµÙÛØ Ø±ÛØ´ÙâÛ ÙÙ
Ù ÚÛØ² ٠دادÙâÛ Ø¨Ø§ÛÙØ±Û خاÙ
است `ArrayBuffer`
-But if we're going to write into it, or iterate over it, basically for almost any operation â we must use a view, e.g:
+Ù
اÙÙØ¯ Ø²ÛØ± Ø§Ø³ØªÙØ§Ø¯Ù Ú©ÙÛÙ
view اÙ
ا اگر Ø¨Ø®ÙØ§ÙÛÙ
ÙØ± عÙ
ÙÛØ§ØªÛ رÙÛ Ø¢Ù Ø§ÙØ¬Ø§Ù
دÙÛÙ
Ø Ø§Ø² جÙ
ÙÙØ در آ٠بÙÙÛØ³ÛÙ
Ø ÛØ§ آ٠را Ù¾ÛÙ
Ø§ÛØ´ کتÛÙ
- Ø¨Ø§ÛØ¯ از ÛÚ©
```js run
-let buffer = new ArrayBuffer(16); // create a buffer of length 16
+let buffer = new ArrayBuffer(16); // ساخت ÛÚ© Ø¨Ø§ÙØ± با Ø·ÙÙ 16
*!*
-let view = new Uint32Array(buffer); // treat buffer as a sequence of 32-bit integers
+let view = new Uint32Array(buffer); // Ø±ÙØªØ§Ø± با Ø¨Ø§ÙØ± Ù
اÙÙØ¯ ÛÚ© Ø¯ÙØ¨Ø§Ù٠از اعداد صØÛØ 32 Ø¨ÛØªÛ
-alert(Uint32Array.BYTES_PER_ELEMENT); // 4 bytes per integer
+alert(Uint32Array.BYTES_PER_ELEMENT); // Ø¨Ù Ø§Ø²Ø§Û ÙØ± عدد صØÛØØ 4 Ø¨Ø§ÛØª
*/!*
-alert(view.length); // 4, it stores that many integers
-alert(view.byteLength); // 16, the size in bytes
+alert(view.length); // 4, ب٠اÛ٠تعداد عدد صØÛØ Ø¯Ø± Ø®ÙØ¯ Ø°Ø®ÛØ±Ù Ù
ÛâÚ©ÙØ¯
+alert(view.byteLength); // 16, Ø§ÙØ¯Ø§Ø²ÙâÛ Ø¨Ø§ÛØªâÙØ§
-// let's write a value
+// ÙÙØ´ØªÙ ÛÚ© Ù
ÙØ¯Ø§Ø±
view[0] = 123456;
-// iterate over values
+// Ù¾ÛÙ
Ø§ÛØ´ رÙÛ Ù
ÙØ§Ø¯Ûر
for(let num of view) {
- alert(num); // 123456, then 0, 0, 0 (4 values total)
+ alert(num); // ابتدا 123456 سپس 0 Ù 0 Ù 0(در Ù
جÙ
ÙØ¹ 4 Ù
ÙØ¯Ø§Ø±)
}
```
## TypedArray
-The common term for all these views (`Uint8Array`, `Uint32Array`, etc) is [TypedArray](https://tc39.github.io/ecma262/#sec-typedarray-objects). They share the same set of methods and properties.
+Ø§ØµØ·ÙØ§Ø Ø±Ø§ÛØ¬ Ø¨Ø±Ø§Û ØªÙ
اÙ
Û Ø§ÛÙ viewÙØ§ (`Uint8Array` Ù `Unit32Array` Ù ØºÛØ±Ù) [TypedArray](https://tc39.github.io/ecma262/#sec-typedarray-objects) Ù
ÛâØ¨Ø§Ø´Ø¯. Ø¢ÙâÙØ§ Ù
ØªØ¯ÙØ§ Ù ÙÛÚÚ¯ÛâÙØ§Û ÛکساÙÛ Ø¯Ø§Ø±ÙØ¯.
-Please note, there's no constructor called `TypedArray`, it's just a common "umbrella" term to represent one of views over `ArrayBuffer`: `Int8Array`, `Uint8Array` and so on, the full list will soon follow.
+ÙØ·Ùا ب٠خاطر Ø¯Ø§Ø´ØªÙ Ø¨Ø§Ø´ÛØ¯ Ú©Ù ÙÛÚ Ø³Ø§Ø²ÙØ¯ÙâØ§Û Ø¨Ø§ عÙÙØ§Ù `TypedArray` ÙØ¬Ùد ÙØ¯Ø§Ø±Ø¯ ٠اÛÙ ÙÙØ· ÛÚ© Ø§ØµØ·ÙØ§Ø Ø±Ø§ÛØ¬ Ø¨Ø±Ø§Û Ù¾ÙØ´Ø´ ÛÚ©Û Ø§Ø² viewÙØ§Û Ù
ÙØ¶Ùع گستردÙâÛ `ArrayBuffer` Ù
ÛâØ¨Ø§Ø´Ø¯: `Int8Array` Ù `Uint8Array` ٠ب٠ÙÙ
ÛÙ ØªØ±ØªÛØ¨Ø ÙÛØ³Øª کاÙ
Ù Ø¨Ù Ø²ÙØ¯Û ارائ٠Ù
ÛâØ´ÙØ¯.
-When you see something like `new TypedArray`, it means any of `new Int8Array`, `new Uint8Array`, etc.
+ÙØ±Ú¯Ø§Ù ÚÛØ²Û Ù
اÙÙØ¯ `new TypedArray` Ù
Ø´Ø§ÙØ¯Ù Ú©Ø±Ø¯ÛØ¯Ø اÛ٠عبارت ب٠Ù
Ø¹ÙØ§Û ÙØ±Ú©Ø¯Ø§Ù
از `new Int8Array`Ø `new Uint8Array` Ù ØºÛØ±Ù Ù
ÛâØ¨Ø§Ø´Ø¯.
-Typed arrays behave like regular arrays: have indexes and are iterable.
+آراÛÙâÙØ§Û Typed Ù
اÙÙØ¯ آراÛÙâÙØ§Û Ø¹Ø§Ø¯Û Ø±ÙØªØ§Ø± Ù
ÛâÚ©ÙÙØ¯: Ø¯Ø§Ø±Ø§Û Ø§ÙØ¯ÛØ´ ÙØ³ØªÙد Ù ÙØ§Ø¨Ù Ù¾ÛÙ
Ø§ÛØ´ Ù
ÛâØ¨Ø§Ø´ÙØ¯.
-A typed array constructor (be it `Int8Array` or `Float64Array`, doesn't matter) behaves differently depending on argument types.
+ÛÚ© Ø³Ø§Ø²ÙØ¯ÙâÛ Ø¢Ø±Ø§ÛÙâÛ Typed(Ù
ÛâØªÙØ§Ùد `Int8Array` ÛØ§ `Float64Array` Ø¨Ø§Ø´Ø¯Ø Ø§ÙÙ
ÛØªÛ ÙØ¯Ø§Ø±Ø¯) با ØªÙØ¬Ù ب٠ÙÙØ¹ آرگÙÙ
ا٠آ٠Ù
ØªÙØ§Ùت Ø±ÙØªØ§Ø± Ù
ÛâÚ©ÙØ¯.
-There are 5 variants of arguments:
+5 ÙÙØ¹ Ù
ختÙ٠آرگÙÙ
اÙâÙØ§ ÙØ¬Ùد Ø¯Ø§Ø±ÙØ¯:
```js
new TypedArray(buffer, [byteOffset], [length]);
@@ -91,92 +91,92 @@ new TypedArray(length);
new TypedArray();
```
-1. If an `ArrayBuffer` argument is supplied, the view is created over it. We used that syntax already.
+1. اگر ÛÚ© آرگÙÙ
ا٠`ArrayBuffer` ÙØ¬Ùد Ø¯Ø§Ø´ØªÙ Ø¨Ø§Ø´Ø¯Ø view بر ØØ³Ø¨ آ٠ساخت٠Ù
ÛâØ´ÙØ¯. Ù
ا Ù¾ÛØ´ از اÛ٠از ÙÙ
Û٠سÛÙØªÚ©Ø³ Ø§Ø³ØªÙØ§Ø¯Ù کردÛÙ
.
+
+ Ù
ا Ù
ÛâØªÙØ§ÙÛÙ
Ø¨Ù ØµÙØ±Øª Ø§Ø®ØªÛØ§Ø±Û `byteOffset` تÙÛÙ Ú©ÙÛÙ
ک٠از Ø¢Ù Ø´Ø±ÙØ¹ Ú©ÙÛÙ
(Ø¨Ù Ø´Ú©Ù Ù¾ÛØ´âÙØ±Ø¶ از 0 Ø´Ø±ÙØ¹ Ù
ÛâÚ©ÙÛÙ
) Ù ÛÚ© `length` ک٠تا Ø¢ÙØ¬Ø§ اداÙ
٠دÙÛÙ
(Ø¨Ù ØµÙØ±Øª Ù¾ÛØ´âÙØ±Ø¶ تا Ø§ÙØªÙØ§Û Ø¨Ø§ÙØ± اداÙ
Ùâ Ù
ÛâØ¯ÙÛÙ
)Ø Ø¯Ø± ÙØªÛØ¬ÙØ view ÙÙØ· Ø¨Ø®Ø´Û Ø§Ø² Ø¨Ø§ÙØ± را Ù¾ÙØ´Ø´ Ù
ÛâØ¯ÙØ¯.
- Optionally we can provide `byteOffset` to start from (0 by default) and the `length` (till the end of the buffer by default), then the view will cover only a part of the `buffer`.
-
-2. If an `Array`, or any array-like object is given, it creates a typed array of the same length and copies the content.
-
- We can use it to pre-fill the array with the data:
+2. اگر ÛÚ© آراÛÙ ÛØ§ ÙØ± Ø´Û Ù
اÙÙØ¯ آ٠داشت٠باشÛÙ
Ø Ø¢Ù Ø´Û ÛÚ© آراÛÙâÛ typed ب٠ÙÙ
ا٠طÙÙ Ù
ÛâØ³Ø§Ø²Ø¯ Ù Ù
ØØªÙا را ÙÛØ² Ú©Ù¾Û Ù
ÛâÚ©ÙØ¯.
+
+ Ù
ا Ù
ÛâØªÙØ§ÙÛÙ
از Ø¢Ù Ø¨Ø±Ø§Û Ù
ÙØ¯Ø§Ø±Ø¯ÙÛ Ø§ÙÙÛÙâÛ Ø¢Ø±Ø§Û٠با Ø¯Ø§Ø¯Ù Ø§Ø³ØªÙØ§Ø¯Ù Ú©ÙÛÙ
:
```js run
*!*
let arr = new Uint8Array([0, 1, 2, 3]);
*/!*
- alert( arr.length ); // 4, created binary array of the same length
- alert( arr[1] ); // 1, filled with 4 bytes (unsigned 8-bit integers) with given values
+ alert( arr.length ); // 4, ÛÚ© آراÛÙ Ø¯ÙØ¯ÙÛÛ Ø¨Ù ÙÙ
ا٠طÙÙ Ù
ÛâØ³Ø§Ø²Ø¯
+ alert( arr[1] ); // 1, با 4 Ø¨Ø§ÛØª(اعداد صØÛØ Ø¨Ø¯ÙÙâØ¹ÙØ§Ù
ت 8-Ø¨ÛØªÛ) با Ù
ÙØ§Ø¯Ûر داد٠شد٠پر Ù
ÛâØ´ÙØ¯
```
-3. If another `TypedArray` is supplied, it does the same: creates a typed array of the same length and copies values. Values are converted to the new type in the process, if needed.
+3. اگر ÛÚ© `TypedArray` دÛگر ÙØ¬Ùد Ø¯Ø§Ø´ØªÙ Ø¨Ø§Ø´Ø¯Ø Ø¨Ù ÙÙ
Ø§Ù Ø´Ú©Ù Ø±ÙØªØ§Ø± Ù
ÛâÚ©ÙØ¯: Ú© آراÛÙâÛ typed ب٠ÙÙ
ا٠طÙÙ Ù
ÛâØ³Ø§Ø²Ø¯ Ù Ù
ØØªÙا را ÙÛØ² Ú©Ù¾Û Ù
ÛâÚ©ÙØ¯. در Ø·Ù٠اÛÙ ÙØ±Ø¢ÛÙØ¯Ø Ù
ÙØ§Ø¯Ûر در ØµÙØ±Øª ÙÛØ§Ø² ب٠ÙÙØ¹ Ø¬Ø¯ÛØ¯Û تبدÛÙ Ù
ÛâØ´ÙÙØ¯.
```js run
let arr16 = new Uint16Array([1, 1000]);
*!*
let arr8 = new Uint8Array(arr16);
*/!*
alert( arr8[0] ); // 1
- alert( arr8[1] ); // 232, tried to copy 1000, but can't fit 1000 into 8 bits (explanations below)
+ alert( arr8[1] ); // 232, ØªÙØ§Ø´ Ù
ÛâÚ©ÙØ¯ 1000 را Ú©Ù¾Û Ú©ÙØ¯ اÙ
ا ÙÙ
ÛâØªÙØ§Ùد 1000 را در 8 Ø¨ÛØª جا Ø¯ÙØ¯(ØªÙØ¶Ûخات در پاÛÛÙ)
```
-4. For a numeric argument `length` -- creates the typed array to contain that many elements. Its byte length will be `length` multiplied by the number of bytes in a single item `TypedArray.BYTES_PER_ELEMENT`:
+4. Ø¨Ø±Ø§Û Ø¢Ø±Ú¯ÙÙ
Ø§Ù Ø¹Ø¯Ø¯Û `length` -- ÛÚ© آراÛÙâ typed ک٠ب٠ÙÙ
ا٠تعداد عض٠دارد Ù
ÛâØ³Ø§Ø²Ø¯. Ø·ÙÙ Ø¨Ø§ÛØª آ٠برابر `length` ضرب در تعداد Ø¨Ø§ÛØªâÙØ§Û ÛÚ© Ø¢ÛØªÙ
ÙØ§ØØ¯ `TypedArray.BYTES_PER_ELEMENT` Ø®ÙØ§Ùد Ø¨ÙØ¯:
```js run
- let arr = new Uint16Array(4); // create typed array for 4 integers
- alert( Uint16Array.BYTES_PER_ELEMENT ); // 2 bytes per integer
- alert( arr.byteLength ); // 8 (size in bytes)
+ let arr = new Uint16Array(4); // Ø¨Ø±Ø§Û 4 عدد صØÛØ Ù
ÛâØ³Ø§Ø²Ø¯ typed ÛÚ© آراÛÙâÛ
+ alert( Uint16Array.BYTES_PER_ELEMENT ); // Ø¨Ù Ø§Ø²Ø§Û ÙØ± عدد صØÛØ 2 Ø¨Ø§ÛØª
+ alert( arr.byteLength ); // 8 (Ø§ÙØ¯Ø§Ø²Ù در Ø¨Ø§ÛØªâÙØ§)
```
-5. Without arguments, creates an zero-length typed array.
+5. بدÙ٠آرگÙÙ
اÙâÙØ§ ÛÚ© آراÛÙâÛ typed با Ø·ÙÙ ØµÙØ± Ù
ÛâØ³Ø§Ø²Ø¯.
-We can create a `TypedArray` directly, without mentioning `ArrayBuffer`. But a view cannot exist without an underlying `ArrayBuffer`, so gets created automatically in all these cases except the first one (when provided).
+Ù
ا Ù
ÛâØªÙØ§ÙÛÙ
Ù
ستÙÛÙ
ا ÛÚ© `TypedArray` بسازÛÙ
Ø Ø¨Ø¯Ù٠اÛÙک٠ب٠`ArrayBuffer` اشارÙâØ§Û Ú©ÙÛÙ
. ÙÙÛ ÛÚ© view بدÙÙ `ArrayBuffer` Ø¯Ø±Ø¨Ø±Ú¯ÛØ±Ùد٠ÙÙ
ÛâØªÙØ§Ùد ÙØ¬Ùد Ø¯Ø´Ø§ØªÙ Ø¨Ø§Ø´Ø¯Ø Ø¯Ø± ÙØªÛج٠در ÙÙ
ÙâÛ Ø§ÛÙ Ù
ÙØ§Ø±Ø¯ بجز Ù
ÙØ±Ø¯ اÙÙ(ÙÙگاÙ
Û Ú©Ù ÙØ±Ø§ÙÙ
شد٠است) Ø¨Ù Ø·ÙØ± Ø®ÙØ¯Ú©Ø§Ø± ساخت٠Ù
Û@Ø´ÙØ¯.
-To access the underlying `ArrayBuffer`, there are following properties in `TypedArray`:
-- `buffer` -- references the `ArrayBuffer`.
-- `byteLength` -- the length of the `ArrayBuffer`.
+Ø¨Ø±Ø§Û Ø¯Ø³ØªØ±Ø³Û Ø¨Ù `ArrayBuffer` Ø¯Ø±Ø¨Ø±Ú¯ÛØ±ÙØ¯ÙØ ÙÛÚÚ¯ÛâÙØ§Û Ø²ÛØ± در `TypedArray` ÙØ¬Ùد دارد:
+- `buffer` -- `ArrayBuffer` ارجاع بÙ
+- `byteLength` -- `ArrayBuffer` Ø·ÙÙ
-So, we can always move from one view to another:
+Ø¨ÙØ§Ø¨Ø±Ø§ÛÙØ Ù
ا ÙÙ
ÛØ´Ù Ù
ÛâØªÙØ§ÙÛÙ
از ÛÚ© view ب٠دÛÚ¯Ø±Û Ø¨Ø±ÙÛÙ
:
```js
let arr8 = new Uint8Array([0, 1, 2, 3]);
-// another view on the same data
+// دÛگر در ÙÙ
ا٠داد٠view ÛÚ©
let arr16 = new Uint16Array(arr8.buffer);
```
-Here's the list of typed arrays:
+در اداÙ
Ù ÙÛØ³Øª آراÛÙâÙØ§Û typed Ø¢Ù
د٠است:
-- `Uint8Array`, `Uint16Array`, `Uint32Array` -- for integer numbers of 8, 16 and 32 bits.
- - `Uint8ClampedArray` -- for 8-bit integers, "clamps" them on assignment (see below).
-- `Int8Array`, `Int16Array`, `Int32Array` -- for signed integer numbers (can be negative).
-- `Float32Array`, `Float64Array` -- for signed floating-point numbers of 32 and 64 bits.
+- `Uint8Array`, `Uint16Array`, `Uint32Array` -- Ø¨Ø±Ø§Û Ø§Ø¹Ø¯Ø§Ø¯ صØÛØ 8 Ù 16 Ù 32 Ø¨ÛØªÛ
+ - `Uint8ClampedArray` -- Ù
ÛâÚ©ÙØ¯ (در اداÙ
Ù Ø®ÙØ§ÙÛØ¯ Ø¯ÛØ¯) "clamps" Ø¨Ø±Ø§Û Ø§Ø¹Ø¯Ø§Ø¯ صØÛØ 8 Ø¨ÛØªÛØ Ø¢ÙâÙØ§ را
+- `Int8Array`, `Int16Array`, `Int32Array` -- Ø¨Ø±Ø§Û Ø§Ø¹Ø¯Ø§Ø¯ صØÛØ Ø¹ÙØ§Ù
ØªâØ¯Ø§Ø±(Ù
ÛâØªÙØ§ÙÙØ¯ Ù
ÙÙÛ Ø¨Ø§Ø´ÙØ¯)
+- `Float32Array`, `Float64Array` -- Ø¨Ø±Ø§Û Ø§Ø¹Ø¯Ø§Ø¯ Ø§Ø¹Ø´Ø§Ø±Û Ø¹ÙØ§Ù
ØªâØ¯Ø§Ø± 32 Ù 64 Ø¨ÛØªÛ
-```warn header="No `int8` or similar single-valued types"
-Please note, despite of the names like `Int8Array`, there's no single-value type like `int`, or `int8` in JavaScript.
+```ÙØ¯Ø± ÙØ´Ø¯Ø§Ø±="بدÙÙ `int8` ÛØ§ اÙÙØ§Ø¹ Ù
شاب٠با Ù
ÙØ¯Ø§Ø± ÙØ§ØØ¯"
+ÙØ·Ùا ب٠خاطر Ø¯Ø§Ø´ØªÙ Ø¨Ø§Ø´ÛØ¯Ø عÙÛâØ±ØºÙ
ÙØ§Ù
âÙØ§ÛÛ Ù
اÙÙØ¯ `Int8Array`Ø ÙÛÚ ÙÙØ¹Û با Ù
ÙØ¯Ø§Ø± ÙØ§ØØ¯ Ù
اÙÙØ¯ `int` ÛØ§ `int8` در Ø¬Ø§ÙØ§Ø§Ø³Ú©Ø±Ûپت ÙØ¬Ùد ÙØ¯Ø§Ø±Ø¯.
-That's logical, as `Int8Array` is not an array of these individual values, but rather a view on `ArrayBuffer`.
+اÛÙ Ù
ÙØ¶Ùع Ù
ÙØ·ÙÛ Ø§Ø³ØªØ Ø²ÛØ±Ø§ `Int8Array` ÛÚ© آراÛ٠از اÛÙ Ù
ÙØ§Ø¯Ûر Ù
جزا ÙÛØ³ØªØ بÙÚ©Ù ÛÚ© view رÙÛ `ArrayBuffer` است.
```
-### Out-of-bounds behavior
+### Ø±ÙØªØ§Ø± خارج از Ù
ØØ¯ÙدÙ
-What if we attempt to write an out-of-bounds value into a typed array? There will be no error. But extra bits are cut-off.
+بÙÙÛØ³ÛÙ
ÚÙØ ÙÛÚ Ø®Ø·Ø§ÛÛ ÙØ¬Ùد ÙØ®ÙØ§ÙØ¯ Ø¯Ø§Ø´ØªØ Ø§Ù
ا Ø¨ÛØªâÙÙØ§Û اضاÙÛ ØØ°Ù Ø®ÙØ§ÙÙØ¯ شد typed اگر Ø¨Ø®ÙØ§ÙÛÙ
ÛÚ© Ù
ÙØ¯Ø§Ø± خارج از Ù
ØØ¯Ùد٠را در ÛÚ© آراÛÙâÛ
-For instance, let's try to put 256 into `Uint8Array`. In binary form, 256 is `100000000` (9 bits), but `Uint8Array` only provides 8 bits per value, that makes the available range from 0 to 255.
+Ø¨Ù Ø§Ø²Ø§Û ÙØ± Ù
ÙØ¯Ø§Ø± 8 Ø¨ÛØª Ø¯Ø§Ø±Ø¯Ø Ù¾Ø³ بازÙâÛ Ø¢Ù Ø¨ÛÙ 0 تا 255 Ø®ÙØ§Ùد Ø¨ÙØ¯ `Uint8Array` ÙØ±Ø§Ø± دÙÛÙ
. در ØØ§Ùت Ø¯ÙØ¯ÙÛÛØ 256 برابر `100000000`(9 Ø¨ÛØª) Ø®ÙØ§Ùد Ø¨ÙØ¯Ø ÙÙÛ `Uint8Array` ب٠عÙÙØ§Ù Ù
Ø«Ø§ÙØ Ø¨ÛØ§ÛÛØ¯ Ø³Ø¹Û Ú©ÙÛÙ
256 را در
-For bigger numbers, only the rightmost (less significant) 8 bits are stored, and the rest is cut off:
+:Ø¨Ø±Ø§Û Ø§Ø¹Ø¯Ø§Ø¯ Ø¨Ø²Ø±Ú¯ØªØ±Ø ÙÙØ· 8 Ø¨ÛØª سÙ
ت راست(Ø¨ÛØªâÙØ§Û Ú©Ù
âØ§Ø±Ø²Ø´âØªØ±) Ø°Ø®ÛØ±Ù Ù
ÛâØ´ÙØ¯Ø ٠بÙÛÙ Ø¨ÛØªâÙØ§ ØØ°Ù Ù
ÛâØ´ÙÙØ¯

-So we'll get zero.
+.در ÙØªÛØ¬Ù ØµÙØ± Ø¯Ø±ÛØ§Ùت Ù
ÛâÚ©ÙÛÙ
-For 257, the binary form is `100000001` (9 bits), the rightmost 8 get stored, so we'll have `1` in the array:
+:Ø¨Ø±Ø§Û 257Ø ØØ§Ùت Ø¯ÙØ¯ÙÛÛ `100000001`(9 Ø¨ÛØª) Ø®ÙØ§Ùد Ø¨ÙØ¯Ø 8 Ø¨ÛØª سÙ
ت راست Ø°Ø®ÛØ±Ù Ù
ÛâØ´ÙÙØ¯Ø در ÙØªÛج٠در آراÛÙ `1` را دارÛÙ

-In other words, the number modulo 28 is saved.
+Ø°Ø®ÛØ±Ù Ù
ÛâØ´ÙØ¯ 28 ب٠عبارت دÛÚ¯Ø±Ø Ø¨Ø§ÙÛâÙ
Ø§ÙØ¯Ù عدد
-Here's the demo:
+:ÛÚ© ÙÙ
ÙÙÙ
```js run
let uint8array = new Uint8Array(16);
let num = 256;
-alert(num.toString(2)); // 100000000 (binary representation)
+alert(num.toString(2)); // 100000000 (ÙÙ
Ø§ÛØ´ Ø¯ÙØ¯ÙÛÛ)
uint8array[0] = 256;
uint8array[1] = 257;
@@ -185,88 +185,88 @@ alert(uint8array[0]); // 0
alert(uint8array[1]); // 1
```
-`Uint8ClampedArray` is special in this aspect, its behavior is different. It saves 255 for any number that is greater than 255, and 0 for any negative number. That behavior is useful for image processing.
+از اÛÙ ÙØ¸Ø±Ø `Uint8ClampedArray` خاص است Ù Ø±ÙØªØ§Ø± Ù
ØªÙØ§ÙØªÛ Ø¯Ø§Ø±Ø¯. اÛÙ Ù
ÙØ±Ø¯ Ø¨Ù Ø§Ø²Ø§Û ÙØ± عدد بزرگتر از 255Ø 255 Ù Ø¨Ù Ø§Ø²Ø§Û ÙØ± عدد Ù
ÙÙÛØ 0 را Ø°Ø®ÛØ±Ù Ù
ÛâÚ©ÙØ¯. اÛÙ Ø±ÙØªØ§Ø± Ø¨Ø¨Ø±Ø§Û Ù¾Ø±Ø¯Ø§Ø²Ø´ تصÙÛØ± Ù
ÙÛØ¯ است.
-## TypedArray methods
+## Ù
ØªØ¯ÙØ§Û TypedArray
-`TypedArray` has regular `Array` methods, with notable exceptions.
+Ù
ØªØ¯ÙØ§Û `TypedArray` Ù
اÙÙØ¯ آراÛÙâÙØ§Û Ù
عÙ
ÙÙÛ Ù
ÛâØ¨Ø§Ø´Ø¯ ÙÙÛ Ø§Ø³ØªØ«ÙØ§ÙØ§Û ÙØ§Ø¨Ù ØªÙØ¬ÙÛ ÙÛØ² ÙØ¬Ùد دارد.
-We can iterate, `map`, `slice`, `find`, `reduce` etc.
+Ù
ا Ù
ÛâØªÙØ§ÙÛÙ
`map`Ø `slice`Ø `find`Ø `reduce` Ù ØºÛØ±Ù را Ù¾ÛÙ
Ø§ÛØ´ Ú©ÙÛÙ
.
-There are few things we can't do though:
+ÙØ±ÚÙØ¯Ø تعداد Ú©Ù
Û Ú©Ø§Ø± ÙØ¬Ùد دارد Ú©Ù Ù
ا ÙÙ
ÛâØªÙØ§ÙÛÙ
Ø§ÙØ¬Ø§Ù
دÙÛÙ
:
-- No `splice` -- we can't "delete" a value, because typed arrays are views on a buffer, and these are fixed, contiguous areas of memory. All we can do is to assign a zero.
-- No `concat` method.
+- بدÙÙ `splice` -- Ù
ا ÙÙ
ÛâØªÙØ§ÙÛÙ
ÛÚ© Ù
ÙØ¯Ø§Ø± را "ØØ°Ù" Ú©ÙÛÙ
Ø Ø²ÛØ±Ø§ آراÛÙâÙØ§Û typedØ Ø¯Ø±ÙØ§Ùع viewÙØ§ÛÛ Ø±ÙÛ ÛÚ© Ø¨Ø§ÙØ± ÙØ³ØªÙد Ú©Ù ÙØ§ØÛÙâÙØ§ÛÛ Ø«Ø§Ø¨Øª Ù Ù¾ÛÙØ³ØªÙ رÙÛ ØØ§Ùظ٠Ù
ÛâØ¨Ø§Ø´ÙØ¯. تÙÙØ§ Ú©Ø§Ø±Û Ú©Ù Ù
ا Ù
ÛâØªÙØ§ÙÛÙ
Ø§ÙØ¬Ø§Ù
دÙÛÙ
ØªØ®ØµÛØµ ÛÚ© ØµÙØ± است.
+- بدÙÙ Ù
تد `concat`
-There are two additional methods:
+د٠Ù
تد اضاÙÛ ÙÛØ² ÙØ¬Ùد دارد:
-- `arr.set(fromArr, [offset])` copies all elements from `fromArr` to the `arr`, starting at position `offset` (0 by default).
-- `arr.subarray([begin, end])` creates a new view of the same type from `begin` to `end` (exclusive). That's similar to `slice` method (that's also supported), but doesn't copy anything -- just creates a new view, to operate on the given piece of data.
+- Ù
تد `arr.set(fromArr, [offset])` تÙ
اÙ
Ø§Ø¹Ø¶Ø§Û `fromArr` را در `arr` Ú©Ù¾Û Ù
ÛâÚ©ÙØ¯Ø ک٠اÛÙ Ú©Ù¾Û Ú©Ø±Ø¯Ù Ø§Ø² Ù
ØÙ `offset` Ø´Ø±ÙØ¹ Ù
ÛâØ´ÙØ¯.(ØØ§Ùت Ù¾ÛØ´âÙØ±Ø¶ Ø¢Ù 0 است.)
+- Ù
تد `arr.subarray([begin, end])` ÛÚ© view Ø¬Ø¯ÛØ¯ از ÙÙ
ا٠ÙÙØ¹ را از `begin` تا `end` Ù
ÛâØ³Ø§Ø²Ø¯(Ø§ÙØØµØ§Ø±Û). اÛÙ Ù
تد Ù
اÙÙØ¯ Ù
تد `slice` است(Ø¢Ù Ù
تد ÙÛØ² Ù¾Ø´ØªÛØ¨Ø§ÙÛ Ù
ÛâØ´ÙØ¯.) ÙÙÛ ÚÛØ²Û را Ú©Ù¾Û ÙÙ
ÛâÚ©ÙØ¯ -- ÙÙØ· ÛÚ© view Ø¬Ø¯ÛØ¯ Ù
ÛâØ³Ø§Ø²Ø¯ ک٠رÙÛ Ø¯Ø§Ø¯ÙâÙØ§Û Ø¯Ø§Ø¯Ù Ø´Ø¯ÙØ عÙ
Ù
ÙÛØ§Øª Ø§ÙØ¬Ø§Ù
Ø¯ÙØ¯.
-These methods allow us to copy typed arrays, mix them, create new arrays from existing ones, and so on.
+اÛÙ Ù
ØªØ¯ÙØ§ ب٠Ù
ا اجاز٠Ù
ÛâØ¯ÙØ¯ ک٠آراÛÙâÙØ§Û typed را Ú©Ù¾Û Ú©ÙÛÙ
Ø Ø¢ÙâÙØ§ را با ÙÙ
ØªØ±Ú©ÛØ¨ Ú©ÙÛÙ
Ø Ø¢Ø±Ø§ÛÙâÙØ§Û Ø¬Ø¯ÛØ¯ از آراÛÙâÙØ§Û Ù
ÙØ¬Ùد بسازÛÙ
Ø Ù Ø¨Ù ÙÙ
ÛÙ ØªØ±ØªÛØ¨.
## DataView
-[DataView](mdn:/JavaScript/Reference/Global_Objects/DataView) is a special super-flexible "untyped" view over `ArrayBuffer`. It allows to access the data on any offset in any format.
+ÛÚ© [DataView](mdn:/JavaScript/Reference/Global_Objects/DataView) ÛÚ© view خاص ÙÙÙâØ§ÙØ¹Ø§Ø¯Ù Ø§ÙØ¹Ø·Ø§ÙâÙ¾Ø°ÛØ± "untyped" رÙÛ `ArrayBuffer` است. DataView اجاز٠Ù
ÛâÙØ¯ ک٠در ÙØ± offset ٠در ÙØ± ÙØ±Ù
ØªÛ Ø¨Ù Ø¯Ø§Ø¯ÙâÙØ§ Ø¯Ø³ØªØ±Ø³Û Ø¯Ø§Ø´ØªÙ Ø¨Ø§Ø´ÛÙ
.
-- For typed arrays, the constructor dictates what the format is. The whole array is supposed to be uniform. The i-th number is `arr[i]`.
-- With `DataView` we access the data with methods like `.getUint8(i)` or `.getUint16(i)`. We choose the format at method call time instead of the construction time.
+- Ø¨Ø±Ø§Û Ø¢Ø±Ø§ÛÙâÙØ§Û typedØ Ø³Ø§Ø²ÙØ¯Ù ÙØ±Ù
ت را Ù
شخص Ù
ÛâÚ©ÙØ¯. ک٠آراÛÙ ÙØ±Ø§Ø± است ÛÚ©ÙÙØ§Ø®Øª باشد. عدد iاÙ
Ø `arr[i]` است.
-The syntax:
+- با `DataView`Ø Ù
ا با Ù
ØªØ¯ÙØ§ÛÛ Ù
اÙÙØ¯ `.getUint8(i)` ÛØ§ `.getUint16(i)` Ø¨Ù Ø¯Ø§Ø¯Ù Ø¯Ø³ØªØ±Ø³Û Ù¾ÛØ¯Ø§ Ù
ÛâÚ©ÙÛÙ
. Ù
ا ÙØ±Ù
ت را Ø¨Ø¬Ø§Û ÙÙگاÙ
Ø³Ø§Ø®ØªØ ÙÙگاÙ
ÙØ±Ø§Ø®ÙاÙÛ Ù
تد Ø§ÙØªØ®Ø§Ø¨ Ù
ÛâÚ©ÙÛÙ
.
+سÛÙØªÚ©Ø³:
```js
new DataView(buffer, [byteOffset], [byteLength])
```
-- **`buffer`** -- the underlying `ArrayBuffer`. Unlike typed arrays, `DataView` doesn't create a buffer on its own. We need to have it ready.
-- **`byteOffset`** -- the starting byte position of the view (by default 0).
-- **`byteLength`** -- the byte length of the view (by default till the end of `buffer`).
+- **`buffer`** -- Ø¨Ø§ÙØ± Ù
Ø®ØµÙØµ Ø®ÙØ¯Ø´ را ÙÙ
ÛâØ³Ø§Ø²Ø¯. Ù
ا Ø¨Ø§ÛØ¯ آ٠را Ø¢Ù
اد٠داشت٠باشÛÙ
typed Ø¨Ø±Ø®ÙØ§Ù آراÛÙâÙØ§Û `DataView` .Ø¯Ø±Ø¨Ø±Ú¯ÛØ±Ùد٠`ArrayBuffer`
+- **`byteOffset`** -- (ØØ§Ùت Ù¾ÛØ´âÙØ±Ø¶ 0 Ù
ÛâØ¨Ø§Ø´Ø¯)view Ù
ØÙ Ø¨Ø§ÛØª Ø´Ø±ÙØ¹âÚ©ÙÙØ¯ÙâÛ
+- **`byteLength`** -- (ØØ§Ùت Ù¾ÛØ´âÙØ±Ø¶ تا Ø§ÙØªÙØ§Û Ø¨Ø§ÙØ± Ù
ÛâØ¨Ø§Ø´Ø¯)view Ø·ÙÙ Ø¨Ø§ÛØªâÙØ§Û
-For instance, here we extract numbers in different formats from the same buffer:
+Ø¨Ø±Ø§Û ÙÙ
ÙÙÙØ در اÛÙØ¬Ø§ Ù
ا اعداد ÛÚ© Ø¨Ø§ÙØ± Ûکسا٠را در ÙØ±Ù
تâÙØ§Û Ù
ختÙ٠استخراج کردÙâØ§ÛÙ
:
```js run
-// binary array of 4 bytes, all have the maximal value 255
-let buffer = new Uint8Array([255, 255, 255, 255]).buffer;
+
+let buffer = new Uint8Array([255, 255, 255, 255]).buffer; // آراÛÙâÙØ§Û Ø¯ÙØ¯ÙÛÛ 4 Ø¨Ø§ÛØªÛØ Ú©Ù ØØ¯Ø§Ú©Ø«Ø± Ù
ÙØ¯Ø§Ø± ÙÙ
ÙâÛ Ø¢ÙâÙØ§ 255 است
let dataView = new DataView(buffer);
-// get 8-bit number at offset 0
+// ØµÙØ± offset Ø¯Ø±ÛØ§Ùت ÛÚ© عدد 8 Ø¨ÛØªÛ در
alert( dataView.getUint8(0) ); // 255
-// now get 16-bit number at offset 0, it consists of 2 bytes, together interpreted as 65535
-alert( dataView.getUint16(0) ); // 65535 (biggest 16-bit unsigned int)
+// ØµÙØ±Ø اÛ٠عدد از Ø¯Ù Ø¨Ø§ÛØª تشکÛ٠شد٠است ک٠با ÙÙ
65535 را ÙØ´Ø§Ù Ù
ÛâØ¯ÙÙØ¯ offset ØØ§Ùا Ø¯Ø±ÛØ§Ùت ÛÚ© عدد 16 Ø¨ÛØªÛ در
+alert( dataView.getUint16(0) ); // 65535 (بزرگترÛ٠عدد صØÛØ Ø¨Ø¯ÙÙâØ¹ÙØ§Ù
ت 16 Ø¨ÛØªÛ)
-// get 32-bit number at offset 0
-alert( dataView.getUint32(0) ); // 4294967295 (biggest 32-bit unsigned int)
+// ØµÙØ± offset Ø¯Ø±ÛØ§Ùت ÛÚ© عدد 32 Ø¨ÛØªÛ در
+alert( dataView.getUint32(0) ); // 4294967295 (بزرگترÛ٠عدد صØÛØ Ø¨Ø¯ÙÙâØ¹ÙØ§Ù
ت 32 Ø¨ÛØªÛ)
-dataView.setUint32(0, 0); // set 4-byte number to zero, thus setting all bytes to 0
+dataView.setUint32(0, 0); // ØµÙØ± ÙØ±Ø§Ø± داد٠ÛÚ© عدد 4 Ø¨Ø§ÛØªÛØ Ø¯Ø± ÙØªÛج٠ÙÙ
Ù Ø¨Ø§ÛØªâÙØ§ را ØµÙØ± Ù
ÛâÚ©ÙÛÙ
```
-`DataView` is great when we store mixed-format data in the same buffer. For example, when we store a sequence of pairs (16-bit integer, 32-bit float), `DataView` allows to access them easily.
+ÙÙگاÙ
Û Ú©Ù Ù
ÛâØ®ÙØ§ÙÛÙ
دادÙâÙØ§ÛÛ Ø¨Ø§ ÙØ±Ù
تâÙØ§Û درÙÙ
٠برÙÙ
را در ÛÚ© Ø¨Ø§ÙØ± Ø°Ø®ÛØ±Ù Ú©ÙÛÙ
Ø `DataView` عاÙÛ Ø§Ø³Øª. ب٠عÙÙØ§Ù Ù
Ø«Ø§ÙØ ÙÙگاÙ
Û Ú©Ù Ø¯ÙØ¨Ø§ÙÙâØ§Û Ø§Ø² Ø¬ÙØªâÙØ§Û(عدد صØÛØ 16 Ø¨ÛØªÛØ Ø¹Ø¯Ø¯ Ø§Ø¹Ø´Ø§Ø±Û 32 Ø¨ÛØªÛ) را Ø°Ø®ÛØ±Ù Ù
ÛâÚ©ÙÛÙ
Ø `DataView` ب٠آساÙÛ Ø§Ø¬Ø§Ø²Ù Ø¯Ø³ØªØ±Ø³Û Ø¨Ù Ø¢ÙâÙØ§ را Ù
ÛâØ¯ÙØ¯.
-## Summary
+## Ø®ÙØ§ØµÙ
-`ArrayBuffer` is the core object, a reference to the fixed-length contiguous memory area.
+ÛÚ© `ArrayBuffer`Ø Ø´Û Ø§ØµÙÛ Ø§Ø³ØªØ ÛÚ© ارجاع ب٠ÛÚ© ÙØ§ØÛÙ Ù¾ÛÙØ³ØªÙ از ØØ§Ùظ٠با Ø·Ù٠ثابت.
-To do almost any operation on `ArrayBuffer`, we need a view.
+Ø¨Ø±Ø§Û Ø§ÙØ¬Ø§Ù
ØªÙØ±Ûبا ÙØ± عÙ
ÙÛØ§ØªÛ رÙÛ `ArrayBuffer`Ø Ù
ا ب٠ÛÚ© view ÙÛØ§Ø² دارÛÙ
.
-- It can be a `TypedArray`:
- - `Uint8Array`, `Uint16Array`, `Uint32Array` -- for unsigned integers of 8, 16, and 32 bits.
- - `Uint8ClampedArray` -- for 8-bit integers, "clamps" them on assignment.
- - `Int8Array`, `Int16Array`, `Int32Array` -- for signed integer numbers (can be negative).
- - `Float32Array`, `Float64Array` -- for signed floating-point numbers of 32 and 64 bits.
-- Or a `DataView` -- the view that uses methods to specify a format, e.g. `getUint8(offset)`.
+- اÛÙ Ù
ÛâØªÙØ§Ùد ÛÚ© `TypedArray` باشد:
+ - `Uint8Array`, `Uint16Array`, `Uint32Array` -- Ø¨Ø±Ø§Û Ø§Ø¹Ø¯Ø§Ø¯ صØÛØ Ø¨Ø¯Ù٠عÙÙØ§Ù
ت 8 Ù 16 Ù 32 Ø¨ÛØªÛ
+ - `Uint8ClampedArray` -- Ù
ÛâÚ©ÙØ¯ "clamps" Ø¨Ø±Ø§Û Ø§Ø¹Ø¯Ø§Ø¯ صØÛØ 8 Ø¨ÛØªÛØ Ø¢ÙâÙØ§ را
+ - `Int8Array`, `Int16Array`, `Int32Array` -- Ø¨Ø±Ø§Û Ø§Ø¹Ø¯Ø§Ø¯ صØÛØ Ø¹ÙØ§Ù
ØªâØ¯Ø§Ø±(Ù
ÛâØªÙØ§ÙÙØ¯ Ù
ÙÙÛ Ø¨Ø§Ø´ÙØ¯)
+ - `Float32Array`, `Float64Array` -- Ø¨Ø±Ø§Û Ø§Ø¹Ø¯Ø§Ø¯ Ø§Ø¹Ø´Ø§Ø±Û Ø¹ÙØ§Ù
ØªâØ¯Ø§Ø± 32 Ù 64 Ø¨ÛØªÛ
+- ÛØ§ ÛÚ© `DataView` -- ÙÙ
ا٠viewÛÛ Ú©Ù Ø§Ø² Ù
ØªØ¯ÙØ§ Ø¨Ø±Ø§Û Ù
شخص کرد٠ÛÚ© ÙØ±Ù
ت Ø§Ø³ØªÙØ§Ø¯Ù Ù
ÛâÚ©ÙØ¯Ø Ù
اÙÙØ¯ `getUint8(offset)`
-In most cases we create and operate directly on typed arrays, leaving `ArrayBuffer` under cover, as a "common denominator". We can access it as `.buffer` and make another view if needed.
+در Ø¨ÛØ´ØªØ± Ù
ÙØ§Ø±Ø¯Ø Ù
ا Ù
ستÙÛÙ
ا آراÛÙâÙØ§Û typed را Ù
ÛâØ³Ø§Ø²ÛÙ
٠اجرا Ù
ÛâÚ©ÙÛÙ
Ø `ArrayBuffer` را ب٠عÙÙØ§Ù ÛÚ© "Ù
خرج Ù
شترک" تخت Ù¾ÙØ´Ø´ ÙØ±Ø§Ø± Ù
ÛâØ¯ÙÛÙ
. Ù
ÛâØªÙØ§ÙÛÙ
با `buffer.` Ø¨Ù Ø¢Ù Ø¯Ø³ØªØ±Ø³Û Ù¾ÛØ¯Ø§ Ú©ÙÛÙ
٠در ØµÙØ±Øª ÙÛØ§Ø² ÛÚ© view دÛگر Ø§ÛØ¬Ø§Ø¯ Ú©ÙÛÙ
.
-There are also two additional terms, that are used in descriptions of methods that operate on binary data:
-- `ArrayBufferView` is an umbrella term for all these kinds of views.
-- `BufferSource` is an umbrella term for `ArrayBuffer` or `ArrayBufferView`.
+Ø¯Ù Ø§ØµØ·ÙØ§Ø اضاÙÛ ÙÛØ² ÙØ¬Ùد Ø¯Ø§Ø±Ø¯Ø Ú©Ù Ø¨Ø±Ø§Û ØªÙØµÛÙ Ù
ØªØ¯ÙØ§ÛÛ Ú©Ù Ø±ÙÛ Ø¯Ø§Ø¯ÙâÙØ§Û Ø¯ÙØ¯ÙÛÛ Ø¹Ù
ÙÛØ§Øª Ø§ÙØ¬Ø§Ù
Ù
ÛâØ¯ÙÙØ¯ Ø§Ø³ØªÙØ§Ø¯Ù Ù
ÛâØ´ÙÙØ¯:
+- Ø§ØµØ·ÙØ§Ø `ArrayBufferView`Ø Ø§Ø² ÙÙØ¹Û Ø§ØµØ·ÙØ§Ø است Ú©Ù Ø¨Ø±Ø§Û Ù¾ÙØ´Ø´ دستÙâÛ Ú¯Ø³ØªØ±Ø¯ÙâØ§Û Ø§Ø² ÚÛØ²Ùا Ø§Ø³ØªÙØ§Ø¯Ù Ù
ÛâØ´ÙØ¯Ø ک٠در اÛÙ Ù
ÙØ±Ø¯Ø Ø¨Ø±Ø§Û ØªÙ
اÙ
اÙÙØ§Ø¹ viewÙØ§ Ø§Ø³ØªÙØ§Ø¯Ù Ù
ÛâØ´ÙØ¯.
+- Ø§ØµØ·ÙØ§Ø `BufferSource`Ø Ø§Ø² ÙÙØ¹Û Ø§ØµØ·ÙØ§Ø است Ú©Ù Ø¨Ø±Ø§Û Ù¾ÙØ´Ø´ دستÙâÛ Ú¯Ø³ØªØ±Ø¯ÙâØ§Û Ø§Ø² ÚÛØ²Ùا Ø§Ø³ØªÙØ§Ø¯Ù Ù
ÛâØ´ÙØ¯Ø ک٠در اÛÙ Ù
ÙØ±Ø¯Ø Ø¨Ø±Ø§Û `ArrayBuffer` ÛØ§ `ArrayBufferView` Ø§Ø³ØªÙØ§Ø¯Ù Ù
ÛâØ´ÙØ¯.
-We'll see these terms in the next chapters. `BufferSource` is one of the most common terms, as it means "any kind of binary data" -- an `ArrayBuffer` or a view over it.
+اÛÙ Ø§ØµØ·ÙØ§ØØ§Øª را در بخش بعد Ù
Ø´Ø§ÙØ¯Ù Ø®ÙØ§ÙÛÙ
کرد. `BufferSource` ÛÚ©Û Ø§Ø² Ø±Ø§ÛØ¬âترÛÙ Ø§ØµØ·ÙØ§ØØ§Øª Ù
ÛâØ¨Ø§Ø´Ø¯Ø Ú©Ù Ù
عÙÛ Ø¢Ù "ÙØ± ÙÙØ¹ از Ø¯Ø§Ø¯Ù Ø¯ÙØ¯ÙÛÛ" است -- ÛÚ© `ArrayBuffer` ÛØ§ ÛÚ© view رÙÛ Ø¢Ù.
-Here's a cheatsheet:
+در اÛÙØ¬Ø§ ÛÚ© ÚÛØªâØ´ÛØª(برگ٠تÙÙØ¨) دارÛÙ
:
