Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
dde5fed
minor fixes
iliakan Jun 22, 2020
ef2760e
minor fixes
iliakan Jun 22, 2020
7b42ecc
minor fixes
iliakan Jun 27, 2020
b3fbb9c
minor fixes
iliakan Jun 27, 2020
340ce43
minor fixes
iliakan Jun 27, 2020
13e2106
Merge branch 'master' of github.com:javascript-tutorial/en.javascript…
iliakan Jun 29, 2020
e3bb302
manuals and specifications hindi translation done
ayushhagarwal Jun 30, 2020
db102cb
Fix minor typo error: delete blank
leviding Jul 1, 2020
da9849d
fixes #1979
iliakan Jul 1, 2020
ea3d179
Merge pull request #1981 from leviding/patch-13
iliakan Jul 1, 2020
dd06ffc
improved as per suggestions.
ayushhagarwal Jul 2, 2020
94c8fcb
minor fixes
iliakan Jul 2, 2020
26bf51a
minor fixes
iliakan Jul 2, 2020
6b5e5ee
Made smaller changes
theBstar Jul 2, 2020
f450c38
Merge pull request #23 from ayushhagarwal/master
theBstar Jul 2, 2020
0edc651
minor fixes
iliakan Jul 5, 2020
445bda3
minor fixes
iliakan Jul 5, 2020
ad751a9
Merge branch 'master' of github.com:javascript-tutorial/en.javascript…
iliakan Jul 6, 2020
55d5680
Merge pull request #24 from theBstar/master
theBstar Jul 12, 2020
bc42248
fixed missing words
theBstar Jul 12, 2020
abfa6dc
Change equality sign `=` to equality sign `==`
leviding Jul 12, 2020
450612a
Fix some confusing expression
leviding Jul 12, 2020
9e59ec1
Merge pull request #2005 from leviding/patch-17
iliakan Jul 12, 2020
1f0fcb7
minor fixes
iliakan Jul 12, 2020
c3a11c8
Merge pull request #2004 from leviding/patch-16
iliakan Jul 12, 2020
0a9b649
Merge branch 'master' of github.com:javascript-tutorial/en.javascript…
iliakan Jul 13, 2020
777ddf6
Merge pull request #25 from theBstar/master
theBstar Jul 16, 2020
db32443
Revert "Developer console"
theBstar Jul 16, 2020
e59cd81
Merge pull request #26 from javascript-tutorial/revert-25-master
theBstar Jul 16, 2020
cd448ef
Merge pull request #27 from theBstar/master
theBstar Jul 16, 2020
cba18ea
Revert "Revert "Developer console""
theBstar Jul 16, 2020
13787b1
Merge pull request #28 from javascript-tutorial/revert-26-revert-25-m…
theBstar Jul 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 1-js/01-getting-started/1-intro/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

*जावास्क्रिप्ट* को पहली बार *वेब पेजेस चलाने* के लिए बनाया गया था।

इस भाषा में प्रोग्राम को *स्क्रिप्ट्स* कहा जाता है। उन्हें एचटीएमएल के अंदर में ही लिखा जा सकता है और वो पेज लोड होते ही अपने आप एक्सेक्यूट (निष्पादित) हो जाता है।
इस भाषा में प्रोग्राम को *स्क्रिप्ट्स* कहा जाता है। उन्हें एचटीएमएल के अंदर में ही लिखा जा सकता है और वो पेज लोड होते ही अपने आप निष्पादित (Execute) हो जाता है।

स्क्रिप्ट्स को एक प्लेन टेक्स्ट के रूप में लिखा तथा एक्सेक्यूट (निष्पादित) किया जाता है. उन्हें चलाने के लिए एक विशेष तैयारी या संकलन की आवश्यकता नहीं है।

Expand Down Expand Up @@ -65,7 +65,7 @@

- एक वेबपेज पर जावास्क्रिप्ट हार्ड डिस्क पर मनमानी फाइलों को नहीं पढ़ / लिख सकता है, उन्हें कॉपी या प्रोग्राम निष्पादित नहीं कर सकता है। ऑपरेटिंग सिस्टम फ़ंक्शंस (OS functions) पर इसकी कोई सीधी पहुंच नहीं है।

