Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variables #30

Merged
merged 4 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
In the code below, each line corresponds to the item in the task list.
नीचे दिए गए कोड में, प्रत्येक पंक्ति कार्य सूची से एक कार्य के साथ मेल खाता है।

```js run
let admin, name; // can declare two variables at once
let admin, name; // एक साथ दो variables घोषित कर सकते हैं।

name = "John";

Expand Down
10 changes: 5 additions & 5 deletions 1-js/02-first-steps/04-variables/1-hello-variables/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ importance: 2

---

# Working with variables
# Variables के साथ काम करना।

1. Declare two variables: `admin` and `name`.
2. Assign the value `"John"` to `name`.
3. Copy the value from `name` to `admin`.
4. Show the value of `admin` using `alert` (must output "John").
1. दो variables घोषित करें: `admin` और `name`
2. `name` variable को मान `"John"` से असाइन करें।
3. `admin` variable में `name` का मान कॉपी करें।
4. `alert` ("John" उत्पादन करना चाहिए) का उपयोग करके `admin` का मान दिखाएँ।
14 changes: 7 additions & 7 deletions 1-js/02-first-steps/04-variables/2-declare-variables/solution.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
## The variable for our planet
## हमारे ग्रह के लिए variable

That's simple:
यह आसान है:

```js
let ourPlanetName = "Earth";
```

Note, we could use a shorter name `planet`, but it might be not obvious what planet it refers to. It's nice to be more verbose. At least until the variable isNotTooLong.
ध्यान दें, हम एक छोटे नाम का उपयोग कर सकते हैं, जैसे की `planet`, लेकिन यह स्पष्ट नहीं हो सकता है कि यह किस ग्रह को संदर्भित करता है। अधिक वर्णनात्मक होना अच्छा है। कम से कम जब तक variable बहुत लंबा नहीं है।।

## The name of the current visitor
## वर्तमान visitor का नाम।

```js
let currentUserName = "John";
```

Again, we could shorten that to `userName` if we know for sure that the user is current.
फिर से, हम उस `userName` को छोटा कर सकते हैं यदि हम यह सुनिश्चित जानते हैं कि उपयोगकर्ता, वर्तमान विजिटर है।

Modern editors and autocomplete make long variable names easy to write. Don't save on them. A name with 3 words in it is fine.
आधुनिक संपादक और स्वत: पूर्ण लंबे variable नामों को लिखना आसान बनाते हैं। उन पर निर्भर न रहें। इसमें 3 शब्दों वाला variable नाम ठीक है।

And if your editor does not have proper autocompletion, get [a new one](/code-editors).
और यदि आपके संपादक के पास उचित स्वतः पूर्णता नहीं है, तो [एक नया](/code-editors) प्राप्त करें।
6 changes: 3 additions & 3 deletions 1-js/02-first-steps/04-variables/2-declare-variables/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ importance: 3

---

# Giving the right name
# सही नाम देना

1. Create a variable with the name of our planet. How would you name such a variable?
2. Create a variable to store the name of a current visitor to a website. How would you name that variable?
1. हमारे planet के नाम के साथ एक variable बनाएं। आप ऐसे variable का नाम कैसे देंगे?
2. किसी वेबसाइट पर वर्तमान विजिटर का नाम स्टोर करने के लिए variable बनाएं। आप उस variable का नाम कैसे देंगे?
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
We generally use upper case for constants that are "hard-coded". Or, in other words, when the value is known prior to execution and directly written into the code.
हम आमतौर पर कांस्तान्ट्स के लिए बड़ा अक्षर का उपयोग करते हैं जो "हार्ड-कोडेड" हैं। या, दूसरे शब्दों में, जब मूल्य क्रियान्वयन से पहले जाना जाता है और सीधे कोड में लिखा जाता है।

In this code, `birthday` is exactly like that. So we could use the upper case for it.
इस कोड में, `birthday` बिल्कुल वैसा ही है। इसलिए हम इसके लिए बड़ा अक्षर का उपयोग कर सकते हैं।

In contrast, `age` is evaluated in run-time. Today we have one age, a year after we'll have another one. It is constant in a sense that it does not change through the code execution. But it is a bit "less of a constant" than `birthday`: it is calculated, so we should keep the lower case for it.
इसके विपरीत, रन-टाइम में `age` का मूल्यांकन किया जाता है। आज हमारी एक उम्र है, एक साल बाद हम
एक और जोड़ देंगे। यह इस अर्थ में निरंतर है कि यह कोड क्रियान्वयन के माध्यम से नहीं बदलता है। लेकिन यह `birthday` की तुलना में "थोड़ा कम स्थिर" है: इसकी गणना की जाती है, इसलिए हमें इसके लिए
छोटे अक्षर का उपयोग करना चाहिए।
12 changes: 6 additions & 6 deletions 1-js/02-first-steps/04-variables/3-uppercast-constant/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ importance: 4

---

# Uppercase const?
# बड़े अक्षर का उपयोग const के लिये?

Examine the following code:
निम्नलिखित कोड की जाँच करें:

```js
const birthday = '18.04.1982';

const age = someCode(birthday);
```

Here we have a constant `birthday` date and the `age` is calculated from `birthday` with the help of some code (it is not provided for shortness, and because details don't matter here).
यहां हमारे पास एक निरंतर `birthday` तिथि है और `age` की गणना `birthday` से कुछ कोड की सहायता से की जाती है (यह संक्षिप्तता के लिए प्रदान नहीं की जाती है, और क्योंकि विवरण से यहां कोई फर्क नहीं पड़ता)।

Would it be right to use upper case for `birthday`? For `age`? Or even for both?
क्या `birthday` के लिए बड़ा अक्षर का उपयोग करना सही होगा? `age` के लिए? या दोनों के लिए भी?

```js
const BIRTHDAY = '18.04.1982'; // make uppercase?
const BIRTHDAY = '18.04.1982'; // बड़ा अक्षर बनाएं?

const AGE = someCode(BIRTHDAY); // make uppercase?
const AGE = someCode(BIRTHDAY); // बड़ा अक्षर बनाएं?
```

Loading