-
Notifications
You must be signed in to change notification settings - Fork 48
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
Functions #75
base: master
Are you sure you want to change the base?
Functions #75
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you have look at all the comments? Also have a re-look at the 1-js/02-first-steps/15-function-basics/article.md
file, haven't review all of it. Needs some re-work. Thanks for the contribution. As you are maintaining the project now if you feel something is good enough to be merged feel free to merged even without another review. But make sure you do a proper self-review. Key here to just read the Hindi version and see if everything makes sense. After which you can read the English and Hindi side by side, to check for keywords and other guidelines. Thanks
} | ||
} | ||
``` | ||
|
||
Rewrite it, to perform the same, but without `if`, in a single line. | ||
इसे फिर से लिखें, वही प्रदर्शन करने के लिए, लेकिन बिना `if` के, एक पंक्ति में। |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use something more explicit than प्रदर्शन
? The translation doesn't need to match word by word if it's restricting us to convey the info.
@@ -4,13 +4,12 @@ importance: 1 | |||
|
|||
# Function min(a, b) | |||
|
|||
Write a function `min(a,b)` which returns the least of two numbers `a` and `b`. | |||
एक function लिखें `min(a,b)` जो कम से कम दो नंबर `a` और `b` लौटाता है। |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you have a re-look at this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -4,16 +4,16 @@ importance: 4 | |||
|
|||
# Function pow(x,n) | |||
|
|||
Write a function `pow(x,n)` that returns `x` in power `n`. Or, in other words, multiplies `x` by itself `n` times and returns the result. | |||
एक function लिखें `pow(x,n)` जो `x` को `n` के शक्ति में लौटाता है। या, दूसरे शब्दों में, `x` को अपने आप से `n` गुणा से गुणा करता है और परिणाम देता है। |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line also needs to be re-looked. Let's try to use proper mathematical terms in Hindi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
```js | ||
pow(3, 2) = 3 * 3 = 9 | ||
pow(3, 3) = 3 * 3 * 3 = 27 | ||
pow(1, 100) = 1 * 1 * ...* 1 = 1 | ||
``` | ||
|
||
Create a web-page that prompts for `x` and `n`, and then shows the result of `pow(x,n)`. | ||
एक वेब-पेज बनाएं जो `x` और `n` के लिए संकेत देता है, और फिर `pow(x,n)` का परिणाम दिखाता है। |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prompts
is very contextual here, not sure if we should translate. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think you are right. It is better to keep it as is.
|
||
[demo] | ||
|
||
P.S. In this task the function should support only natural values of `n`: integers up from `1`. | ||
नोट: इस टास्क में function को केवल `n` के प्राकृतिक मान का समर्थन करना चाहिए: `1` से ऊपर के पूर्णांक। |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above math terms are translated as plain old english.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -1,40 +1,42 @@ | |||
# Functions | |||
|
|||
Quite often we need to perform a similar action in many places of the script. | |||
अक्सर हमें स्क्रिप्ट के कई स्थानों पर इसी तरह की कार्रवाई करने की आवश्यकता होती है। |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hindi sentence is a bit diverted from the meaning of the original sentence, that's what I feel. Can be improved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
For example, we need to show a nice-looking message when a visitor logs in, logs out and maybe somewhere else. | ||
उदाहरण के लिए, जब कोई परिदर्शक इन करता है, लॉग आउट करता है और शायद कहीं और एक अच्छा दिखने वाला संदेश दिखाना चाहता है। |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
We've already seen examples of built-in functions, like `alert(message)`, `prompt(message, default)` and `confirm(question)`. But we can create functions of our own as well. | ||
हम पहले से ही बिल्ट-इन function के उदाहरण देख चुके हैं, जैसे `अलर्ट (संदेश)`, `प्रॉम्प्ट (संदेश, डिफ़ॉल्ट)` और `पुष्टि करें (प्रश्न)`। लेकिन हम अपने स्वयं के functions भी बना सकते हैं। |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets not translate the keywords, anyting inside '``'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes I somehow missed this
|
||
## Function Declaration | ||
|
||
To create a function we can use a *function declaration*. | ||
## Function घोषणा |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be at line no 11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
``` | ||
|
||
The `function` keyword goes first, then goes the *name of the function*, then a list of *parameters* between the parentheses (comma-separated, empty in the example above) and finally the code of the function, also named "the function body", between curly braces. | ||
`function` कीवर्ड पहले जाता है, फिर _name of the function_ जाता है, फिर कोष्ठक के बीच _parameters_ की एक सूची (उपरोक्त उदाहरण में खाली) और अंत में function का कोड, जिसे "the function body" भी कहा जाता है , घुंघराले ब्रेसिज़ के बीच। |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we using a notation like - name of the function? Applies to all the places we are using it.
Please make the requested changes. After it, add a comment "/done". |
|
||
It looks like this: | ||
function बनाने के लिए हम एक _function declaration_ का उपयोग कर सकते हैं। |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we translate _function declaration_
also??
/done |
Thanks for the review. I have made the requested changes also I have gone through |
I have translated Functions. Please let me know if there are any changes/modifications needed. Thank you.