mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 15:43:58 +00:00
JavaScript Tamil translation complete
[JavaScript/ta] Translation completed
This commit is contained in:
parent
9cfe364c58
commit
c063cd4e0b
@ -418,28 +418,29 @@ anotherFunc.call(myObj, " And Hello Moon!"); // = "Hello World! And Hello Moon!"
|
|||||||
|
|
||||||
anotherFunc.apply(myObj, [" And Hello Sun!"]); // = "Hello World! And Hello Sun!"
|
anotherFunc.apply(myObj, [" And Hello Sun!"]); // = "Hello World! And Hello Sun!"
|
||||||
|
|
||||||
// This is useful when working with a function that accepts a sequence of
|
//இது தொடர்ச்சியான arguments ஐ நாம் function ஒன்றுக்குள் pass பண்ண
|
||||||
// arguments and you want to pass an array.
|
//வேண்டும் எனில் மிகவும் உபயோகமானது
|
||||||
|
|
||||||
Math.min(42, 6, 27); // = 6
|
Math.min(42, 6, 27); // = 6
|
||||||
Math.min([42, 6, 27]); // = NaN (uh-oh!)
|
Math.min([42, 6, 27]); // = NaN (uh-oh!)
|
||||||
Math.min.apply(Math, [42, 6, 27]); // = 6
|
Math.min.apply(Math, [42, 6, 27]); // = 6
|
||||||
|
|
||||||
// But, `call` and `apply` are only temporary. When we want it to stick, we can
|
//ஆனால் `call ` ,`apply ` இரண்டும் தற்காலிகமானவை
|
||||||
// use `bind`.
|
//அவற்றை நிரந்தரமாக்க bind function ஐ பயன்படுத்தவும்
|
||||||
|
|
||||||
var boundFunc = anotherFunc.bind(myObj);
|
var boundFunc = anotherFunc.bind(myObj);
|
||||||
boundFunc(" And Hello Saturn!"); // = "Hello World! And Hello Saturn!"
|
boundFunc(" And Hello Saturn!"); // = "Hello World! And Hello Saturn!"
|
||||||
|
|
||||||
// `bind` can also be used to partially apply (curry) a function.
|
//`bind ` ஐ உபயோகித்து ஒரு function ஐ பகுதியாக apply செய்ய முடியும்
|
||||||
|
|
||||||
var product = function(a, b){ return a * b; }
|
var product = function(a, b){ return a * b; }
|
||||||
var doubler = product.bind(this, 2);
|
var doubler = product.bind(this, 2);
|
||||||
doubler(8); // = 16
|
doubler(8); // = 16
|
||||||
|
|
||||||
// When you call a function with the `new` keyword, a new object is created, and
|
|
||||||
// made available to the function via the this keyword. Functions designed to be
|
//ஒரு function ஐ நாம் new என்ற குறியீட்டு சொல்லை பயன்படுத்தி
|
||||||
// called like that are called constructors.
|
//அழைக்கும் போது புதிய object உருவாக்கப்படும் .இவ்வாறான functions
|
||||||
|
//constructors என அழைக்கப்படும்
|
||||||
|
|
||||||
var MyConstructor = function(){
|
var MyConstructor = function(){
|
||||||
this.myNumber = 5;
|
this.myNumber = 5;
|
||||||
@ -447,13 +448,15 @@ var MyConstructor = function(){
|
|||||||
myNewObj = new MyConstructor(); // = {myNumber: 5}
|
myNewObj = new MyConstructor(); // = {myNumber: 5}
|
||||||
myNewObj.myNumber; // = 5
|
myNewObj.myNumber; // = 5
|
||||||
|
|
||||||
// Every JavaScript object has a 'prototype'. When you go to access a property
|
//ஒவ்வொரு JavaScript object உம் ஒரு `prototype ` கொண்டுள்ளது
|
||||||
// on an object that doesn't exist on the actual object, the interpreter will
|
//நீங்கள் object ஒன்றின் ஒரு property ஐ அணுகும் போது
|
||||||
// look at its prototype.
|
//அந்த property இல்லாவிடின் interpreter ஆனது
|
||||||
|
//அதன் prototype உள்ளதா என பார்க்கும்
|
||||||
|
|
||||||
// Some JS implementations let you access an object's prototype on the magic
|
//JS இன் சில செயலாக்கங்கள் ஒரு object இன் protoype ஐ
|
||||||
// property `__proto__`. While this is useful for explaining prototypes it's not
|
//இலகுவாக `__proto__` மூலம் access செய்ய முடியும் .
|
||||||
// part of the standard; we'll get to standard ways of using prototypes later.
|
//இது prototype பாவணை யை இலகுவாக்கினாலும்
|
||||||
|
//இது சரியான ஒரு முறை அல்ல
|
||||||
var myObj = {
|
var myObj = {
|
||||||
myString: "Hello world!"
|
myString: "Hello world!"
|
||||||
};
|
};
|
||||||
@ -470,32 +473,36 @@ myObj.meaningOfLife; // = 42
|
|||||||
// This works for functions, too.
|
// This works for functions, too.
|
||||||
myObj.myFunc(); // = "hello world!"
|
myObj.myFunc(); // = "hello world!"
|
||||||
|
|
||||||
// Of course, if your property isn't on your prototype, the prototype's
|
//உங்கள் property prototype இல் இல்லது இருப்பின் , protype இன்
|
||||||
// prototype is searched, and so on.
|
//prototype search செய்யப்படும்
|
||||||
myPrototype.__proto__ = {
|
myPrototype.__proto__ = {
|
||||||
myBoolean: true
|
myBoolean: true
|
||||||
};
|
};
|
||||||
myObj.myBoolean; // = true
|
myObj.myBoolean; // = true
|
||||||
|
|
||||||
// There's no copying involved here; each object stores a reference to its
|
//ஒவ்வொரு object உம் அதன் protype க்கும் reference (மேற்கோள் ) ஒன்றை வைத்திருக்கும்
|
||||||
// prototype. This means we can alter the prototype and our changes will be
|
//நாம் ஒரு protype இணை மாற்றினால் அதன் மாற்றங்கள் எல்லா இடத்திலும் (program இல் )
|
||||||
// reflected everywhere.
|
//பிரதிபலிக்கும்
|
||||||
myPrototype.meaningOfLife = 43;
|
myPrototype.meaningOfLife = 43;
|
||||||
myObj.meaningOfLife; // = 43
|
myObj.meaningOfLife; // = 43
|
||||||
|
|
||||||
// We mentioned that `__proto__` was non-standard, and there's no standard way to
|
|
||||||
// change the prototype of an existing object. However, there are two ways to
|
//நாம் முன்பு கூறியது போல் `__proto__` பயன்படுத்துவது சரியான முறை அல்ல
|
||||||
// create a new object with a given prototype.
|
//எனவே நாம் ஒரு protype ஐ object இல் உருவாக்க இரண்டு வழிமுறைகள்
|
||||||
|
//உள்ளன
|
||||||
|
|
||||||
|
// முதல் முறை Object.create இது அண்மையில் அறிமுகம் செய்ய பட்ட ஒன்று
|
||||||
|
//எனவே சில இடங்களில் இந்த முறை இன்னும் அறிமுகம் ஆகவில்லை
|
||||||
|
|
||||||
// The first is Object.create, which is a recent addition to JS, and therefore
|
|
||||||
// not available in all implementations yet.
|
|
||||||
var myObj = Object.create(myPrototype);
|
var myObj = Object.create(myPrototype);
|
||||||
myObj.meaningOfLife; // = 43
|
myObj.meaningOfLife; // = 43
|
||||||
|
|
||||||
// The second way, which works anywhere, has to do with constructors.
|
|
||||||
// Constructors have a property called prototype. This is *not* the prototype of
|
// இரண்டாவது முறை , இது சகல இடங்களிலும் வேலைசெய்யும், இது constructors மூலம்.
|
||||||
// the constructor function itself; instead, it's the prototype that new objects
|
//constructors prototype என்னும் ஒரு காரணியை கொண்டுள்ளது , இது constructor function
|
||||||
// are given when they're created with that constructor and the new keyword.
|
//இன் prototype அன்று. ,இது நாம் new என்ற குறியீட்டு சொல்லையும் அந்த constructor உபயோகித்து
|
||||||
|
//உருவாக்கபடுகிறது
|
||||||
|
|
||||||
MyConstructor.prototype = {
|
MyConstructor.prototype = {
|
||||||
myNumber: 5,
|
myNumber: 5,
|
||||||
getMyNumber: function(){
|
getMyNumber: function(){
|
||||||
@ -509,20 +516,26 @@ myNewObj2.getMyNumber(); // = 6
|
|||||||
|
|
||||||
// Built-in types like strings and numbers also have constructors that create
|
// Built-in types like strings and numbers also have constructors that create
|
||||||
// equivalent wrapper objects.
|
// equivalent wrapper objects.
|
||||||
|
// JavaScript இல் உள்ள strings மற்றும் numbers வகைகளும் constructors கொண்டுள்ளன
|
||||||
|
//இவை wrapper objects ஐ ஒத்தன
|
||||||
|
|
||||||
var myNumber = 12;
|
var myNumber = 12;
|
||||||
var myNumberObj = new Number(12);
|
var myNumberObj = new Number(12);
|
||||||
myNumber == myNumberObj; // = true
|
myNumber == myNumberObj; // = true
|
||||||
|
|
||||||
// Except, they aren't exactly equivalent.
|
|
||||||
|
//இவை மிக சிறிய அளவில் ஒத்தவை
|
||||||
typeof myNumber; // = 'number'
|
typeof myNumber; // = 'number'
|
||||||
typeof myNumberObj; // = 'object'
|
typeof myNumberObj; // = 'object'
|
||||||
myNumber === myNumberObj; // = false
|
myNumber === myNumberObj; // = false
|
||||||
if (0){
|
if (0){
|
||||||
// This code won't execute, because 0 is falsy.
|
// இந்த கூற்றானது செயல்படுத்தபடாது ஏனெனில் ௦ false ஆகும்
|
||||||
}
|
}
|
||||||
|
|
||||||
// However, the wrapper objects and the regular builtins share a prototype, so
|
// However, the wrapper objects and the regular builtins share a prototype, so
|
||||||
// you can actually add functionality to a string, for instance.
|
// you can actually add functionality to a string, for instance.
|
||||||
|
|
||||||
|
//இருப்பினும் wrapper objects மற்றும் regular builtins ஆகியன prototype ஒன்றை கொண்டுள்ளன
|
||||||
String.prototype.firstCharacter = function(){
|
String.prototype.firstCharacter = function(){
|
||||||
return this.charAt(0);
|
return this.charAt(0);
|
||||||
}
|
}
|
||||||
@ -532,8 +545,15 @@ String.prototype.firstCharacter = function(){
|
|||||||
// features of JavaScript in an older subset of JavaScript, so that they can be
|
// features of JavaScript in an older subset of JavaScript, so that they can be
|
||||||
// used in older environments such as outdated browsers.
|
// used in older environments such as outdated browsers.
|
||||||
|
|
||||||
// For instance, we mentioned that Object.create isn't yet available in all
|
//இந்த முறையானது "polyfilling" இல் உபயோகபடுத்தபடுகிறது.
|
||||||
// implementations, but we can still use it with this polyfill:
|
//புதிய சில வசதிகளை JavaScript பழைய JavaScript பிரதிகளில் இல் உருவாக்குகிறது.
|
||||||
|
//இது பழைய சூழல்களில் உபயோகிகப்படும்.
|
||||||
|
|
||||||
|
|
||||||
|
//நாங்கள் முன்பு கூறி இருந்தோம் Object.create சில இடங்களில் இந்த முறை இன்னும்
|
||||||
|
//அறிமுகம் ஆகவில்லை என்று ஆனால் இதை polyfill ஐ பயன்படுத்தி உருவாக்க
|
||||||
|
//முடியும்
|
||||||
|
|
||||||
if (Object.create === undefined){ // don't overwrite it if it exists
|
if (Object.create === undefined){ // don't overwrite it if it exists
|
||||||
Object.create = function(proto){
|
Object.create = function(proto){
|
||||||
// make a temporary constructor with the right prototype
|
// make a temporary constructor with the right prototype
|
||||||
@ -545,7 +565,7 @@ if (Object.create === undefined){ // don't overwrite it if it exists
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Further Reading
|
## மேலும் JavaScript பற்றி கற்க
|
||||||
|
|
||||||
The [Mozilla Developer
|
The [Mozilla Developer
|
||||||
Network](https://developer.mozilla.org/en-US/docs/Web/JavaScript) provides
|
Network](https://developer.mozilla.org/en-US/docs/Web/JavaScript) provides
|
||||||
|
Loading…
Reference in New Issue
Block a user