SyntaxFix
Write A Post
Hire A Developer
Questions
What do you mean by an "anonymous object?" myObj is not anonymous since you've assigned an object literal to a variable. You can just test this:
myObj
if (typeof myObj.prop2 === 'function') { // do whatever }