我有一个看起来像这样的对象:
a =
{
b:
{
f: function()
{
console.log("B");
}
}
c:
{
f: function()
{
console.log("C");
}
}
}
How can I iterate through the main object, so the code goes through the main entry of what it contains and then executes their f()
function without mentioning names of each single entry? The "f" can be mentioned.
这是一种方法: