Detecting property of caller function

How do I detect the properties of the caller function? I want the called function to return different values to the caller depending on the property called with the function.

For example, if the caller function has the property x with the value test , I want the original function to return "y; value:" + valueOfX ( "y; value:test" ). Likewise if the caller function has property a with value of test2 , I want the original function to return "b; ValueOfA:" + valueOfA ( "b; ValueOfA:test2" ). If the caller function has no property, I want it to return n .

I’ve tried searching it up but only got answers on detecting the caller function, not the properties.

Thanks.

It’s a bit hard to understand your question, but you want to detect whether or not a certain object passed in has a certain argument with a certain property, right?

function returnDiff(prop){
  if("undefined" !== typeof prop.x){
    //prop.x exists!
    return "PROP X EXISTS";
  }
  else if("undefined" !== typeof prop.y){
    //Prop.y exists
    return "PROP Y EXISTS";
  }
  else{
    //Neither of them exist...
    return "NEITHER prop.x OR prop.y EXIST!!!";
  }
}

This is just a simple example, you can tweak it to return whatever you want or to check if a certain other property exists.

I don’t need answers anymore for this question. Thanks though!