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
: نسخه قدیمی HTML یعنی HTML4 نیازمند تعیین `type` در تگ `<script>` بود. معمولا مقدار آن `type=text/javascript` بود. در حال حاضر دیگر این مورد الزامی نیست.
51
+
=======
52
+
The `type` attribute: <code><script <u>type</u>=...></code>
53
+
: The old HTML standard, HTML4, required a script to have a `type`. Usually it was `type="text/javascript"`. It's not required anymore. Also, the modern HTML standard totally changed the meaning of this attribute. Now, it can be used for JavaScript modules. But that's an advanced topic, we'll talk about modules in another part of the tutorial.
Copy file name to clipboardExpand all lines: 1-js/04-object-basics/01-object/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -103,7 +103,7 @@ user.likes birds = true
103
103
104
104
JavaScript doesn't understand that. It thinks that we address `user.likes`, and then gives a syntax error when comes across unexpected `birds`.
105
105
106
-
The dot requires the key to be a valid variable identifier. That implies: contains no spaces, doesn't start with a digit and doesn't include special characters (`$`и`_` are allowed).
106
+
The dot requires the key to be a valid variable identifier. That implies: contains no spaces, doesn't start with a digit and doesn't include special characters (`$`and`_` are allowed).
107
107
108
108
There's an alternative "square bracket notation" that works with any string:
Copy file name to clipboardExpand all lines: 1-js/05-data-types/02-number/article.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -318,7 +318,11 @@ alert( isFinite(num) );
318
318
319
319
یک تابع از پیش آماده شدهی خاص [Object.is](mdn:js/Object/is) که مقادیر را مثل `===` مقایسه میکند، اما برای دو حالت مرزی قابل اعتمادتر است.
320
320
321
+
<<<<<<< HEAD
321
322
۱. با `NaN` کار میکند: `Object.is(NaN, NaN) === true`، که چیز خوبیست.
323
+
=======
324
+
There is a special built-in method [`Object.is`](mdn:js/Object/is) that compares values like `===`, but is more reliable for two edge cases:
325
+
>>>>>>> 62299ed853674c4fd1427cd310516d5535bce648
322
326
323
327
۲. مقادیر `0` و `-0` متفاوت هستند: `Object.is(0, -0) === false`، به ندرت اهمیت دارد، اما این مقادیر در اصل متفاوتند.
324
328
@@ -412,7 +416,13 @@ alert( Math.pow(2, 10) ); // دو به توان ده = 1024
412
416
413
417
- `num.toString(base)` یک عدد را به یک رشتهی حرفی در سیستم عددی با پایه داده شده تبدیل میکند.
414
418
419
+
<<<<<<< HEAD
415
420
برای تبدیل مقادیری مثل `12pt` و `100px` به یک عدد:
421
+
=======
422
+
- Can write numbers directly in hex (`0x`), octal (`0o`) and binary (`0b`) systems.
423
+
- `parseInt(str, base)` parses the string `str` into an integer in numeral system with given `base`, `2 ≤ base ≤ 36`.
424
+
- `num.toString(base)` converts a number to a string in the numeral system with the given `base`.
425
+
>>>>>>> 62299ed853674c4fd1427cd310516d5535bce648
416
426
417
427
- `parseInt/parseFloat` را برای تبدیلات ساده استفاده کنید که یک عدد را از یک رشتهی حرفی میخواند و سپس مقداری که قبل از بروز خطا خواندهست را برمیگرداند.
Here we can even more clearer see that there are multiple objects, each one has the `value` and `next` pointing to the neighbour. The `list` variable is the first object in the chain, so following `next` pointers from it we can reach any element.
465
+
Here we can even more clearly see that there are multiple objects, each one has the `value` and `next` pointing to the neighbour. The `list` variable is the first object in the chain, so following `next` pointers from it we can reach any element.
466
466
467
467
The list can be easily split into multiple parts and later joined back:
This way of copying an object is much shorter than `let objCopy = Object.assign({}, obj);` or for an array `let arrCopy = Object.assign([], arr);` so we prefer to use it whenever we can.
271
+
272
+
228
273
## Summary
229
274
230
275
When we see `"..."` in the code, it is either rest parameters or the spread syntax.
Copy file name to clipboardExpand all lines: 1-js/06-advanced-functions/03-closure/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,7 +182,7 @@ Here's a little bit longer code:
182
182
Rectangles on the right-hand side demonstrate how the global Lexical Environment changes during the execution:
183
183
184
184
1. When the script starts, the Lexical Environment is pre-populated with all declared variables.
185
-
- Initially, they are in the "Uninitialized" state. That's a special internal state, it means that the engine knows about the variable, but won't allow to use it before`let`. It's almost the same as if the variable didn't exist.
185
+
- Initially, they are in the "Uninitialized" state. That's a special internal state, it means that the engine knows about the variable, but it cannot be referenced until it has been declared with`let`. It's almost the same as if the variable didn't exist.
186
186
2. Then `let phrase` definition appears. There's no assignment yet, so its value is `undefined`. We can use the variable since this moment.
Copy file name to clipboardExpand all lines: 2-ui/1-document/11-coordinates/1-find-point-coordinates/solution.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Outer corners
2
2
3
-
Outer corners are basically what we get from [elem.getBoundingClientRect()](https://developer.mozilla.org/en-US/docs/DOM/element.getBoundingClientRect).
3
+
Outer corners are basically what we get from [elem.getBoundingClientRect()](https://developer.mozilla.org/en-US/docs/DOM/element.getBoundingClientRect).
4
4
5
5
Coordinates of the upper-left corner `answer1` and the bottom-right corner `answer2`:
Copy file name to clipboardExpand all lines: 2-ui/2-events/02-bubbling-and-capturing/article.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -186,9 +186,15 @@ There's a property `event.eventPhase` that tells us the number of the phase on w
186
186
187
187
The event handling process:
188
188
189
+
<<<<<<< HEAD
189
190
- When an event happens -- the most nested element where it happens gets labeled as the "target element" (`event.target`).
190
191
- Then the event first moves from the document root down to the `event.target`, calling handlers assigned with `addEventListener(...., true)` on the way.
191
192
- Then the event moves from `event.target` up to the root, calling handlers assigned using `on<event>` and `addEventListener` without the 3rd argument or with the 3rd argument `false`.
193
+
=======
194
+
- Then the event moves down from the document root to `event.target`, calling handlers assigned with `addEventListener(..., true)` on the way (`true` is a shorthand for `{capture: true}`).
195
+
- Then handlers are called on the target element itself.
196
+
- Then the event bubbles up from `event.target` up to the root, calling handlers assigned using `on<event>` and `addEventListener` without the 3rd argument or with the 3rd argument `false/{capture:false}`.
197
+
>>>>>>> 62299ed853674c4fd1427cd310516d5535bce648
192
198
193
199
Each handler can access `event` object properties:
0 commit comments