Skip to content

Commit ee3202c

Browse files
author
Md. Jamal Uddin
authored
Merge pull request #22 from shimulch/Objects
Objects
2 parents 0ca35bd + 653aaa9 commit ee3202c

File tree

10 files changed

+228
-233
lines changed

10 files changed

+228
-233
lines changed
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
importance: 5
1+
গুরুত্বঃ ৫
22

33
---
44

5-
# Hello, object
5+
# হ্যালো, অবজেক্ট
66

7-
Write the code, one line for each action:
8-
9-
1. Create an empty object `user`.
10-
2. Add the property `name` with the value `John`.
11-
3. Add the property `surname` with the value `Smith`.
12-
4. Change the value of the `name` to `Pete`.
13-
5. Remove the property `name` from the object.
7+
নিন্মে বর্ণিত প্রতিটি একশনের জন্য এক একটি লাইনে কোড লিখুনঃ
148

9+
1. `user` নামে একটি খালি অবজেক্ট তৈরি করুন।
10+
2. `name` নামে একটি প্রোপার্টি `John` ভ্যালু সহ সংযুক্ত করুন।
11+
3. `surname` নামে একটি প্রোপার্টি `Smith` ভ্যালু সহ সংযুক্ত করুন।
12+
4. `name` নামের প্রোপার্টির ভ্যালু পরিবর্তন করে `Pete` রাখুন।
13+
5. `name` নামের প্রোপার্টিটি অবজেক্ট থেকে মুছে দিন।

1-js/04-object-basics/01-object/3-is-empty/_js.view/solution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function isEmpty(obj) {
22
for (let key in obj) {
3-
// if the loop has started, there is a property
3+
// যদি লুপ শুরু হয় তাহলে অবজেক্টে প্রোপার্টি আছে
44
return false;
55
}
66
return true;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Just loop over the object and `return false` immediately if there's at least one property.
1+
অবজেক্টের উপর লুপ চালান এবং যদি কোন প্রোপার্টি পাওয়া যায় সাথে সাথে `return false` করুন।
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
importance: 5
1+
গুরুত্বঃ ৫
22

33
---
44

5-
# Check for emptiness
5+
# খালি কিনা পরীক্ষা করুন
66

7-
Write the function `isEmpty(obj)` which returns `true` if the object has no properties, `false` otherwise.
7+
একটি ফাংশন `isEmpty(obj)` লিখুন যেটি `true` রিটার্ন করে যদি অবজেক্টে কোন প্রোপার্টি না থাকে, অন্যথায় `false` রিটার্ন করুন।
88

9-
Should work like that:
9+
কোডটি এভাবে কাজ করা উচিতঃ
1010

1111
```js
1212
let schedule = {};
@@ -17,4 +17,3 @@ schedule["8:30"] = "get up";
1717

1818
alert( isEmpty(schedule) ); // false
1919
```
20-
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
Sure, it works, no problem.
1+
অবশ্যই, কোন সমস্যা ছাড়াই কাজ করে।
22

3-
The `const` only protects the variable itself from changing.
3+
`const` শুধুমাত্র ওই ভেরিয়েবলকে পরিবর্তন থেকে রক্ষা করে।
44

5-
In other words, `user` stores a reference to the object. And it can't be changed. But the content of the object can.
5+
অন্যভাবে বললে, `user` অবজেক্টটির একটি রেফারেন্স সংরক্ষণ করে। এবং রেফারেন্স পরিবর্তন করা যাবে না। কিন্তু অবজেক্টের কন্টেন্ট পরিবর্তন করা যাবে।
66

77
```js run
88
const user = {
99
name: "John"
1010
};
1111

1212
*!*
13-
// works
13+
// কাজ করে
1414
user.name = "Pete";
1515
*/!*
1616

17-
// error
17+
// এরর
1818
user = 123;
1919
```
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
importance: 5
1+
গুরুত্বঃ ৫
22

33
---
44

5-
# Constant objects?
5+
# ধ্রুবক / কন্সটেন্ট অবজেক্ট?
66

7-
Is it possible to change an object declared with `const`? What do you think?
7+
`const` দিয়ে ডিক্লেয়ার করা অবজেক্ট কি পরিবর্তন করা সম্ভব? আপনার কি ধারণা?
88

99
```js
1010
const user = {
1111
name: "John"
1212
};
1313

1414
*!*
15-
// does it work?
15+
// এটা কাজ করে?
1616
user.name = "Pete";
1717
*/!*
1818
```
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
importance: 5
1+
গুরুত্বঃ ৫
22

33
---
44

5-
# Sum object properties
5+
# অবজেক্টের প্রোপার্টিগুলো যোগ করা
66

7-
We have an object storing salaries of our team:
7+
আমাদের অবজেক্টে আমাদের টিমের সবার বেতন রাখা আছেঃ
88

99
```js
1010
let salaries = {
@@ -14,6 +14,6 @@ let salaries = {
1414
}
1515
```
1616

17-
Write the code to sum all salaries and store in the variable `sum`. Should be `390` in the example above.
17+
সব বেতনের যোগফল বের করে `sum` ভেরিয়েবলে রাখার কোড লিখুন। উপরের উদাহরণের যোগফল `390` হওয়া উচিত।
1818

19-
If `salaries` is empty, then the result must be `0`.
19+
যদি `salaries` খালি হয়, তাহলে ফলাফল `0` হতে হবে।

1-js/04-object-basics/01-object/8-multiply-numeric/_js.view/source.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ let menu = {
66

77

88
function multiplyNumeric(obj) {
9-
10-
/* your code */
9+
10+
/* আপনার কোড এখানে লিখুন */
1111

1212
}
1313

1414
multiplyNumeric(menu);
1515

1616
alert( "menu width=" + menu.width + " height=" + menu.height + " title=" + menu.title );
17-
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
importance: 3
1+
গুরুত্বঃ ৩
22

33
---
44

5-
# Multiply numeric properties by 2
5+
# যেসব প্রোপার্টি ভ্যালু একটি সংখ্যা তাদের `2` দিয়ে গুন করুন
66

7-
Create a function `multiplyNumeric(obj)` that multiplies all numeric properties of `obj` by `2`.
7+
একটি ফাংশন `multiplyNumeric(obj)` লিখুন যেটি `obj` এর সব সংখ্যাভিত্তিক/numeric প্রোপার্টিগুলো কে `2` দিয়ে গুন করে।
88

9-
For instance:
9+
উদাহরণস্বরূপঃ
1010

1111
```js
12-
// before the call
12+
// কল করার আগে
1313
let menu = {
1414
width: 200,
1515
height: 300,
@@ -18,16 +18,14 @@ let menu = {
1818

1919
multiplyNumeric(menu);
2020

21-
// after the call
21+
// কল করার পর
2222
menu = {
2323
width: 400,
2424
height: 600,
2525
title: "My menu"
2626
};
2727
```
2828

29-
Please note that `multiplyNumeric` does not need to return anything. It should modify the object in-place.
30-
31-
P.S. Use `typeof` to check for a number here.
32-
29+
মনে রাখবেন `multiplyNumeric` এর কিছুই রিটার্ন করার দরকার নেই। এটা শুধুই অবজেক্টকে ইন-প্লেস পরিবর্তন করবে।
3330

31+
পুনশ্চঃ `typeof` ব্যবহার করে নাম্বার কিনা পরীক্ষা করুন।

0 commit comments

Comments
 (0)