I want to toggle the Boolean value of this nested input object
var obj = { a: { b: { c: false } } };
in an efficient way so that obj
is output as:
{ a: { b: { c: true } } };
I am using:
Object.keys(obj).map(function(k, i) {
// Check if obj is Boolean else if object nest again till I find the Boolean value and toggle it.
}