Ver Mensaje Individual
  #2 (permalink)  
Antiguo 12/02/2005, 16:32
occiso
 
Fecha de Ingreso: febrero-2005
Mensajes: 198
Antigüedad: 19 años, 3 meses
Puntos: 5
Me respondo a mi mismo.


El problema es que habia llamado a un atributo igual que a la funcion a la que hacia referencia decirEdad. Asi ya funciona:

Código:
function persona(nombre, edad){
	// atributos	
	this.nombre = nombre;
	this.edad = edad;
	//funciones
	this.decirNombre = nom;
	this.decirEdad = decirEdad;
	}
	
	function nom(){ return this.nombre; }
	function decirEdad() { return this.edad + '2222'; }
	
	function prueba(){
	  var pers1 = new persona('jose', '22');
		alert('nombre: '+ pers1.decirNombre());
		alert('edad:   '+ pers1.decirEdad() );  
	}