Skip to content

Commit f61b6ba

Browse files
authored
Merge branch 'master' into regexp-multiline-mode
2 parents b95dd9b + ae9823e commit f61b6ba

File tree

607 files changed

+8505
-6085
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

607 files changed

+8505
-6085
lines changed

Diff for: 1-js/01-getting-started/1-intro/article.md

+44-17
Large diffs are not rendered by default.

Diff for: 1-js/01-getting-started/1-intro/limitations.svg

+1-1
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<body>
5+
6+
<script>
7+
alert( "I'm JavaScript!" );
8+
</script>
9+
10+
</body>
11+
12+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
[html src="index.html"]

Diff for: 1-js/02-first-steps/01-hello-world/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
আমরা পুরো URL টিও দিতে পারি। উদাহরণস্বরূপ:
7979

8080
```html
81-
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.2.0/lodash.js"></script>
81+
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.js"></script>
8282
```
8383

8484
একাধিক ট্যাগ ব্যবহার করে, একাধিক স্ক্রিপ্টগুলো সংযুক্ত করতে পারিঃ

Diff for: 1-js/02-first-steps/02-structure/article.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ alert("একটি এরর তৈরি হবে")[1, 2].forEach(alert)
9494

9595
আমরা স্টেটমেন্টের শেষে সেমিকোলন দিতে পরামর্শ দেই, এমনকি যদি স্টেটমেন্টগুলো আলাদা লাইনেও হয়ে থাকে। এই রুলটি কমিউনিটিতে ব্যাপকভাবে গ্রহণ করা হয়েছে। আরও একবার এভাবে বলা যায় -- অধিকাংশ সময় সেমিকোলন ঊহ্য রাখা **সম্ভব**। কিন্তু এটি ব্যবহার করা নিরাপদ -- বিশেষ করে শিক্ষানবিশ/অনভিজ্ঞদের জন্য।
9696

97-
## কমেন্ট/মন্তব্য
97+
## কমেন্ট/মন্তব্য [#code-comments]
9898

9999
সময়ের সাথে সাথে প্রোগ্রামগুলো অধিক থেকে অধিকতর জটিল হতে থাকে। *কমেন্ট/মন্তব্য* লিখার মাধ্যমে কোড কি কাজ করে এবং কেন করে তা প্রয়োজনীয় হয়ে দাঁড়ায়।
100100

@@ -135,7 +135,7 @@ alert('হ্যালো');
135135
alert('ওয়ার্ল্ড');
136136
```
137137

138-
```smart header="হট-কী ব্যবহার করুন"
138+
```smart header="Use hotkeys!"
139139
অধিকাংশ এডিটরে, কোডের কোন অংশ কমেন্ট করতে, এক লাইনের কমেন্টের জন্য `key:Ctrl+/` হট-কী এবং একাধিক লাইনের কমেন্টের জন্য `key:Ctrl+Shift+/` হট-কী ব্যবহার করা হয় (কোডের অংশটি সিলেক্ট করে হট-কী প্রেস করা হয়)। ম্যাকের জন্য `key:Ctrl` এর পরিবর্তে `key:Cmd` ব্যবহার করে চেষ্টা করে দেখুন।
140140
```
141141

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

+40
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@
1919
...
2020
```
2121

22+
<<<<<<< HEAD
2223
শিঘ্রই আমরা ফাংশন (কমান্ড গ্রুপ করার একটি উপায়) শিখব। একটু এগিয়ে গিয়ে নোট করে নেয়া যাক, `"use strict"` কোন ফাংশনের বডির শুরুতেও দেয়া যায়। এতে করে শুধু ঐ ফাংশনে স্ট্রিক্ট মোড সক্রিয় হয়। তবে সাধারণত পুরো স্ক্রিপ্টের জন্যই স্ট্রিক্ট মোড ব্যবহার করা হয়।
2324

25+
=======
26+
Quite soon we're going to learn functions (a way to group commands), so let's note in advance that `"use strict"` can be put at the beginning of a function. Doing that enables strict mode in that function only. But usually people use it for the whole script.
27+
>>>>>>> d6e88647b42992f204f57401160ebae92b358c0d
2428
2529
````warn header="\"use strict\" সবার শুরুতে থাকতে হবে"
2630
নিশ্চিত করুন যেন `"use strict"` আপনার স্ক্রিপ্টগুলোর একেবারে সবার উপরে থাকে। নাহলে স্ট্রিক্ট মোড নাও সক্রিয় হতে পারে।
@@ -47,11 +51,21 @@ alert("some code");
4751
4852
## ব্রাউজার কনসোল
4953
54+
<<<<<<< HEAD
5055
ভবিষ্যতে আপনি যখন ব্রাউজার কনসোলে কোন ফিচার পরীক্ষা করতে যাবেন, মনে রাখবেন ডিফল্টভাবে সেটা স্ট্রিক্ট মোডে থাকে না।
56+
=======
57+
When you use a [developer console](info:devtools) to run code, please note that it doesn't `use strict` by default.
58+
>>>>>>> d6e88647b42992f204f57401160ebae92b358c0d
5159
5260
কখনো কখনো যখন `use strict`-এ পার্থক্য হয়, আপনি ভুল ফলাফল পাবেন।
5361
62+
<<<<<<< HEAD
5463
একাধিক লাইন দেয়ার জন্য `key:Shift+Enter` চেপে সবার উপরে `use strict` দিয়ে দেখতে পারেন, এভাবে:
64+
=======
65+
So, how to actually `use strict` in the console?
66+
67+
First, you can try to press `key:Shift+Enter` to input multiple lines, and put `use strict` on top, like this:
68+
>>>>>>> d6e88647b42992f204f57401160ebae92b358c0d
5569
5670
```js
5771
'use strict'; <নতুন লাইনের জন্য Shift+Enter>
@@ -61,12 +75,17 @@ alert("some code");
6175

