◐ Shell
clean mode source ↗

Constructor, operator "new" by mahdiHash · Pull Request #98 · javascript-tutorial/fa.javascript.info

```js
let user = new User; // <-- no parentheses
// same as
let user = new User; // <-- بدون پرانتر

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo:
پرانتز

@@ -1,17 +1,17 @@
# Constructor, operator "new"
# سازنده ، اپراتور "new"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spacing for commas should be like this as you have already observed everywhere else:
سازنده، اپراتور
instead of:
سازنده ، اپراتور‍

```

Now if we want to create other users, we can call `new User("Ann")`, `new User("Alice")` and so on. Much shorter than using literals every time, and also easy to read.
حالا اگر ما بخواهیم که user های دیگری بسازیم، می توانیم `new User("Ann")` ، `new User("Alice")` و ... را صدا بزنیم. این کار بسیار کوتاه تر از استفاده همیشگی از literal ها است، و همچنین برای خواندن آسان است.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spacing for commas should be like this as you have already observed everywhere else:
سازنده، اپراتور
instead of:
سازنده ، اپراتور‍


```smart header="Objects, we'll be back!"
In this chapter we only cover the basics about objects and constructors. They are essential for learning more about data types and functions in the next chapters.
```smart header="شیءها ، ما بر می گردیم!"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spacing for commas should be like this as you have already observed everywhere else:
سازنده، اپراتور
instead of:
سازنده ، اپراتور‍

@@ -1,17 +1,17 @@
# Constructor, operator "new"
# سازنده ، اپراتور "new"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also using ‍‍عملگر instead of اپراتور would be better.

// maybe complex logic and statements
// local variables etc
// ... کد های دیگر برای ساخت user
// شاید شامل منطق و دستورالعمل عجیبی باشد

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Complex" doesn't mean عجیب. Perhaps using پیچیده would be a better idea.

```

Omitting parentheses here is not considered a "good style", but the syntax is permitted by specification.
اینجا پنهان کردن پرانتزها به عنوان یک "سبک خوب" فرض نمی شود، اما سینتکس طبق خصوصیات مجاز است.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Omitting" doesn't mean پنهان کردن. Perhaps using حذف کردن would be a better idea.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review🙏🏻