Skip to content

Commit 46b1e52

Browse files
author
Md. Jamal Uddin
authored
Merge pull request #12 from sjsakib/strict-mode
The modern mode, "use strict"
2 parents c3dec35 + 3867f03 commit 46b1e52

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

Diff for: 1-js/02-first-steps/03-strict-mode/article.md

+35-35
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,85 @@
1-
# The modern mode, "use strict"
1+
# আধুনিক মোড, "use strict"
22

3-
For a long time, JavaScript evolved without compatibility issues. New features were added to the language while old functionality didn't change.
3+
অনেক লম্বা সময় ধরে কোন কম্প্যাটিবিলিটি ইস্যু ছাড়াই জাভাস্ক্রিপ্টের পর্যায়ক্রমিক উন্নতি হয়েছে। ভাষাটিতে নতুন নতুন ফিচার যোগ করা হত, পুরনো ফাংশনালিটি বদলাত না।
44

5-
That had the benefit of never breaking existing code. But the downside was that any mistake or an imperfect decision made by JavaScript's creators got stuck in the language forever.
5+
এর একটি সুবিধা ছিল যে, কখনোই পুরনো কোড নস্ট হত না, মানে পুরনো কোডও নতুন জাভাস্ক্রিপ্ট ভার্সনে চলত। তবে অসুবিধা হল জাভাস্ক্রিপ্টের উদ্ভাবকদের করা কোন ভুল বা ত্রুটিপূর্ণ সিদ্ধান্ত চিরতরে ভাষাটিতে থেকে যেত।
66

7-
This was the case until 2009 when ECMAScript 5 (ES5) appeared. It added new features to the language and modified some of the existing ones. To keep the old code working, most such modifications are off by default. You need to explicitly enable them with a special directive: `"use strict"`.
7+
২০০৯ সালে ECMAScript 5 (ES5) আসার আগ পর্যন্ত এভাবেই চলছিল। ES5 ভাষাটিতে নতুন কিছু ফিচার যোগ করার পাশাপাশি পুরনো কিছু ফিচারও পরিবর্তন করে। পুরনো কোড সচল রাখতে এই পরিবর্তনগুলোর বেশিরভাগই ডিফল্টভাবে বন্ধ রাখা হয়। একটি বিশেষ নির্দেশক `"use strict"` ব্যবহার করে এগুলো আলাদাভাবে সক্রিয় করতে হয়।
88

99
## "use strict"
1010

11-
The directive looks like a string: `"use strict"` or `'use strict'`. When it is located at the top of a script, the whole script works the "modern" way.
11+
নির্দেশকটি দেখতে স্ট্রিং এর মত: `"use strict"` অথবা `'use strict'`। যখন কোন স্ক্রিপ্টের সবার উপরে এটা থাকে, পুরো স্ক্রিপ্টটি 'আধুনিকভাবে' কাজ করে।
1212

13-
For example:
13+
উদাহরণ:
1414

1515
```js
1616
"use strict";
1717

18-
// this code works the modern way
18+
// এই কোডটি আধুনিকভাবে কাজ করবে
1919
...
2020
```
2121

22-
We will learn functions (a way to group commands) soon. Looking ahead, let's note that `"use strict"` can be put at the beginning of the function body instead of the whole script. Doing that enables strict mode in that function only. But usually, people use it for the whole script.
22+
শিঘ্রই আমরা ফাংশন (কমান্ড গ্রুপ করার একটি উপায়) শিখব। একটু এগিয়ে গিয়ে নোট করে নেয়া যাক, `"use strict"` কোন ফাংশনের বডির শুরুতেও দেয়া যায়। এতে করে শুধু ঐ ফাংশনে স্ট্রিক্ট মোড সক্রিয় হয়। তবে সাধারণত পুরো স্ক্রিপ্টের জন্যই স্ট্রিক্ট মোড ব্যবহার করা হয়।
2323

2424

25-
````warn header="Ensure that \"use strict\" is at the top"
26-
Please make sure that `"use strict"` is at the top of your scripts, otherwise strict mode may not be enabled.
25+
````warn header="\"use strict\" সবার শুরুতে থাকতে হবে"
26+
নিশ্চিত করুন যেন `"use strict"` আপনার স্ক্রিপ্টগুলোর একেবারে সবার উপরে থাকে। নাহলে স্ট্রিক্ট মোড নাও সক্রিয় হতে পারে।
2727
28-
Strict mode isn't enabled here:
28+
এখানে স্ট্রিক্ট মোড সক্রিয় হয়নি:
2929
3030
```js no-strict
3131
alert("some code");
32-
// "use strict" below is ignored--it must be at the top
32+
// নিচের "use strict" উপেক্ষা করা হবে--এটি সবার উপরে থাকতে হবে
3333
3434
"use strict";
3535
36-
// strict mode is not activated
36+
// স্ট্রিক্ট মোড সক্রিয় হয়নি
3737
```
3838
39-
Only comments may appear above `"use strict"`.
39+
`"use strict"` এর উপরে শুধুমাত্র কমেন্ট থাকতে পারবে।
4040
````
4141