आधुनिक ब्राउज़र इसे फ़ाइलों के साथ काम करने की अनुमति देता है, लेकिन पहुंच सीमित है और केवल तभी प्रदान की जाती है जब उपयोगकर्ता कुछ कार्य करता है, जैसे किसी फ़ाइल को ब्राउज़र विंडो में "ड्रॉप करना" या <input> ('इनपुट') टैग के माध्यम से चुनना।
आधुनिक ब्राउज़र इसे फ़ाइलों के साथ काम करने की अनुमति देता है, लेकिन पहुंच सीमित है और केवल तभी प्रदान की जाती है जब उपयोगकर्ता कुछ कार्य करता है, जैसे किसी फ़ाइल को ब्राउज़र विंडो में "ड्रॉप करना" या input ('इनपुट') टैग के माध्यम से चुनना।

कैमरा / माइक्रोफोन और अन्य उपकरणों के साथ बातचीत करने के तरीके हैं, लेकिन उन्हें उपयोगकर्ता की स्पष्ट अनुमति की आवश्यकता होती है। इसलिए एक जावास्क्रिप्ट-सक्षम पेज वेब-कैमरा को चुपके से सक्षम नहीं कर सकता है, परिवेश का निरीक्षण नहीं कर सकता है और [एनएसए] (https://en.wikipedia.org/wiki/National_Security_Agency) को जानकारी नहीं भेज सकता है।
- विभिन्न टैब / विंडो आमतौर पर एक-दूसरे के बारे में नहीं जानते हैं। कभी-कभी वे जानते हैं, उदाहरण के लिए जब एक window दूसरे को खोलने के लिए जावास्क्रिप्ट का उपयोग करती है। लेकिन इस मामले में भी, एक पृष्ठ से जावास्क्रिप्ट दूसरे तक नहीं पहुंच सकता है यदि वे विभिन्न साइटों (एक अलग डोमेन, प्रोटोकॉल या पोर्ट से) से आते हैं।
Expand Down
42 changes: 21 additions & 21 deletions 1-js/01-getting-started/2-manuals-specifications/article.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@

# Manuals and specifications
# मैनुअल और विशिष्टता

This book is a *tutorial*. It aims to help you gradually learn the language. But once you're familiar with the basics, you'll need other sources.
यह पुस्तक एक * ट्यूटोरियल * है। इसका उद्देश्य आपको धीरे-धीरे जावास्क्रिप्ट सीखने में मदद करना है। एक बार जब आप मूल बातें से परिचित हो जाते हैं, तो आपको अन्य स्त्रोत की आवश्यकता होगी।

## Specification
## विशिष्टता

[The ECMA-262 specification](https://www.ecma-international.org/publications/standards/Ecma-262.htm) contains the most in-depth, detailed and formalized information about JavaScript. It defines the language.
[ECMA-262 विशिष्टता] (https://www.ecma-international.org/publications/standards/Ecma-262.htm) में {जावास्क्रिप्ट} के बारे में सबसे अधिक गहन, विस्तृत और औपचारिक जानकारी है। यह जावास्क्रिप्ट को परिभाषित करता है।

But being that formalized, it's difficult to understand at first. So if you need the most trustworthy source of information about the language details, the specification is the right place. But it's not for everyday use.
लेकिन औपचारिक होने के नाते, यह पहली बार में समझना मुश्किल है। इसलिए यदि आपको जावास्क्रिप्ट के विवरण के बारे में सबसे भरोसेमंद स्त्रोत की आवश्यकता है, तो विशिष्टता सही जगह है। लेकिन यह रोजमर्रा के उपयोग के लिए नहीं है।

A new specification version is released every year. In-between these releases, the latest specification draft is at <https://tc39.es/ecma262/>.
हर साल एक नया विशिष्टता संस्करण जारी किया जाता है। इन रिलीज़ों के बीच, नवीनतम विशिष्टता ड्राफ्ट <https://tc39.es/ecma262/> पर है।

To read about new bleeding-edge features, including those that are "almost standard" (so-called "stage 3"), see proposals at <https://github.com/tc39/proposals>.
नवीनतम विशेषताओं के बारे में पढ़ने के लिए, जिनमें "लगभग मानक" (तथाकथित "स्टेज 3") शामिल हैं, <https://github.com/tc39/proposals> पर प्रस्ताव देखें।

Also, if you're in developing for the browser, then there are other specs covered in the [second part](info:browser-environment) of the tutorial.
इसके अलावा, यदि आप ब्राउज़र के लिए विकसित कर रहे हैं, तो ट्यूटोरियल के [दूसरे भाग](info:browser-environment) में अन्य विशिष्टताएं शामिल हैं।

## Manuals
## मैनुअल

- **MDN (Mozilla) JavaScript Reference** is a manual with examples and other information. It's great to get in-depth information about individual language functions, methods etc.
- **एमडीएन (मोज़िला) जावास्क्रिप्ट संदर्भ** उदाहरण और अन्य जानकारी के साथ एक मैनुअल है।यह जावास्क्रिप्ट के फंक्षन, मेतड आदि के बारे में गहराई से जानकारी प्राप्त करना बहुत अच्छा है।

One can find it at <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference>.
कोई इसे <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference> पर पा सकता है।

Although, it's often best to use an internet search instead. Just use "MDN [term]" in the query, e.g. <https://google.com/search?q=MDN+parseInt> to search for `parseInt` function.
हालांकि, इसके बजाय अक्सर इंटरनेट खोज का उपयोग करना सबसे अच्छा है। बस क्वेरी में "एमडीएन [टर्म]" का उपयोग करें। {`parseInt`} फ़ंक्शन की खोज करने के लिए <https://google.com/search?q=MDN+parseInt> पर जाएं।


- **MSDN** – Microsoft manual with a lot of information, including JavaScript (often referred to as JScript). If one needs something specific to Internet Explorer, better go there: <http://msdn.microsoft.com/>.
- **MSDN** – Microsoft की मैनुअल मे बहुत सारी जानकारी है, जिसमें जावास्क्रिप्ट (अक्सर JScript के रूप में संदर्भित) शामिल है। अगर किसी को इंटरनेट एक्सप्लोरर के लिए कुछ विशिष्ट चाहिए, तो यहा जाएं: <http://msdn.microsoft.com/>

Also, we can use an internet search with phrases such as "RegExp MSDN" or "RegExp MSDN jscript".
इसके अलावा, हम "RegExp MSDN" या "RegExp MSDN jscript" जैसे वाक्यांशों के साथ एक इंटरनेट खोज का उपयोग कर सकते हैं।

## Compatibility tables
## संगतता टेबल

JavaScript is a developing language, new features get added regularly.
जावास्क्रिप्ट एक विकासशील भाषा है, नई विशेषताएं को नियमित रूप से जोड़ा जाता है।

To see their support among browser-based and other engines, see:
ब्राउज़र-आधारित और अन्य इंजनों के बीच उनका समर्थन देखने के लिए, देखें:

- <http://caniuse.com> - per-feature tables of support, e.g. to see which engines support modern cryptography functions: <http://caniuse.com/#feat=cryptography>.
- <https://kangax.github.io/compat-table> - a table with language features and engines that support those or don't support.
- <http://caniuse.com> - समर्थन की प्रति-सुविधा तालिका, उदाहरण के लिए, यह देखने के लिए कि कौन से इंजन आधुनिक क्रिप्टोग्राफी फंक्षन का समर्थन करते हैं: <http://caniuse.com/#feat=cryptography>
- <https://kangax.github.io/compat-table> - जावास्क्रिप्ट सुविधाओं और इंजनों के साथ एक तालिका जो समर्थन करती है या समर्थन नहीं करती है।

All these resources are useful in real-life development, as they contain valuable information about language details, their support etc.
ये सभी संसाधन वास्तविक जीवन के विकास में उपयोगी होते हैं, क्योंकि इनमें जावास्क्रिप्ट के विवरण, उनके समर्थन आदि के बारे में बहुमूल्य जानकारी होती है।

Please remember them (or this page) for the cases when you need in-depth information about a particular feature.
कृपया उन्हें (या यह पृष्ठ) उन मामलों के लिए याद रखें जब आपको किसी विशेष सुविधा के बारे में गहराई से जानकारी की आवश्यकता होगी।
15 changes: 8 additions & 7 deletions 1-js/02-first-steps/09-comparison/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ In JavaScript they are written like this:

- Greater/less than: <code>a &gt; b</code>, <code>a &lt; b</code>.
- Greater/less than or equals: <code>a &gt;= b</code>, <code>a &lt;= b</code>.
- Equals: `a == b`, please note the double equality sign `=` means the equality test, while a single one `a = b` means an assignment.
- Equals: `a == b`, please note the double equality sign `==` means the equality test, while a single one `a = b` means an assignment.
- Not equals. In maths the notation is <code>&ne;</code>, but in JavaScript it's written as <code>a != b</code>.

In this article we'll learn more about different types of comparisons, how JavaScript makes them, including important peculiarities.
In this article we'll learn more about different types of comparisons, how JavaScript makes them, including important peculiarities.

At the end you'll find a good recipe to avoid "javascript quirks"-related issues.

## Boolean is the result

Expand Down Expand Up @@ -196,13 +198,12 @@ We get these results because:
- Comparisons `(1)` and `(2)` return `false` because `undefined` gets converted to `NaN` and `NaN` is a special numeric value which returns `false` for all comparisons.
- The equality check `(3)` returns `false` because `undefined` only equals `null`, `undefined`, and no other value.

### Evade problems

Why did we go over these examples? Should we remember these peculiarities all the time? Well, not really. Actually, these tricky things will gradually become familiar over time, but there's a solid way to evade problems with them:
### Avoid problems

Just treat any comparison with `undefined/null` except the strict equality `===` with exceptional care.
Why did we go over these examples? Should we remember these peculiarities all the time? Well, not really. Actually, these tricky things will gradually become familiar over time, but there's a solid way to avoid problems with them:

Don't use comparisons `>= > < <=` with a variable which may be `null/undefined`, unless you're really sure of what you're doing. If a variable can have these values, check for them separately.
- Treat any comparison with `undefined/null` except the strict equality `===` with exceptional care.
- Don't use comparisons `>= > < <=` with a variable which may be `null/undefined`, unless you're really sure of what you're doing. If a variable can have these values, check for them separately.

## Summary

Expand Down
17 changes: 8 additions & 9 deletions 1-js/04-object-basics/07-optional-chaining/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ AND'ing the whole path to the property ensures that all components exist, but is

The optional chaining `?.` stops the evaluation and returns `undefined` if the part before `?.` is `undefined` or `null`.

Further in this article, for brevity, we'll be saying that something "exists" if it's not `null` and not `undefined`.

**Further in this article, for brevity, we'll be saying that something "exists" if it's not `null` and not `undefined`.**

Here's the safe way to access `user.address.street`:

Expand All @@ -57,14 +56,14 @@ Reading the address with `user?.address` works even if `user` object doesn't exi
let user = null;

alert( user?.address ); // undefined

alert( user?.address.street ); // undefined
alert( user?.address.street.anything ); // undefined
```

Please note: the `?.` syntax works exactly where it's placed, not any further.
Please note: the `?.` syntax makes optional the value before it, but not any further.

In the example above, `user?.` allows only `user` to be `null/undefined`.

In the last two lines the evaluation stops immediately after `user?.`, never accessing further properties. But if the `user` actually exists, then the further intermediate properties, such as `user.address` must exist.
On the other hand, if `user` does exist, then it must have `user.address` property, otherwise `user?.address.street` gives an error at the second dot.

```warn header="Don't overuse the optional chaining"
We should use `?.` only where it's ok that something doesn't exist.
Expand All @@ -74,14 +73,14 @@ For example, if according to our coding logic `user` object must be there, but `
So, if `user` happens to be undefined due to a mistake, we'll know about it and fix it. Otherwise, coding errors can be silenced where not appropriate, and become more difficult to debug.
```

````warn header="The variable before `?.` must exist"
If there's no variable `user`, then `user?.anything` triggers an error:
````warn header="The variable before `?.` must be declared"
If there's no variable `user` at all, then `user?.anything` triggers an error:

```js run
// ReferenceError: user is not defined
user?.address;
```
The optional chaining only tests for `null/undefined`, doesn't interfere with any other language mechanics.
There must be `let/const/var user`. The optional chaining works only for declared variables.
````

## Short-circuiting
Expand Down
2 changes: 1 addition & 1 deletion 1-js/05-data-types/02-number/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ There are two ways to do so:

1. Multiply-and-divide.

For example, to round the number to the 2nd digit after the decimal, we can multiply the number by `100`, call the rounding function and then divide it back.
For example, to round the number to the 2nd digit after the decimal, we can multiply the number by `100` (or a bigger power of 10), call the rounding function and then divide it back.
```js run
let num = 1.23456;

Expand Down
Loading