I have an object that you see below:
var obj = {
a: {
b:{
c:"c"
}
}
}
and I want to get the value as below:
var t = ["a", "b", "c"]
console.log(obj["a"]["b"]["c"])
I want to encapsulate a requirement in a function:
function get_value(obj, key_list) {
}
because it is key_listnot defined, so how to implement the function?
source
share