42-
```warn header="There's no way to cancel `use strict`"
43-
There is no directive like `"no use strict"` that reverts the engine to old behavior.
42+
```warn header="`use strict` বাতিল করার কোন উপায় নেই"
43+
`"no use strict"`-র মত কোন নির্দেশক নেই যা ইন্জিনটিকে পুরনো চরিত্রে ফিরিয়ে নেবে।
4444

45-
Once we enter strict mode, there's no return.
45+
একবার স্ট্রিক্ট মোডে ঢুকে গেলে আর ফিরে যাওয়ার কোন সুযোগ থাকে না।
4646
```
4747
48-
## Browser console
48+
## ব্রাউজার কনসোল
4949
50-
For the future, when you use a browser console to test features, please note that it doesn't `use strict` by default.
50+
ভবিষ্যতে আপনি যখন ব্রাউজার কনসোলে কোন ফিচার পরীক্ষা করতে যাবেন, মনে রাখবেন ডিফল্টভাবে সেটা স্ট্রিক্ট মোডে থাকে না।
5151
52-
Sometimes, when `use strict` makes a difference, you'll get incorrect results.
52+
কখনো কখনো যখন `use strict`-এ পার্থক্য হয়, আপনি ভুল ফলাফল পাবেন।
5353
54-
You can try to press `key:Shift+Enter` to input multiple lines, and put `use strict` on top, like this:
54+
একাধিক লাইন দেয়ার জন্য `key:Shift+Enter` চেপে সবার উপরে `use strict` দিয়ে দেখতে পারেন, এভাবে:
5555
5656
```js
57-
'use strict'; <Shift+Enter for a newline>
58-
// ...your code
59-
<Enter to run>
57+
'use strict'; <নতুন লাইনের জন্য Shift+Enter>
58+
// ...আপনার কোড
59+
<চালানোর জন্য Enter>
6060
```
6161

62-
It works in most browsers, namely Firefox and Chrome.
62+
বেশিরভাগ ব্রাউজার যেমন ক্রোম, ফায়ারফক্সে এটা কাজ করে।
6363

64-
If it doesn't, the most reliable way to ensure `use strict` would be to input the code into console like this:
64+
যদি কাজ না করে তাহলে `use strict` নিশ্চিত করার সবচেয়ে নির্ভরযোগ্য উপায় হল কোডটাকে কনসোলে এভাবে ইনপুট দেয়া:
6565

6666
```js
6767
(function() {
6868
'use strict';
6969

70-
// ...your code...
70+
// ...আপনার কোড...
7171
})()
7272
```
7373

74-
## Always "use strict"
74+
## সবসময় "use strict" করুন
7575

76-
We have yet to cover the differences between strict mode and the "default" mode.
76+
আমাদের এখনো স্ট্রিক্ট মোড আর "ডিফল্ট" মোডের পার্থক্য আলোচনা করা বাকি রয়ে গেছে।
7777

78-
In the next chapters, as we learn language features, we'll note the differences between the strict and default modes. Luckily, there aren't many and they actually make our lives better.
78+
পরবর্তী অধ্যাগুলোতে যখন আমরা ভাষার ফিচারগুলো শিখব তখন স্ট্রিক্ট মোড আর ডিফল্ট মোডের পার্থক্যগুলো দেখতে পাব। সৌভাগ্যবশত খুব বেশি পার্থক্য নেই। আর যা আছে সেগুলো আসলে আমাদের জীবন সুন্দর করে।
7979

80-
For now, it's enough to know about it in general:
80+
আপাতত এ ব্যাপারে সাধাণভাবে জানা যথেষ্ট:
8181

82-
1. The `"use strict"` directive switches the engine to the "modern" mode, changing the behavior of some built-in features. We'll see the details later in the tutorial.
83-
2. Strict mode is enabled by placing `"use strict"` at the top of a script or function. Several language features, like "classes" and "modules", enable strict mode automatically.
84-
3. Strict mode is supported by all modern browsers.
85-
4. We recommended always starting scripts with `"use strict"`. All examples in this tutorial assume strict mode unless (very rarely) specified otherwise.
82+
১. `"use strict"` নির্দেশকটি বিল্ট-ইন ফিচারগুলোর চরিত্র বদলে ইন্জিনকে "আধুনিক" মোডে নিয়ে যায়। পরবর্তীতে আমরা এর বিস্তারিত দেখব।
83+
২. একটি স্ক্রিপ্ট কিংবা ফাংশনের সবার উপরে `"use strict"` দিয়ে স্ট্রিক্ট মোড সক্রিয় করা যায়। ভাষার কিছু ফিচার, যেমন "classes" এবং "modules" স্বয়ংক্রিয়ভাবে স্ট্রিক্ট মোড সক্রিয় করে।
84+
৩. সব মর্ডান ব্রাউজারই স্ট্রিক্ট মোড সমর্থন করে।
85+
৪. আমরা পরামর্শ দিয়েছি সব সময় `"use strict"` দিয়ে স্ক্রিপ্ট শুরু করতে। এই টিউটোরিয়ালের সকল উদাহরণ ধরে নেয় যে স্ট্রিক্ট মোড চালু আছে, যদিনা অন্যথা (খুবই বিরল) উল্লেখ করে দেয়া থাকে।

0 commit comments

Comments
 (0)