File tree Expand file tree Collapse file tree 10 files changed +228
-233
lines changed
1-js/04-object-basics/01-object Expand file tree Collapse file tree 10 files changed +228
-233
lines changed Original file line number Diff line number Diff line change 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 ` নামের প্রোপার্টিটি অবজেক্ট থেকে মুছে দিন।
Original file line number Diff line number Diff line change 11function 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 ;
Original file line number Diff line number Diff line change 1- Just loop over the object and ` return false ` immediately if there's at least one property.
1+ অবজেক্টের উপর লুপ চালান এবং যদি কোন প্রোপার্টি পাওয়া যায় সাথে সাথে ` return false ` করুন।
Original file line number Diff line number Diff line change 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
1212let schedule = {};
@@ -17,4 +17,3 @@ schedule["8:30"] = "get up";
1717
1818alert ( isEmpty (schedule) ); // false
1919```
20-
Original file line number Diff line number Diff line change 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
88const user = {
99 name: " John"
1010};
1111
1212* ! *
13- // works
13+ // কাজ করে
1414user .name = " Pete" ;
1515*/ ! *
1616
17- // error
17+ // এরর
1818user = 123 ;
1919```
Original file line number Diff line number Diff line change 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
1010const user = {
1111 name: " John"
1212};
1313
1414* ! *
15- // does it work ?
15+ // এটা কাজ করে ?
1616user .name = " Pete" ;
1717*/ ! *
1818```
Original file line number Diff line number Diff line change 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
1010let 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 ` হতে হবে।
Original file line number Diff line number Diff line change @@ -6,12 +6,11 @@ let menu = {
66
77
88function multiplyNumeric ( obj ) {
9-
10- /* your code */
9+
10+ /* আপনার কোড এখানে লিখুন */
1111
1212}
1313
1414multiplyNumeric ( menu ) ;
1515
1616alert ( "menu width=" + menu . width + " height=" + menu . height + " title=" + menu . title ) ;
17-
Original file line number Diff line number Diff line change 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+ // কল করার আগে
1313let menu = {
1414 width: 200 ,
1515 height: 300 ,
@@ -18,16 +18,14 @@ let menu = {
1818
1919multiplyNumeric (menu);
2020
21- // after the call
21+ // কল করার পর
2222menu = {
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 ` ব্যবহার করে নাম্বার কিনা পরীক্ষা করুন।
You can’t perform that action at this time.
0 commit comments