Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="funcion constructor notación Java">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
function Persona(nombre, apellido1) {
  this.nombre = nombre;
  this.apellido1 = apellido1;
  this.getNombreCompleto = function() {
    return this.nombre + " " + this.apellido1;
  };
  this.saluda = function(persona) {
    if (persona instanceof Persona) { // <1>
      return "Hola " + persona.getNombreCompleto();
    } else {
      return "Hola colega";
    }
  };
}
var batman = new Persona("Bruce", "Wayne");
console.log(batman.getNombreCompleto());
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
aitormedran0pro
0viewers