Skip to content

Instantly share code, notes, and snippets.

@andypinet
Created February 23, 2015 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andypinet/0461c879ab1db18f3f53 to your computer and use it in GitHub Desktop.
Save andypinet/0461c879ab1db18f3f53 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/rapeqi
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var o = {p:2};
console.log(Object.getOwnPropertyDescriptor(o, 'p'));
Object.defineProperty(o, 'p', {
// value: 123,
// writable: false,
set: function() {
return 1;
}
});
o.p = 1232;
console.log(Object.getOwnPropertyDescriptor(o, 'p'));
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.1.min.js"><\/script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
</body>
</html></script>
<script id="jsbin-source-javascript" type="text/javascript">var o = {p:2};
console.log(Object.getOwnPropertyDescriptor(o, 'p'));
Object.defineProperty(o, 'p', {
// value: 123,
// writable: false,
set: function() {
return 1;
}
});
o.p = 1232;
console.log(Object.getOwnPropertyDescriptor(o, 'p'));
</script></body>
</html>
var o = {p:2};
console.log(Object.getOwnPropertyDescriptor(o, 'p'));
Object.defineProperty(o, 'p', {
// value: 123,
// writable: false,
set: function() {
return 1;
}
});
o.p = 1232;
console.log(Object.getOwnPropertyDescriptor(o, 'p'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment