Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var myObject = {
    name: '@tips_js'
};
console.log(myObject.hasOwnProperty('name')); // true
console.log('name' in myObject); // true
console.log(myObject.hasOwnProperty('valueOf')); // false, valueOf is inherited from the prototype chain
console.log(('valueOf' in myObject)); // true
// Anohter example
var myFunc = function() {
  this.name = '@tips_js';
};
myFunc.prototype.age = '10 days';
var user = new myFunc();
console.log(user.hasOwnProperty('name')); // true
console.log(user.hasOwnProperty('age')); // false, because age is from the prototype chain
Output

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

Dismiss x
public
Bin info
loverajoelpro
0viewers