Q: Is there a way to determine if an argument is a method in JavaScript? Is there any way to check if an argument passed into a function is a method?
For example, I want to determine inside a function if one of the inputs is a method or a stand-alone function:
function isMethod(collection, fct) {
  var isFct = (typeof fct === 'function');
  var isProperty = (collection.hasOwnProperty(fct)); // doesn't work b/c fct = object1.methodFct, not methodFct
  return `${isFct}, ${isProperty}`;
}

function nonMethodFct(a, b) {
  return a + b;
}

var object1 = {
  methodFct(a, b) { 
    return a + b;
  }
};

console.log(typeof object1.methodFct === 'function' && object1.hasOwnProperty('methodFct')); // returns true

var expectTrueFalse = isMethod(object1, nonMethodFct); // returns true, false
console.log(expectTrueFalse);
var expectTrueTrue = isMethod(object1, object1.methodFct); // returns true, (false)
console.log(expectTrueTrue);

Since an input of 'methodFct' returns an error for undefined (because methodFct is hidden inside the lexical scope of object1), I have to enter it in property accessor notation (object1.methodFct), which breaks the isProperty check inside the function. 
In other words, I want to do what the independent console.log() does, but I don't know how to do it with an argument instead of a hard-coded string.
I played around with JSON.stringify and .toString() but they seemed to only stringify the entire contents of collection and fct, not their names.

A: Use fct.name


function isMethod(collection, fct) {
    console.log(`fct.name = '${fct.name}'`);
    return (typeof collection[fct.name] === 'function');
}

function nonMethodFct(a, b) {
    return a + b;
}

var object1 = {
    methodFct(a, b) { 
        return a + b;
    }
};


var expectFalse = isMethod(object1, nonMethodFct); // false
console.log(expectFalse);
var expectTrue = isMethod(object1, object1.methodFct); // true
console.log(expectTrue);


