I want to check if an "key" is present in a JS object. Is there a way of doing this? +the data can be an arbitrary subbranch within sometree
Example:
var sometree = {
foo : {
data : 1
},
foo2 : {
data : 5
}
}
function checkForKey(key, obj) {
//If I do "checkForKey(5, sometree)", I want the function
//to return "sometree.foo2.data".
}