Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="descriptorPropiedades" />
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
function creaPersona(nom, ape1) {
  var persona = {};
  Object.defineProperties(persona, {
    nombre: {
      value: nom,
      writable: true
    },
    apellido1: {
      value: ape1,
      writable: false
    }
  });
  return persona;
}
var batman = creaPersona("Bruce", "Wayne");
console.log(batman);
alert("yo");
batman.nombre = "Bruno";
batman.apellido1 = "Díaz";  // No se lanza ningún error, pero no modifica
console.log(batman);
Output

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

Dismiss x
public
Bin info
aitormedran0pro
0viewers