You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/02-structure/article.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -94,7 +94,7 @@ alert("একটি এরর তৈরি হবে")[1, 2].forEach(alert)
94
94
95
95
আমরা স্টেটমেন্টের শেষে সেমিকোলন দিতে পরামর্শ দেই, এমনকি যদি স্টেটমেন্টগুলো আলাদা লাইনেও হয়ে থাকে। এই রুলটি কমিউনিটিতে ব্যাপকভাবে গ্রহণ করা হয়েছে। আরও একবার এভাবে বলা যায় -- অধিকাংশ সময় সেমিকোলন ঊহ্য রাখা **সম্ভব**। কিন্তু এটি ব্যবহার করা নিরাপদ -- বিশেষ করে শিক্ষানবিশ/অনভিজ্ঞদের জন্য।
96
96
97
-
## কমেন্ট/মন্তব্য
97
+
## কমেন্ট/মন্তব্য[#code-comments]
98
98
99
99
সময়ের সাথে সাথে প্রোগ্রামগুলো অধিক থেকে অধিকতর জটিল হতে থাকে। *কমেন্ট/মন্তব্য* লিখার মাধ্যমে কোড কি কাজ করে এবং কেন করে তা প্রয়োজনীয় হয়ে দাঁড়ায়।
100
100
@@ -135,7 +135,7 @@ alert('হ্যালো');
135
135
alert('ওয়ার্ল্ড');
136
136
```
137
137
138
-
```smart header="হট-কী ব্যবহার করুন"
138
+
```smart header="Use hotkeys!"
139
139
অধিকাংশ এডিটরে, কোডের কোন অংশ কমেন্ট করতে, এক লাইনের কমেন্টের জন্য `key:Ctrl+/` হট-কী এবং একাধিক লাইনের কমেন্টের জন্য `key:Ctrl+Shift+/` হট-কী ব্যবহার করা হয় (কোডের অংশটি সিলেক্ট করে হট-কী প্রেস করা হয়)। ম্যাকের জন্য `key:Ctrl` এর পরিবর্তে `key:Cmd` ব্যবহার করে চেষ্টা করে দেখুন।
|`string`| স্ট্রিংয়ের শুরু ও শেষের স্পেস থেকে তা মুছে ফেলা হয়। বাকিটা ফাঁকা স্ট্রিং হলে, তা `0` হবে। নাহয় নাম্বারগুলি স্ট্রিং থেকে নেয়া হয়। এরর হলে `NaN` আসে। |
|`string`| স্ট্রিংয়ের শুরু ও শেষের স্পেস থেকে তা মুছে ফেলা হয়। বাকিটা ফাঁকা স্ট্রিং হলে, তা `0` হবে। নাহয় নাম্বারগুলি স্ট্রিং থেকে নেয়া হয়। এরর হলে `NaN` আসে। |
72
72
73
73
Examples:
74
74
@@ -81,18 +81,7 @@ alert( Number(false) ); // 0
81
81
82
82
এখানে জেনে রাখি `null` ও `undefined` এক্ষেত্রে ভিন্ন আচরণ করে: `null` হয়ে যাবে শূন্য আর `undefined` হবে `NaN`.
প্রায় সব গানিতিক অপারেটর ভ্যালুকে সংখ্যায় রূপান্তর করে নেয়। তবে উল্লেখযোগ্য একটি ব্যতিক্রম হলো যোগ `+`, যদি এর দুপাশের একটি ভ্যালুও স্ট্রিং হয় তবে অপরটিও স্ট্রিং হয়ে যাবে
86
-
87
-
তখন এটি স্ট্রিংগুলাকে যুক্ত করে ফেলে:
88
-
89
-
```js run
90
-
alert( 1 + '2' ); // '12' (ডানপাশে স্ট্রিং)
91
-
alert( '1' + 2 ); // '12' (বামপাশে স্ট্রিং)
92
-
```
93
-
94
-
এটা তখনই হয় যদি অন্তত একটি আর্গুমেন্ট স্ট্রিং থাকে, নাহয় তা সংখ্যায় রুপান্তরিত হয়ে যাবে।
95
-
````
84
+
বেশিরভাগ গাণিতিক অপারেটর এমন পরিবর্তন করে থাকে, আমরা পরবর্তি চ্যাপ্টার এ তা দেখবো।
| `string` | স্ট্রিংয়ে যা তাই আসে, স্ট্রিংয়ের শুরু ও শেষের স্পেস থেকে তা মুছে ফেলা হয়। বাকিটা ফাঁকা স্ট্রিং হলে, তা `0` হবে। নাহয় নাম্বারগুলি স্ট্রিং থেকে নেয়া হয়। এরর হলে `NaN` আসে। |
| `string` | স্ট্রিংয়ে যা তাই আসে, স্ট্রিংয়ের শুরু ও শেষের স্পেস থেকে তা মুছে ফেলা হয়। বাকিটা ফাঁকা স্ট্রিং হলে, তা `0` হবে। নাহয় নাম্বারগুলি স্ট্রিং থেকে নেয়া হয়। এরর হলে `NaN` আসে। |
143
132
144
133
**`বুলিয়ানে রূপান্তর`** -- লজিকাল অপারেশনে হয়। আবার `Boolean(value)` দিয়েও করা যায।
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/07-operators/article.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -138,17 +138,17 @@ Here's an extract from the [precedence table](https://developer.mozilla.org/en/J
138
138
| Precedence | Name | Sign |
139
139
|------------|------|------|
140
140
|...|...|...|
141
-
|16| unary plus |`+`|
142
-
|16| unary negation |`-`|
143
-
|14| multiplication |`*`|
144
-
|14| division |`/`|
141
+
|17| unary plus |`+`|
142
+
|17| unary negation |`-`|
143
+
|15| multiplication |`*`|
144
+
|15| division |`/`|
145
145
|13| addition |`+`|
146
146
|13| subtraction |`-`|
147
147
|...|...|...|
148
148
|3| assignment |`=`|
149
149
|...|...|...|
150
150
151
-
As we can see, the "unary plus" has a priority of`16` which is higher than the `13`of"addition" (binary plus). That's why, in the expression `"+apples + +oranges"`, unary pluses work before the addition.
151
+
As we can see, the "unary plus" has a priority of`17` which is higher than the `13`of"addition" (binary plus). That's why, in the expression `"+apples + +oranges"`, unary pluses work before the addition.
A loop that shows odd values could look like this:
258
258
259
-
```js
259
+
```js run
260
260
for (let i =0; i <10; i++) {
261
261
262
262
if (i %2) {
@@ -268,7 +268,7 @@ for (let i = 0; i < 10; i++) {
268
268
269
269
From a technical point of view, this is identical to the example above. Surely, we can just wrap the code in an `if` block instead of using `continue`.
270
270
271
-
But as a side-effect, this created one more level of nesting (the `alert` call inside the curly braces). If the code inside of`if` is longer than a few lines, that may decrease the overall readability.
271
+
But as a side-effect, this created one more level of nesting (the `alert` call inside the curly braces). If the code inside of`if` is longer than a few lines, that may decrease the overall readability.
272
272
````
273
273
274
274
````warn header="No `break/continue` to the right side of '?'"
Copy file name to clipboardExpand all lines: 1-js/03-code-quality/01-debugging-chrome/article.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Before writing more complex code, let's talk about debugging.
4
4
5
5
[Debugging](https://en.wikipedia.org/wiki/Debugging) is the process of finding and fixing errors within a script. All modern browsers and most other environments support debugging tools -- a special UI in developer tools that makes debugging much easier. It also allows to trace the code step by step to see what exactly is going on.
6
6
7
-
We'll be using Chrome here, because it has enough features, most other browsers have a similar process`.
7
+
We'll be using Chrome here, because it has enough features, most other browsers have a similar process.
8
8
9
9
## The "Sources" panel
10
10
@@ -24,11 +24,11 @@ Let's click it and select `hello.js` in the tree view. Here's what should show u
24
24
25
25

