Toggle the Boolean value of a nested JavaScript object [closed]
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 days ago . 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