This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check if an object is empty | |
// Option #1 | |
const checkOpt1 = (obj) => { | |
for(let prop in obj) { | |
if (obj.hasOwnProperty(prop)) | |
return false | |
} | |
return true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @type: JavaScript | |
* @todo Find all methods of an object | |
*/ | |
const listMethods = obj => Object.getOwnPropertyNames(obj).filter( | |
item => typeof obj[item] === 'function' | |
) | |
// example | |
const food = { |