Say I have this code...
var personA = {
name: "john"
}
var personB = {
name: "john"
}
function doSomething(o) {
alert("Var is: " + o.toString()); // I need to convert 'o' to the object name
}
doSomething(personA);
doSomething(personB);
I want the alert output to be...
Var is: personA
Var is: personB
But I can't figure out how to get the name as string of the object?