6276
বেশিরভাগ ব্রাউজার যেমন ক্রোম, ফায়ারফক্সে এটা কাজ করে।
6377

78+
<<<<<<< HEAD
6479
যদি কাজ না করে তাহলে `use strict` নিশ্চিত করার সবচেয়ে নির্ভরযোগ্য উপায় হল কোডটাকে কনসোলে এভাবে ইনপুট দেয়া:
80+
=======
81+
If it doesn't, e.g. in an old browser, there's an ugly, but reliable way to ensure `use strict`. Put it inside this kind of wrapper:
82+
>>>>>>> d6e88647b42992f204f57401160ebae92b358c0d
6583
6684
```js
6785
(function() {
6886
'use strict';
6987

88+
<<<<<<< HEAD
7089
// ...আপনার কোড...
7190
})()
7291
```
@@ -83,3 +102,24 @@ alert("some code");
83102
২. একটি স্ক্রিপ্ট কিংবা ফাংশনের সবার উপরে `"use strict"` দিয়ে স্ট্রিক্ট মোড সক্রিয় করা যায়। ভাষার কিছু ফিচার, যেমন "classes" এবং "modules" স্বয়ংক্রিয়ভাবে স্ট্রিক্ট মোড সক্রিয় করে।
84103
৩. সব মর্ডান ব্রাউজারই স্ট্রিক্ট মোড সমর্থন করে।
85104
৪. আমরা পরামর্শ দিয়েছি সব সময় `"use strict"` দিয়ে স্ক্রিপ্ট শুরু করতে। এই টিউটোরিয়ালের সকল উদাহরণ ধরে নেয় যে স্ট্রিক্ট মোড চালু আছে, যদিনা অন্যথা (খুবই বিরল) উল্লেখ করে দেয়া থাকে।
105+
=======
106+
// ...your code here...
107+
})()
108+
```
109+
110+
## Should we "use strict"?
111+
112+
The question may sound obvious, but it's not so.
113+
114+
One could recommend to start scripts with `"use strict"`... But you know what's cool?
115+
116+
Modern JavaScript supports "classes" and "modules" - advanced language structures (we'll surely get to them), that enable `use strict` automatically. So we don't need to add the `"use strict"` directive, if we use them.
117+
118+
**So, for now `"use strict";` is a welcome guest at the top of your scripts. Later, when your code is all in classes and modules, you may omit it.**
119+
120+
As of now, we've got to know about `use strict` in general.
121+
122+
In the next chapters, as we learn language features, we'll see the differences between the strict and old modes. Luckily, there aren't many and they actually make our lives better.
123+
124+
All examples in this tutorial assume strict mode unless (very rarely) specified otherwise.
125+
>>>>>>> d6e88647b42992f204f57401160ebae92b358c0d

Diff for: 1-js/02-first-steps/04-variables/article.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ let user = 'John'
8080

8181
Technically, all these variants do the same thing. So, it's a matter of personal taste and aesthetics.
8282

83-
8483
````smart header="`var` instead of `let`"
8584
In older scripts, you may also find another keyword: `var` instead of `let`:
8685

@@ -135,6 +134,20 @@ alert(hello); // Hello world!
135134
alert(message); // Hello world!
136135
```
137136
137+
````warn header="Declaring twice triggers an error"
138+
A variable should be declared only once.
139+
140+
A repeated declaration of the same variable is an error:
141+
142+
```js run
143+
let message = "This";
144+
145+
// repeated 'let' leads to an error
146+
let message = "That"; // SyntaxError: 'message' has already been declared
147+
```
148+
So, we should declare a variable once and then refer to it without `let`.
149+
````
150+
138151
```smart header="Functional languages"
139152
It's interesting to note that there exist [functional](https://en.wikipedia.org/wiki/Functional_programming) programming languages, like [Scala](http://www.scala-lang.org/) or [Erlang](http://www.erlang.org/) that forbid changing variable values.
140153
@@ -190,7 +203,7 @@ let имя = '...';
190203
let 我 = '...';
191204
```
192205
193-
Technically, there is no error here, such names are allowed, but there is an international tradition to use English in variable names. Even if we're writing a small script, it may have a long life ahead. People from other countries may need to read it some time.
206+
Technically, there is no error here. Such names are allowed, but there is an international convention to use English in variable names. Even if we're writing a small script, it may have a long life ahead. People from other countries may need to read it some time.
194207
````
195208

196209
````warn header="Reserved names"

Diff for: 1-js/02-first-steps/04-variables/variable-change.svg

+1-1
Loading

0 commit comments

Comments
 (0)