var object = {foo: 'bar'};
Does JavaScript have a way to determine that object.foo is a property of object from inside a function to which object.foo is passed? In other words, is it possible to write a func that could do this:
getSource(object.foo) === object
No, there’s no back-reference like that in JavaScript. What gets passed into a function is a value —
5,"foo", an object reference, etc. There’s no information on that value that tells you the value came from an object property, much less which object’s property.