◐ Shell
clean mode source ↗

Objects by mahdiHash · Pull Request #118 · javascript-tutorial/fa.javascript.info

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Objects #118

Changes from all commits

Commits

Show all changes

25 commits

Select commit Hold shift + click to select a range

f326cb3

Translate a part of atricle

mahdiHash Apr 30, 2021

d9acc43

Translate a part of "article.md"

mahdiHash Apr 30, 2021

4fdac06

Translate a comment

mahdiHash Apr 30, 2021

7ddbe6a

Translate a part of "article.md" and change lines 23 & 10

mahdiHash May 1, 2021

3c28819

Translate a part of "article.md" and change some lines

mahdiHash May 1, 2021

9f4d811

Translate a part of "atricle.md" and code comments

mahdiHash May 2, 2021

4886902

Translate a part of "article.md", change a line, fix a typo

mahdiHash May 2, 2021

b389496

Change a title

mahdiHash May 2, 2021

274eca9

Translate a part of "atricle.md"

mahdiHash May 3, 2021

fc5f40e

Update article.md

mahdiHash May 3, 2021

0d8a1fb

Update article.md

mahdiHash May 3, 2021

f9196be

Translate a part of "article.md"

mahdiHash May 3, 2021

b584161

Translate a part of "article.md" , change some lines

mahdiHash May 3, 2021

d45edce

Translate "article.md"

mahdiHash May 3, 2021

fe6c9a8

Change "key" to "کلید"

mahdiHash May 4, 2021

164e8d7

Change some lines

mahdiHash May 4, 2021

a6fcdc6

Change "key" to "کلید"

mahdiHash May 4, 2021

29d1a9d

Translate the "hello-object" task

mahdiHash May 4, 2021

e3abee1

Translate the "is-empty" task

mahdiHash May 4, 2021

38627f0

Translate "is-empty" solution

mahdiHash May 4, 2021

00be958

Translate "sum-object" task

mahdiHash May 4, 2021

4dfdd67

Translate "multiply-numeric" task

mahdiHash May 4, 2021

82f5919

Translate "multiply-numeric" solution

mahdiHash May 4, 2021

8451d07

Fix some problems

mahdiHash May 4, 2021

fb37baf

Fix a line

mahdiHash May 4, 2021

File filter

Filter by extension

Conversations

Failed to load comments.

Loading

Jump to

Jump to file

Failed to load files.

Loading

Diff view
Diff view

14 changes: 7 additions & 7 deletions 1-js/04-object-basics/01-object/2-hello-object/task.md

Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ importance: 5

---

# Hello, object
# سلام شیء

Write the code, one line for each action:
کد را بنویسید، هر خط کد برای یک عمل:

1. Create an empty object `user`.
2. Add the property `name` with the value `John`.
3. Add the property `surname` with the value `Smith`.
4. Change the value of the `name` to `Pete`.
5. Remove the property `name` from the object.
1. یک شیء خالی `user` بسازید.
2. ویژگی `name` را با مقدار `John` به آن اضافه کنید.
3. ویژگی `surname` را با مقدار `Smith` به آن اضافه کنید.
4. مقدار `name` را به `Pete` تغییر دهید.
5. ویژگی `name` را از شیء حذف کنید.

2 changes: 1 addition & 1 deletion 1-js/04-object-basics/01-object/3-is-empty/solution.md

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Just loop over the object and `return false` immediately if there's at least one property.
فقط درون شیء حلقه بزنید تا اگر حداقل یک ویژگی وجود داشته باشد `return false` را انجام دهد.

```js
function isEmpty(obj) {
Expand Down

6 changes: 3 additions & 3 deletions 1-js/04-object-basics/01-object/3-is-empty/task.md

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ importance: 5

---

# Check for emptiness
# بررسی خالی بودن

Write the function `isEmpty(obj)` which returns `true` if the object has no properties, `false` otherwise.
تابع `isEmpty(obj)` را بنویسید که اگر شیء هیچ ویژگی‌ای نداشته `true` را برمی‌گرداند، در غیر این صورت `false` را.

Should work like that:
باید مانند این کد عمل کند:

```js
let schedule = {};
Expand Down

8 changes: 4 additions & 4 deletions 1-js/04-object-basics/01-object/5-sum-object/task.md

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ importance: 5

---

# Sum object properties
# ویژگی‌های شیء را جمع بزنید

We have an object storing salaries of our team:
ما یک شیء داریم که دستمزد تیم‌مان را ذخیره می‌کند:

```js
let salaries = {
Expand All @@ -14,6 +14,6 @@ let salaries = {
}
```

Write the code to sum all salaries and store in the variable `sum`. Should be `390` in the example above.
کدی بنویسید که تمام دستمزدها را جمع می‌کند و نتیجه را درون متغیر `sum` ذخیره می‌کند. برای مثال بالا نتیجه باید `390` باشد.

If `salaries` is empty, then the result must be `0`.
اگر `salaries` خالی بود، نتیجه باید `0` باشد.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
``` js run

// before the call
// قبل از صدا زدن
let menu = {
width: 200,
height: 300,
Expand Down

14 changes: 7 additions & 7 deletions 1-js/04-object-basics/01-object/8-multiply-numeric/task.md

Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ importance: 3

---

# Multiply numeric property values by 2
# مقدارهای عددیِ ویژگی‌ها را در 2 ضرب کنید

Create a function `multiplyNumeric(obj)` that multiplies all numeric property values of `obj` by `2`.
یک تابع `multiplyNumeric(obj)` بسازید که تمام مقدارهای عددیِ ویژگی‌های `obj` را در `2` ضرب می‌کند.

For instance:
برای مثال:

```js
// before the call
// قبل از صدا زدن
let menu = {
width: 200,
height: 300,
Expand All @@ -18,16 +18,16 @@ let menu = {

multiplyNumeric(menu);

// after the call
// بعد از صدا زدن
menu = {
width: 400,
height: 600,
title: "My menu"
};
```

Please note that `multiplyNumeric` does not need to return anything. It should modify the object in-place.
لطفا در نظر داشته باشید که لازم نیست `multiplyNumeric` چیزی را برگرداند. بلکه باید شیء را در محل تغییر دهد.

P.S. Use `typeof` to check for a number here.
پی نوشت: اینجا از `typeof` برای بررسی عدد بودن استفاده کنید.