{"size": 943, "ext": "js", "max_stars_repo_path": "ch11/sec5/testing-property.js", "max_stars_repo_name": "aiegoo/jsimpatient", "max_stars_repo_stars_event_min_datetime": "2020-10-20T03:43:38.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-28T21:30:31.000Z", "max_issues_repo_path": "ch11/sec5/testing-property.js", "max_issues_repo_name": "f1sle/Modern-JavaScript-for-the-Impatient", "max_issues_repo_issues_event_min_datetime": "2022-01-10T17:11:09.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-10T17:11:09.000Z", "max_forks_repo_path": "ch11/sec5/testing-property.js", "max_forks_repo_name": "f1sle/Modern-JavaScript-for-the-Impatient", "max_forks_repo_forks_event_min_datetime": "2021-02-06T15:04:45.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-03T06:20:19.000Z"}
{"max_stars_count": 18, "max_issues_count": 1, "max_forks_count": 7, "avg_line_length": 28.5757575758, "max_line_length": 80, "alphanum_fraction": 0.7380699894}
// node testing-property.js


'use strict'

console.log('// The in operator works with properties whose value is undefined')
const harry = { name: 'Harry', partner: undefined }

console.log('\'partner\' in harry:', 'partner' in harry) // true
const obj = harry

console.log('// hasOwnProperty doesn’t look into the prototype chain')
let stringOrSymbol = 'partner'
let result = obj.hasOwnProperty(stringOrSymbol)

console.log('result:', result) // true
stringOrSymbol = 'toString'    
result = obj.hasOwnProperty(stringOrSymbol)

console.log('result:', result) // false
// In contrast, in looks into prototype
result = stringOrSymbol in obj

console.log('result:', result) // true
console.log('// Checking if a property is enumerable')
result = obj.propertyIsEnumerable(stringOrSymbol)

console.log('result:', result) // false
stringOrSymbol = 'partner'
result = obj.propertyIsEnumerable(stringOrSymbol)

console.log('result:', result) // true
