![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
06/02/2009, 10:24
|
![Avatar de SPAWN3000](http://static.forosdelweb.com/customavatars/avatar222707_4.gif) | | | Fecha de Ingreso: marzo-2008 Ubicación: Bogota
Mensajes: 858
Antigüedad: 16 años, 11 meses Puntos: 15 | |
Respuesta: Crear funcion con formato propio Estuve probando el script, pero el solo me devuelve el resultado mas no me remplaza el valor de la variable...
Es decir:
Number.prototype.elevadoa = function(x) {
var a= 1;
while((x--) > 0) {a *= this;};
return a;
};
var numero = 4;
alert('1:'+numero.elevadoa(3) ); esto me da 64
numero.elevadoa(3);
alert('2:'+numero); //Pero esto sigue siendo 4
Se puede remplazar el dato? |