Skip to content

Commit 826d1a7

Browse files
authored
Translate a part of article
Line 269 needs more attention
1 parent a075dbb commit 826d1a7

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

  • 1-js/07-object-properties/01-property-descriptors

1-js/07-object-properties/01-property-descriptors/article.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,13 @@ for (let key in user) alert(key); // name
190190
alert(Object.keys(user)); // name
191191
```
192192

193-
## Non-configurable
193+
## غیر قابل تنظیم
194194

195-
The non-configurable flag (`configurable:false`) is sometimes preset for built-in objects and properties.
195+
پرچم غیر قابل تنظیم (`configurable:false`) بعضی اوقات برای شیءها و ویژگی‌های درون‌ساخت ارائه می‌شود.
196196

197-
A non-configurable property can't be deleted, its attributes can't be modified.
197+
یک ویژگی غیر قابل تنظیم نمی‌تواند حذف شود و صفت‌های آن نمی‌توانند تغییر کنند.
198198

199-
For instance, `Math.PI` is non-writable, non-enumerable and non-configurable:
199+
برای مثال، `Math.PI` غیر قابل نوشتن، غیر قابل شمارش و غیر قابل تنظیم است:
200200

201201
```js run
202202
let descriptor = Object.getOwnPropertyDescriptor(Math, 'PI');
@@ -211,28 +211,28 @@ alert( JSON.stringify(descriptor, null, 2 ) );
211211
}
212212
*/
213213
```
214-
So, a programmer is unable to change the value of `Math.PI` or overwrite it.
214+
پس یک برنامه‌نویس نمی‌تواند مقدار `Math.PI` را تغییر دهد یا آن را دوباره بنویسد.
215215

216216
```js run
217-
Math.PI = 3; // Error, because it has writable: false
217+
Math.PI = 3; // writable: false ارور، چون
218218

219-
// delete Math.PI won't work either
219+
// هم کار نمی‌کند Math.PI حذف
220220
```
221221

222-
We also can't change `Math.PI` to be `writable` again:
222+
همچنین ما نمی‌توانیم `Math.PI` را تغییر دهیم تا دوباره `writable`(قابل نوشتن) باشد:
223223

224224
```js run
225-
// Error, because of configurable: false
225+
// configurable: false ارور، چون
226226
Object.defineProperty(Math, "PI", { writable: true });
227227
```
228228

229-
There's absolutely nothing we can do with `Math.PI`.
229+
هیچ کاری نمی‌توانیم با `Math.PI` انجام دهیم.
230230

231-
Making a property non-configurable is a one-way road. We cannot change it back with `defineProperty`.
231+
غیر قابل تنظیم کردن یک ویژگی راهی یک‌طرفه است. ما نمی‌توانیم آن را با `defineProperty` دوباره تغییر دهیم.
232232

233-
**Please note: `configurable: false` prevents changes of property flags and its deletion, while allowing to change its value.**
233+
**لطفا در نظر داشته باشید: `configurable: false` از تغییرات پرچم‌های ویژگی و حذف آن جلوگیری می‌کند در حالی که تغییر مقدار آن مجاز است.**
234234

235-
Here `user.name` is non-configurable, but we can still change it (as it's writable):
235+
اینجا `user.name` غیر قابل تنظیم است اما همچنان می‌توانیم آن را تغییر دهیم (چون قابل نوشتن است):
236236

237237
```js run
238238
let user = {
@@ -243,11 +243,11 @@ Object.defineProperty(user, "name", {
243243
configurable: false
244244
});
245245

246-
user.name = "Pete"; // works fine
247-
delete user.name; // Error
246+
user.name = "Pete"; // به درستی کار می‌کند
247+
delete user.name; // ارور
248248
```
249249

250-
And here we make `user.name` a "forever sealed" constant, just like the built-in `Math.PI`:
250+
و اینجا ما کاری می‌کنیم که `user.name` برای همیشه «مهر و موم شده» بماند، درست مانند `Math.PI` درون‌ساخت:
251251

252252
```js run
253253
let user = {
@@ -259,17 +259,17 @@ Object.defineProperty(user, "name", {
259259
configurable: false
260260
});
261261

262-
// won't be able to change user.name or its flags
263-
// all this won't work:
262+
// یا پرچم‌های آن را تغییر دهیم user.name نمی‌توانیم
263+
// :هیچ کدام این‌ها کار نخواهند کرد
264264
user.name = "Pete";
265265
delete user.name;
266266
Object.defineProperty(user, "name", { value: "Pete" });
267267
```
268268

269-
```smart header="The only attribute change possible: writable true -> false"
270-
There's a minor exception about changing flags.
269+
```smart header="تنها تغییر ممکن روی صفت: writable true -> false"
270+
یک استثنای کوچک درباره تغییر پرچم‌ها وجود دارد.
271271
272-
We can change `writable: true` to `false` for a non-configurable property, thus preventing its value modification (to add another layer of protection). Not the other way around though.
272+
ما می‌توانیم برای یک ویژگی غیر قابل تنظیم `writable: true` را به `false` تغییر دهیم و به این ترتیب از تغییر مقدار آن جلوگیری کنیم (تا لایه‌ای دیگر از حفاظت را اضافه کنیم). اما برعکس آن ممکن نیست.
273273
```
274274

275275
## Object.defineProperties

0 commit comments

Comments
 (0)