@@ -16,36 +16,38 @@ puede ser sobreescrito fácilmente.
16
16
> pero su nombre todavía puede por ejemplo establecer una función con el nombre
17
17
> ` undefined ` .
18
18
19
- Algunos ejemplos de cuando el valor retorna ` undefined ` :
19
+ Algunos ejemplos cuando el valor retorna ` undefined ` :
20
20
21
21
- Acceso a la variable global (sin modificar) ` undefined ` .
22
22
- Retorna implícitamente las funciones que no posean la sentencia ` return ` .
23
- - ` return ` statements which do not explicitly return anything .
24
- - Lookups of non-existent properties .
25
- - Function parameters which do not had any explicit value passed .
26
- - Anything that has been set to the value of ` undefined ` .
23
+ - Sentencia ` return ` que no retorna nada de forma explicíta .
24
+ - Búsquedas de propiedades inexistentes .
25
+ - Párametros de la función que no tienen ningún valor explicíto pasado .
26
+ - Cualquier valor que se estable en ` undefined ` .
27
27
28
- ### Handling Changes to the Value of ` undefined `
28
+ ### Manejar los cambios en el valor deChanges ` undefined `
29
29
30
- Since the global variable ` undefined ` only holds a copy of the actual * value* of
31
- ` undefined ` , assigning a new value to it does ** not ** change the value of the
32
- * type * ` undefined ` .
30
+ Dado que la variable ` undefined ` sólo tiene una copia del * value* de
31
+ ` undefined ` , assigna un nuevo valor que ** no ** cambie el valor del
32
+ * tipo * ` undefined ` .
33
33
34
- Still, in order to compare something against the value of ` undefined ` it is
35
- necessary to retrieve the value of ` undefined ` first.
36
34
37
- In order to protect code against a possible overwritten ` undefined ` variable, a
38
- common technique used is to add an additional parameter to an
39
- [ anonymous wrapper] ( #function.scopes ) , that gets no argument passed to it.
35
+ Aún con el fin de comparar con el valor de ` undefined ` es necesario
36
+ recuperar el valor de ` undefined ` primero.
37
+
38
+ Con el fin de proteger una posible sobreescritura en la variable ` undefined ` ,
39
+ una técnica común es agregar un párametro adicional a un
40
+ [ wrapper anónimo] ( #function.scopes ) , que consiga ningún párametro que se le pase.
41
+
40
42
41
43
var undefined = 123;
42
44
(function(something, foo, undefined) {
43
- // undefined in the local scope does
44
- // now again refer to the value
45
+ // undefined en el ámbito local
46
+ // ahora hace referencia al valor
45
47
46
48
})('Hello World', 42);
47
49
48
- Another way to achieve the same effect would be to use a declaration inside the
50
+ Otra forma de lograrlo un mismo efecto es declarar dentro un
49
51
wrapper.
50
52
51
53
var undefined = 123;
@@ -55,18 +57,18 @@ wrapper.
55
57
56
58
})('Hello World', 42);
57
59
58
- The only difference being here, that this version results in 4 more bytes being
59
- used in case it is minified and there is no other ` var ` statement inside the
60
- anonymous wrapper.
60
+ La única diferencia, es que está versión es de 4 bytes más que utiliza, y en
61
+ caso se comprima y no hay otra declaración de ' var' dentro del
62
+ wrapper anónimo .
61
63
62
- ### Uses of ` null `
63
64
64
- While ` undefined ` in the context of the JavaScript language is mostly used in
65
- the sense of a traditional * null* , the actual ` null ` (both a literal and a type)
66
- is more or less just another data type.
65
+ ### Uso de ` null `
67
66
68
- It is used in some JavaScript internals (like declaring the end of the
69
- prototype chain by setting ` Foo.prototype = null` ), but in almost all cases it
70
- can be replaced by ` undefined ` .
67
+ Mientras que ` undefined ` en el contexto del lenguaje JavaScript es muy usado
68
+ en el sentido tradicional como * null * , el actual ` null ` (ambos literal y de un tipo)
69
+ es más o menos que otro tipo de datos .
71
70
71
+ Es utilizado en algunos detalles internos de JavaScript (como declarar al final de un
72
+ cadena de prototipo estableciendo ` Foo.prototype = null ` ), pero en casi todos los
73
+ casos, puede ser reemplazado por ` undefined ` .
72
74
0 commit comments