26
26
27
-
Here we can see three zones:
27
+
The Sources panel has 3 parts:
28
28
29
-
1. The **Resources zone** lists HTML, JavaScript, CSS and other files, including images that are attached to the page. Chrome extensions may appear here too.
30
-
2. The **Source zone** shows the source code.
31
-
3. The **Information and control zone** is for debugging, we'll explore it soon.
29
+
1. The **File Navigator** pane lists HTML, JavaScript, CSS and other files, including images that are attached to the page. Chrome extensions may appear here too.
30
+
2. The **Code Editor** pane shows the source code.
31
+
3. The **JavaScript Debugging** pane is for debugging, we'll explore it soon.
32
32
33
33
Now you could click the same toggler <spanclass="devtools"style="background-position:-172px-122px"></span> again to hide the resources list and give the code some space.
Copy file name to clipboardExpand all lines: 1-js/03-code-quality/03-comments/article.md
+16-16
Original file line number
Diff line number
Diff line change
@@ -125,25 +125,25 @@ Describe the architecture
125
125
Document function parameters and usage
126
126
: There's a special syntax [JSDoc](http://en.wikipedia.org/wiki/JSDoc) to document a function: usage, parameters, returned value.
127
127
128
-
For instance:
129
-
```js
130
-
/**
131
-
* Returns x raised to the n-th power.
132
-
*
133
-
* @param {number} x The number to raise.
134
-
* @param {number} n The power, must be a natural number.
135
-
* @return {number} x raised to the n-th power.
136
-
*/
137
-
function pow(x, n) {
138
-
...
139
-
}
140
-
```
128
+
For instance:
129
+
```js
130
+
/**
131
+
* Returns x raised to the n-th power.
132
+
*
133
+
* @param{number}x The number to raise.
134
+
* @param{number}n The power, must be a natural number.
135
+
* @return{number} x raised to the n-th power.
136
+
*/
137
+
functionpow(x, n) {
138
+
...
139
+
}
140
+
```
141
141
142
-
Such comments allow us to understand the purpose of the function and use it the right way without looking in its code.
142
+
Such comments allow us to understand the purpose of the function and use it the right way without looking in its code.
143
143
144
-
By the way, many editors like [WebStorm](https://www.jetbrains.com/webstorm/) can understand them as well and use them to provide autocomplete and some automatic code-checking.
144
+
By the way, many editors like [WebStorm](https://www.jetbrains.com/webstorm/) can understand them as well and use them to provide autocomplete and some automatic code-checking.
145
145
146
-
Also, there are tools like [JSDoc 3](https://github.com/jsdoc3/jsdoc) that can generate HTML-documentation from the comments. You can read more information about JSDoc at <http://usejsdoc.org/>.
146
+
Also, there are tools like [JSDoc 3](https://github.com/jsdoc3/jsdoc) that can generate HTML-documentation from the comments. You can read more information about JSDoc at <http://usejsdoc.org/>.
147
147
148
148
Why is the task solved this way?
149
149
: What's written is important. But what's *not* written may be even more important to understand what's going on. Why is the task solved exactly this way? The code gives no answer.
0 commit comments